]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: define and use call16 everywhere
authorAustin Clements <austin@google.com>
Sun, 4 Oct 2020 00:40:49 +0000 (20:40 -0400)
committerAustin Clements <austin@google.com>
Mon, 5 Oct 2020 17:03:04 +0000 (17:03 +0000)
Currently, runtime.call16 is defined and used only on 32-bit
architectures, while 64-bit architectures all start at call32 and go
up from there. This led to unnecessary complexity because call16's
prototype needed to be in a different file, separate from all of the
other call* prototypes, which in turn led to it getting out of sync
with the other call* prototypes. This CL adds call16 on 64-bit
architectures, bringing them all into sync, and moves the call16
prototype to live with the others.

Prior to CL 31655 (in 2016), call16 couldn't be implemented on 64-bit
architectures because it needed at least four words of argument space
to invoke "callwritebarrier" after copying back the results. CL 31655
changed the way call* invoked the write barrier in preparation for the
hybrid barrier; since the hybrid barrier had to be invoked prior to
copying back results, it needed a different solution that didn't reuse
call*'s stack space. At this point, call16 was no longer a problem on
64-bit, but we never added it. Until now.

Change-Id: Id10ade0e4f75c6ea76afa6229ddaee2b994c27dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/259339
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/asm_amd64.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_ppc64x.s
src/runtime/asm_riscv64.s
src/runtime/asm_s390x.s
src/runtime/asm_wasm.s
src/runtime/stubs.go
src/runtime/stubs32.go [deleted file]

index fa25c55b96c946145d340801aae245d39227f79a..256f4112cd90805df3af988d6fe5ea8a141964c8 100644 (file)
@@ -470,6 +470,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0
 
 TEXT ·reflectcall(SB), NOSPLIT, $0-32
        MOVLQZX argsize+24(FP), CX
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
@@ -537,6 +538,7 @@ TEXT callRet<>(SB), NOSPLIT, $32-0
        CALL    runtime·reflectcallmove(SB)
        RET
 
+CALLFN(·call16, 16)
 CALLFN(·call32, 32)
 CALLFN(·call64, 64)
 CALLFN(·call128, 128)
index 6b3d1e779e6efef12b41c3507f5c722b54727342..5eda3063d7a7db8fca156fe6353c6e5aad0fb5fb 100644 (file)
@@ -331,6 +331,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
 
 TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
        MOVWU argsize+24(FP), R16
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
@@ -416,6 +417,7 @@ TEXT callRet<>(SB), NOSPLIT, $40-0
 
 // These have 8 added to make the overall frame size a multiple of 16,
 // as required by the ABI. (There is another +8 for the saved LR.)
+CALLFN(·call16, 24 )
 CALLFN(·call32, 40 )
 CALLFN(·call64, 72 )
 CALLFN(·call128, 136 )
index 7330f40e850c4925f12bd69bff4d0c8ab2f2a1be..0ff1b242253356c4df95c8077761668add6a513a 100644 (file)
@@ -294,6 +294,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
 
 TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
        MOVWU argsize+24(FP), R1
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
index 23387a21655c9892a3051195ba0c2176f808cc06..603058a61be6162258ebf038c7b91a0ceded0349 100644 (file)
@@ -372,6 +372,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
 
 TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
        MOVWZ argsize+24(FP), R3
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
@@ -478,6 +479,7 @@ TEXT callRet<>(SB), NOSPLIT, $32-0
        BL      runtime·reflectcallmove(SB)
        RET
 
+CALLFN(·call16, 16)
 CALLFN(·call32, 32)
 CALLFN(·call64, 64)
 CALLFN(·call128, 128)
index 8f6c8773eb089409259a4cc1c8726c5a908865fd..4084ced7f8bd46845a601878d6303661c03a781e 100644 (file)
@@ -342,6 +342,7 @@ TEXT reflect·call(SB), NOSPLIT, $0-0
 // func reflectcall(argtype *_type, fn, arg unsafe.Pointer, argsize uint32, retoffset uint32)
 TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
        MOVWU argsize+24(FP), T0
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
index cb39451faaae0c42de31a1973c55340b3b54dece..46a434119b6d64139f16a05a464d89cfb6ae9fb1 100644 (file)
@@ -383,6 +383,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
 
 TEXT ·reflectcall(SB), NOSPLIT, $-8-32
        MOVWZ argsize+24(FP), R3
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
@@ -461,6 +462,7 @@ TEXT callRet<>(SB), NOSPLIT, $32-0
        BL      runtime·reflectcallmove(SB)
        RET
 
+CALLFN(·call16, 16)
 CALLFN(·call32, 32)
 CALLFN(·call64, 64)
 CALLFN(·call128, 128)
index 7d88beb537dcfa5f687915bedecbd1ec50374cbd..1275af136b303838166328a5cc1e41b8ef4f521b 100644 (file)
@@ -308,6 +308,7 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-32
 
        MOVW argsize+24(FP), R0
 
+       DISPATCH(runtime·call16, 16)
        DISPATCH(runtime·call32, 32)
        DISPATCH(runtime·call64, 64)
        DISPATCH(runtime·call128, 128)
@@ -398,6 +399,7 @@ TEXT callRet<>(SB), NOSPLIT, $32-0
        CALL runtime·reflectcallmove(SB)
        RET
 
+CALLFN(·call16, 16)
 CALLFN(·call32, 32)
 CALLFN(·call64, 64)
 CALLFN(·call128, 128)
index b891a12fddcd23c7ba07ed8376bed6eed1ae0d9d..bd2514e8628b1bdd2ba686eedbc723689d9a822c 100644 (file)
@@ -271,6 +271,7 @@ func return0()
 
 // in asm_*.s
 // not called directly; definitions here supply type information for traceback.
+func call16(typ, fn, arg unsafe.Pointer, n, retoffset uint32)
 func call32(typ, fn, arg unsafe.Pointer, n, retoffset uint32)
 func call64(typ, fn, arg unsafe.Pointer, n, retoffset uint32)
 func call128(typ, fn, arg unsafe.Pointer, n, retoffset uint32)
diff --git a/src/runtime/stubs32.go b/src/runtime/stubs32.go
deleted file mode 100644 (file)
index c4715fe..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386 arm mips mipsle
-
-package runtime
-
-import "unsafe"
-
-// Declarations for runtime services implemented in C or assembly that
-// are only present on 32 bit systems.
-
-func call16(typ, fn, arg unsafe.Pointer, n, retoffset uint32)