aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 5b989d28e9..81ff21113f 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -241,6 +241,15 @@ func newdefer(siz int32) *_defer {
total := roundupsize(totaldefersize(uintptr(siz)))
d = (*_defer)(mallocgc(total, deferType, true))
})
+ if debugCachedWork {
+ // Duplicate the tail below so if there's a
+ // crash in checkPut we can tell if d was just
+ // allocated or came from the pool.
+ d.siz = siz
+ d.link = gp._defer
+ gp._defer = d
+ return d
+ }
}
d.siz = siz
d.link = gp._defer