]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use register ABI for race detector functions
authorCherry Zhang <cherryyz@google.com>
Tue, 6 Apr 2021 00:26:11 +0000 (20:26 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 6 Apr 2021 21:43:19 +0000 (21:43 +0000)
runtime.raceread/racewrite/racewriterange are functions that are
called from compiler instrumented code, follwoing ABIInternal.
They are assembly functions defined as ABIInternal in the runtime,
in order to avoid wrappers because they need to get the caller's
PC. This CL makes them to use the actual internal ABI.

Change-Id: Id91d73cf257f7b11a858958d85c38c4aa904d9c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/307812
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/race_amd64.s

index 5f6b86a1feb306372dce310dc96e71734355dc35..426777b8bf9b5048689ad119696a53db78077ea1 100644 (file)
 // Defined as ABIInternal so as to avoid introducing a wrapper,
 // which would render runtime.getcallerpc ineffective.
 TEXT   runtime·raceread<ABIInternal>(SB), NOSPLIT, $0-8
+#ifdef GOEXPERIMENT_REGABI_ARGS
+       MOVQ    AX, RARG1
+#else
        MOVQ    addr+0(FP), RARG1
+#endif
        MOVQ    (SP), RARG2
        // void __tsan_read(ThreadState *thr, void *addr, void *pc);
        MOVQ    $__tsan_read(SB), AX
@@ -70,7 +74,11 @@ TEXT runtime·racereadpc(SB), NOSPLIT, $0-24
 // Defined as ABIInternal so as to avoid introducing a wrapper,
 // which would render runtime.getcallerpc ineffective.
 TEXT   runtime·racewrite<ABIInternal>(SB), NOSPLIT, $0-8
+#ifdef GOEXPERIMENT_REGABI_ARGS
+       MOVQ    AX, RARG1
+#else
        MOVQ    addr+0(FP), RARG1
+#endif
        MOVQ    (SP), RARG2
        // void __tsan_write(ThreadState *thr, void *addr, void *pc);
        MOVQ    $__tsan_write(SB), AX
@@ -121,8 +129,13 @@ TEXT       runtime·racereadrangepc1(SB), NOSPLIT, $0-24
 // Defined as ABIInternal so as to avoid introducing a wrapper,
 // which would render runtime.getcallerpc ineffective.
 TEXT   runtime·racewriterange<ABIInternal>(SB), NOSPLIT, $0-16
+#ifdef GOEXPERIMENT_REGABI_ARGS
+       MOVQ    AX, RARG1
+       MOVQ    BX, RARG2
+#else
        MOVQ    addr+0(FP), RARG1
        MOVQ    size+8(FP), RARG2
+#endif
        MOVQ    (SP), RARG3
        // void __tsan_write_range(ThreadState *thr, void *addr, uintptr size, void *pc);
        MOVQ    $__tsan_write_range(SB), AX