aboutsummaryrefslogtreecommitdiff
path: root/test/nosplit.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2017-10-05 16:14:14 -0400
committerCherry Zhang <cherryyz@google.com>2017-10-31 19:12:11 +0000
commitf33f20ef1f50e769e71ba6252e6f9fcafabee449 (patch)
tree5ee2ae3dad5dcc12bb00af33d6ab8e9fb4340bdd /test/nosplit.go
parent54d04c2fcb7e1e0bebbedeeca6328fd0362254ce (diff)
downloadgo-f33f20ef1f50e769e71ba6252e6f9fcafabee449.tar.gz
go-f33f20ef1f50e769e71ba6252e6f9fcafabee449.zip
test: fix and re-enable nosplit.go
The test was skipped because it did not work on AMD64 with frame pointer enabled, and accidentally skipped on other architectures. Now frame pointer is the default on AMD64. Update the test to work with frame pointer. Now the test is skipped only when frame pointer is NOT enabled on AMD64. Fixes #18317. Change-Id: I724cb6874e562f16e67ce5f389a1d032a2003115 Reviewed-on: https://go-review.googlesource.com/68610 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'test/nosplit.go')
-rw-r--r--test/nosplit.go43
1 files changed, 20 insertions, 23 deletions
diff --git a/test/nosplit.go b/test/nosplit.go
index 989d8ccba7..e6cecebde3 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -115,15 +115,15 @@ main 132
main 136
# A nosplit leaf can use the whole 128-CallSize bytes available on entry.
-# (CallSize is 32 on ppc64)
+# (CallSize is 32 on ppc64, 8 on amd64 for frame pointer.)
main 96 nosplit
main 100 nosplit; REJECT ppc64 ppc64le
main 104 nosplit; REJECT ppc64 ppc64le
main 108 nosplit; REJECT ppc64 ppc64le
main 112 nosplit; REJECT ppc64 ppc64le
main 116 nosplit; REJECT ppc64 ppc64le
-main 120 nosplit; REJECT ppc64 ppc64le
-main 124 nosplit; REJECT ppc64 ppc64le
+main 120 nosplit; REJECT ppc64 ppc64le amd64
+main 124 nosplit; REJECT ppc64 ppc64le amd64
main 128 nosplit; REJECT
main 132 nosplit; REJECT
main 136 nosplit; REJECT
@@ -132,13 +132,14 @@ main 136 nosplit; REJECT
# having room for the saved caller PC and the called frame.
# Because ARM doesn't save LR in the leaf, it gets an extra 4 bytes.
# Because arm64 doesn't save LR in the leaf, it gets an extra 8 bytes.
-# ppc64 doesn't save LR in the leaf, but CallSize is 32, so it gets 24 fewer bytes than amd64.
+# ppc64 doesn't save LR in the leaf, but CallSize is 32, so it gets 24 bytes.
+# Because AMD64 uses frame pointer, it has 8 fewer bytes.
main 96 nosplit call f; f 0 nosplit
main 100 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
main 104 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
main 108 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
-main 112 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
-main 116 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 112 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64
+main 116 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64
main 120 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64
main 124 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64 386
main 128 nosplit call f; f 0 nosplit; REJECT
@@ -148,11 +149,11 @@ main 136 nosplit call f; f 0 nosplit; REJECT
# Calling a splitting function from a nosplit function requires
# having room for the saved caller PC of the call but also the
# saved caller PC for the call to morestack.
-# RISC architectures differ in the same way as before.
+# Architectures differ in the same way as before.
main 96 nosplit call f; f 0 call f
main 100 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
-main 104 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
-main 108 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
+main 104 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
+main 108 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
main 112 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
main 116 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
main 120 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64 386
@@ -164,8 +165,8 @@ main 136 nosplit call f; f 0 call f; REJECT
# Indirect calls are assumed to be splitting functions.
main 96 nosplit callind
main 100 nosplit callind; REJECT ppc64 ppc64le
-main 104 nosplit callind; REJECT ppc64 ppc64le
-main 108 nosplit callind; REJECT ppc64 ppc64le
+main 104 nosplit callind; REJECT ppc64 ppc64le amd64
+main 108 nosplit callind; REJECT ppc64 ppc64le amd64
main 112 nosplit callind; REJECT ppc64 ppc64le amd64
main 116 nosplit callind; REJECT ppc64 ppc64le amd64
main 120 nosplit callind; REJECT ppc64 ppc64le amd64 386
@@ -198,18 +199,14 @@ func main() {
goarch = runtime.GOARCH
}
- // Frame pointer is on by default now.
- // golang.org/issue/18317.
- return
-
version, err := exec.Command("go", "tool", "compile", "-V").Output()
if err != nil {
bug()
fmt.Printf("running go tool compile -V: %v\n", err)
return
}
- if strings.Contains(string(version), "framepointer") {
- // Skip this test if GOEXPERIMENT=framepointer
+ if s := string(version); goarch == "amd64" && strings.Contains(s, "X:") && !strings.Contains(s, "framepointer") {
+ // Skip this test if framepointer is NOT enabled on AMD64
return
}
@@ -266,18 +263,18 @@ TestCases:
ptrSize := 4
switch goarch {
case "mips", "mipsle":
- fmt.Fprintf(&buf, "#define CALL JAL\n#define REGISTER (R0)\n")
+ fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
case "mips64", "mips64le":
ptrSize = 8
- fmt.Fprintf(&buf, "#define CALL JAL\n#define REGISTER (R0)\n")
+ fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
case "ppc64", "ppc64le":
ptrSize = 8
- fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (CTR)\n")
+ fmt.Fprintf(&buf, "#define REGISTER (CTR)\n")
case "arm":
- fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n")
+ fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
case "arm64":
ptrSize = 8
- fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n")
+ fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
case "amd64":
ptrSize = 8
fmt.Fprintf(&buf, "#define REGISTER AX\n")
@@ -307,7 +304,7 @@ TestCases:
name := m[1]
size, _ := strconv.Atoi(m[2])
- // The limit was originally 128 but is now 592.
+ // The limit was originally 128 but is now 752 (880-128).
// Instead of rewriting the test cases above, adjust
// the first stack frame to use up the extra bytes.
if i == 0 {