]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] internal/bytealg: call memeqbody directly in memequal_varlen on...
authorCherry Mui <cherryyz@google.com>
Wed, 2 Jun 2021 22:00:12 +0000 (18:00 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 3 Jun 2021 14:29:14 +0000 (14:29 +0000)
Currently, memequal_varlen opens up a frame and call memequal,
which then tail-calls memeqbody. This CL changes memequal_varlen
tail-calls memeqbody directly.

This makes it simpler to switch to the register ABI in the next
CL.

Change-Id: Ia1367c0abb7f4755fe736c404411793fb9e5c04f
Reviewed-on: https://go-review.googlesource.com/c/go/+/324399
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/internal/bytealg/equal_arm64.s

index 01aa7b7b7aa8adbc0f1945a072e6c2a576c082fc..944edd876861148792937bd7f1a7c2f9ad727f22 100644 (file)
@@ -20,20 +20,15 @@ equal:
        RET
 
 // memequal_varlen(a, b unsafe.Pointer) bool
-TEXT runtime·memequal_varlen(SB),NOSPLIT,$40-17
-       MOVD    a+0(FP), R3
-       MOVD    b+8(FP), R4
-       CMP     R3, R4
+TEXT runtime·memequal_varlen(SB),NOSPLIT,$0-17
+       MOVD    a+0(FP), R0
+       MOVD    b+8(FP), R2
+       CMP     R0, R2
        BEQ     eq
-       MOVD    8(R26), R5    // compiler stores size at offset 8 in the closure
-       CBZ     R5, eq
-       MOVD    R3, 8(RSP)
-       MOVD    R4, 16(RSP)
-       MOVD    R5, 24(RSP)
-       BL      runtime·memequal(SB)
-       MOVBU   32(RSP), R3
-       MOVB    R3, ret+16(FP)
-       RET
+       MOVD    8(R26), R1    // compiler stores size at offset 8 in the closure
+       CBZ     R1, eq
+       MOVD    $ret+16(FP), R8
+       B       memeqbody<>(SB)
 eq:
        MOVD    $1, R3
        MOVB    R3, ret+16(FP)