diff options
| author | Austin Clements <austin@google.com> | 2016-10-17 18:41:56 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2016-10-28 18:20:33 +0000 |
| commit | 87e48c5afdcf5e01bb2b7f51b7643e8901f4b7f9 (patch) | |
| tree | 4c60e60c8bdb95c6d7a20fa4b9bada08805d0fdc /src/runtime/mbitmap.go | |
| parent | ae3bb4a537c84e43be2ed7b79e84450332aafe2d (diff) | |
| download | go-87e48c5afdcf5e01bb2b7f51b7643e8901f4b7f9.tar.xz | |
runtime, cmd/compile: rename memclr -> memclrNoHeapPointers
Since barrier-less memclr is only safe in very narrow circumstances,
this commit renames memclr to avoid accidentally calling memclr on
typed memory. This can cause subtle, non-deterministic bugs, so it's
worth some effort to prevent. In the near term, this will also prevent
bugs creeping in from any concurrent CLs that add calls to memclr; if
this happens, whichever patch hits master second will fail to compile.
This also adds the other new memclr variants to the compiler's
builtin.go to minimize the churn on that binary blob. We'll use these
in future commits.
Updates #17503.
Change-Id: I00eead049f5bd35ca107ea525966831f3d1ed9ca
Reviewed-on: https://go-review.googlesource.com/31369
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/mbitmap.go')
| -rw-r--r-- | src/runtime/mbitmap.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index f1f9158eeb..be52bfacc6 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -742,7 +742,7 @@ func (h heapBits) initSpan(s *mspan) { } return } - memclr(unsafe.Pointer(subtractb(h.bitp, nbyte-1)), nbyte) + memclrNoHeapPointers(unsafe.Pointer(subtractb(h.bitp, nbyte-1)), nbyte) } // initCheckmarkSpan initializes a span for being checkmarked. @@ -1433,7 +1433,7 @@ func heapBitsSetTypeGCProg(h heapBits, progSize, elemSize, dataSize, allocSize u } endProg := unsafe.Pointer(subtractb(h.bitp, (totalBits+3)/4)) endAlloc := unsafe.Pointer(subtractb(h.bitp, allocSize/heapBitmapScale)) - memclr(add(endAlloc, 1), uintptr(endProg)-uintptr(endAlloc)) + memclrNoHeapPointers(add(endAlloc, 1), uintptr(endProg)-uintptr(endAlloc)) } // progToPointerMask returns the 1-bit pointer mask output by the GC program prog. |
