diff options
author | Keith Randall <khr@golang.org> | 2019-06-05 18:42:31 +0000 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2019-06-05 19:50:09 +0000 |
commit | 49200e3f3e61f505acb152e150d054ef1db03b3e (patch) | |
tree | a0449ffcfb21af960ab9053eac39e6e42318b34e /src/runtime/stack_test.go | |
parent | e9a136d185af8dcdb270096af520087c92c8b4af (diff) | |
download | go-49200e3f3e61f505acb152e150d054ef1db03b3e.tar.gz go-49200e3f3e61f505acb152e150d054ef1db03b3e.zip |
Revert "cmd/compile,runtime: allocate defer records on the stack"
This reverts commit fff4f599fe1c21e411a99de5c9b3777d06ce0ce6.
Reason for revert: Seems to still have issues around GC.
Fixes #32452
Change-Id: Ibe7af629f9ad6a3d5312acd7b066123f484da7f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/180761
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/runtime/stack_test.go')
-rw-r--r-- | src/runtime/stack_test.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/runtime/stack_test.go b/src/runtime/stack_test.go index 143d3a99a0..df73b3a1d5 100644 --- a/src/runtime/stack_test.go +++ b/src/runtime/stack_test.go @@ -799,58 +799,3 @@ func TestDeferLiveness(t *testing.T) { t.Errorf("output:\n%s\n\nwant no output", output) } } - -func TestDeferHeapAndStack(t *testing.T) { - P := 4 // processors - N := 10000 //iterations - D := 200 // stack depth - - if testing.Short() { - P /= 2 - N /= 10 - D /= 10 - } - c := make(chan bool) - for p := 0; p < P; p++ { - go func() { - for i := 0; i < N; i++ { - if deferHeapAndStack(D) != 2*D { - panic("bad result") - } - } - c <- true - }() - } - for p := 0; p < P; p++ { - <-c - } -} - -// deferHeapAndStack(n) computes 2*n -func deferHeapAndStack(n int) (r int) { - if n == 0 { - return 0 - } - if n%2 == 0 { - // heap-allocated defers - for i := 0; i < 2; i++ { - defer func() { - r++ - }() - } - } else { - // stack-allocated defers - defer func() { - r++ - }() - defer func() { - r++ - }() - } - r = deferHeapAndStack(n - 1) - escapeMe(new([1024]byte)) // force some GCs - return -} - -// Pass a value to escapeMe to force it to escape. -var escapeMe = func(x interface{}) {} |