diff options
author | Cherry Zhang <cherryyz@google.com> | 2021-04-15 11:19:30 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2021-04-16 20:18:11 +0000 |
commit | 4fb74e055595a0009f11272432c2a5047a64507b (patch) | |
tree | 2979782d53491f321ed3d8d97c0ee466bbc44d4f /src/reflect | |
parent | b6e1c336037e53ae095e84cfed4a312d8fd3ad45 (diff) | |
download | go-4fb74e055595a0009f11272432c2a5047a64507b.tar.gz go-4fb74e055595a0009f11272432c2a5047a64507b.zip |
reflect: preserve ctxt across moveMakeFuncArgPtrs
In makeFuncStub and methodValueCall, it stores ctxt (DX) as an
argument of moveMakeFuncArgPtrs, and assumes it does not change
by the call. This is not guaranteed, and it does happen if
-clobberdead compiler flag is used. Store it somewhere else and
reload after the call.
Change-Id: I9307e3cf94db4b38305ab35494088386dfcbaae8
Reviewed-on: https://go-review.googlesource.com/c/go/+/310409
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/asm_amd64.s | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/reflect/asm_amd64.s b/src/reflect/asm_amd64.s index 22d95f2a7e..facf07516d 100644 --- a/src/reflect/asm_amd64.s +++ b/src/reflect/asm_amd64.s @@ -33,9 +33,12 @@ TEXT ·makeFuncStub<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID. LEAQ LOCAL_REGARGS(SP), R12 CALL runtime·spillArgs<ABIInternal>(SB) + MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area MOVQ DX, 0(SP) MOVQ R12, 8(SP) CALL ·moveMakeFuncArgPtrs(SB) + MOVQ 24(SP), DX + MOVQ DX, 0(SP) LEAQ argframe+0(FP), CX MOVQ CX, 8(SP) MOVB $0, LOCAL_RETVALID(SP) @@ -61,9 +64,12 @@ TEXT ·methodValueCall<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312 // frame is specially handled in the runtime. See the comment above LOCAL_RETVALID. LEAQ LOCAL_REGARGS(SP), R12 CALL runtime·spillArgs<ABIInternal>(SB) + MOVQ DX, 24(SP) // outside of moveMakeFuncArgPtrs's arg area MOVQ DX, 0(SP) MOVQ R12, 8(SP) CALL ·moveMakeFuncArgPtrs(SB) + MOVQ 24(SP), DX + MOVQ DX, 0(SP) LEAQ argframe+0(FP), CX MOVQ CX, 8(SP) MOVB $0, LOCAL_RETVALID(SP) |