aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2021-06-08 18:45:18 -0400
committerCherry Mui <cherryyz@google.com>2021-06-11 18:33:07 +0000
commite0e9fb8affbe37c2ff73b9afb60f726e747f428d (patch)
tree6a3fa8b8e487eab8ac3434bb21e7174d22c2266f /src/runtime/malloc.go
parent4468e1cfb94ed07fea5514dce740180fd3a6d20f (diff)
downloadgo-e0e9fb8affbe37c2ff73b9afb60f726e747f428d.tar.xz
[dev.typeparams] runtime: simplify defer record allocation
Now that deferred functions are always argumentless and defer records are no longer with arguments, defer record can be fixed size (just the _defer struct). This allows us to simplify the allocation of defer records, specifically, remove the defer classes and the pools of different sized defers. Change-Id: Icc4b16afc23b38262ca9dd1f7369ad40874cf701 Reviewed-on: https://go-review.googlesource.com/c/go/+/326062 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 2759bbdaf9..c5f62483ff 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -420,8 +420,6 @@ func mallocinit() {
throw("bad TinySizeClass")
}
- testdefersizes()
-
if heapArenaBitmapBytes&(heapArenaBitmapBytes-1) != 0 {
// heapBits expects modular arithmetic on bitmap
// addresses to work.
@@ -1088,15 +1086,6 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
var scanSize uintptr
if !noscan {
- // If allocating a defer+arg block, now that we've picked a malloc size
- // large enough to hold everything, cut the "asked for" size down to
- // just the defer header, so that the GC bitmap will record the arg block
- // as containing nothing at all (as if it were unused space at the end of
- // a malloc block caused by size rounding).
- // The defer arg areas are scanned as part of scanstack.
- if typ == deferType {
- dataSize = unsafe.Sizeof(_defer{})
- }
heapBitsSetType(uintptr(x), size, dataSize, typ)
if dataSize > typ.size {
// Array allocation. If there are any