As a newbie of golang's assembly, i cant understand why we MOVQ DX CX twice in runtime.gogo. WHY?
Source code: ``` 255 // func gogo(buf *gobuf) 256 // restore state from Gobuf; longjmp 257 TEXT runtimeĀ·gogo(SB), NOSPLIT, $0-8 258 MOVQ buf+0(FP), BX // gobuf 259 MOVQ gobuf_g(BX), DX 260 MOVQ 0(DX), CX // make sure g != nil 261 JMP gogo<>(SB) 262 263 TEXT gogo<>(SB), NOSPLIT, $0 264 get_tls(CX) 265 MOVQ DX, g(CX) 266 MOVQ DX, R14 // set the g register 267 MOVQ gobuf_sp(BX), SP // restore SP 268 MOVQ gobuf_ret(BX), AX 269 MOVQ gobuf_ctxt(BX), DX 270 MOVQ gobuf_bp(BX), BP 271 MOVQ $0, gobuf_sp(BX) // clear to help garbage collector 272 MOVQ $0, gobuf_ret(BX) 273 MOVQ $0, gobuf_ctxt(BX) 274 MOVQ $0, gobuf_bp(BX) 275 MOVQ gobuf_pc(BX), BX 276 JMP BX ``` Link: https://github.com/golang/go/blob/go1.17.13/src/runtime/asm_amd64.s#L255 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5fafeb38-1bc7-4a96-b386-41e14c431273n%40googlegroups.com.