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/panic.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/panic.go')
-rw-r--r-- | src/runtime/panic.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go index ce26eb540d..f39a4bc0a2 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -228,46 +228,6 @@ func deferproc(siz int32, fn *funcval) { // arguments of fn follow fn // been set and must not be clobbered. } -// deferprocStack queues a new deferred function with a defer record on the stack. -// The defer record must have its siz and fn fields initialized. -// All other fields can contain junk. -// The defer record must be immediately followed in memory by -// the arguments of the defer. -// Nosplit because the arguments on the stack won't be scanned -// until the defer record is spliced into the gp._defer list. -//go:nosplit -func deferprocStack(d *_defer) { - gp := getg() - if gp.m.curg != gp { - // go code on the system stack can't defer - throw("defer on system stack") - } - // siz and fn are already set. - // The other fields are junk on entry to deferprocStack and - // are initialized here. - d.started = false - d.heap = false - d.sp = getcallersp() - d.pc = getcallerpc() - // The lines below implement: - // d.panic = nil - // d.link = gp._defer - // gp._defer = d - // But without write barriers. The first two are writes to - // the stack so they don't need a write barrier, and furthermore - // are to uninitialized memory, so they must not use a write barrier. - // The third write does not require a write barrier because we - // explicitly mark all the defer structures, so we don't need to - // keep track of pointers to them with a write barrier. - *(*uintptr)(unsafe.Pointer(&d._panic)) = 0 - *(*uintptr)(unsafe.Pointer(&d.link)) = uintptr(unsafe.Pointer(gp._defer)) - *(*uintptr)(unsafe.Pointer(&gp._defer)) = uintptr(unsafe.Pointer(d)) - - return0() - // No code can go here - the C return register has - // been set and must not be clobbered. -} - // Small malloc size classes >= 16 are the multiples of 16: 16, 32, 48, 64, 80, 96, 112, 128, 144, ... // Each P holds a pool for defers with small arg sizes. // Assign defer allocations to pools by rounding to 16, to match malloc size classes. @@ -389,7 +349,6 @@ func newdefer(siz int32) *_defer { } } d.siz = siz - d.heap = true d.link = gp._defer gp._defer = d return d @@ -409,9 +368,6 @@ func freedefer(d *_defer) { if d.fn != nil { freedeferfn() } - if !d.heap { - return - } sc := deferclass(uintptr(d.siz)) if sc >= uintptr(len(p{}.deferpool)) { return |