aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mbitmap.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-01-30 20:13:43 -0500
committerRuss Cox <rsc@golang.org>2022-04-05 17:54:15 +0000
commit9839668b5619f45e293dd40339bf0ac614ea6bee (patch)
treea836ea07d0a9ec5e32638d060cdeb6b4ded636dc /src/runtime/mbitmap.go
parent81431c7aa7c5d782e72dec342442ea7664ef1783 (diff)
downloadgo-9839668b5619f45e293dd40339bf0ac614ea6bee.tar.xz
all: separate doc comment from //go: directives
A future change to gofmt will rewrite // Doc comment. //go:foo to // Doc comment. // //go:foo Apply that change preemptively to all comments (not necessarily just doc comments). For #51082. Change-Id: Iffe0285418d1e79d34526af3520b415a12203ca9 Reviewed-on: https://go-review.googlesource.com/c/go/+/384260 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/mbitmap.go')
-rw-r--r--src/runtime/mbitmap.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go
index 937968807b..665a9c6f63 100644
--- a/src/runtime/mbitmap.go
+++ b/src/runtime/mbitmap.go
@@ -65,6 +65,7 @@ const (
)
// addb returns the byte pointer p+n.
+//
//go:nowritebarrier
//go:nosplit
func addb(p *byte, n uintptr) *byte {
@@ -75,6 +76,7 @@ func addb(p *byte, n uintptr) *byte {
}
// subtractb returns the byte pointer p-n.
+//
//go:nowritebarrier
//go:nosplit
func subtractb(p *byte, n uintptr) *byte {
@@ -85,6 +87,7 @@ func subtractb(p *byte, n uintptr) *byte {
}
// add1 returns the byte pointer p+1.
+//
//go:nowritebarrier
//go:nosplit
func add1(p *byte) *byte {
@@ -95,9 +98,11 @@ func add1(p *byte) *byte {
}
// subtract1 returns the byte pointer p-1.
+//
//go:nowritebarrier
//
// nosplit because it is used during write barriers and must not be preempted.
+//
//go:nosplit
func subtract1(p *byte) *byte {
// Note: wrote out full expression instead of calling subtractb(p, 1)
@@ -314,6 +319,7 @@ func (m *markBits) advance() {
// In particular, be careful not to point past the end of an object.
//
// nosplit because it is used during write barriers and must not be preempted.
+//
//go:nosplit
func heapBitsForAddr(addr uintptr) (h heapBits) {
// 2 bits per word, 4 pairs per byte, and a mask is hard coded.
@@ -381,6 +387,7 @@ func badPointer(s *mspan, p, refBase, refOff uintptr) {
//
// It is nosplit so it is safe for p to be a pointer to the current goroutine's stack.
// Since p is a uintptr, it would not be adjusted if the stack were to move.
+//
//go:nosplit
func findObject(p, refBase, refOff uintptr) (base uintptr, s *mspan, objIndex uintptr) {
s = spanOf(p)
@@ -418,6 +425,7 @@ func findObject(p, refBase, refOff uintptr) (base uintptr, s *mspan, objIndex ui
}
// verifyNotInHeapPtr reports whether converting the not-in-heap pointer into a unsafe.Pointer is ok.
+//
//go:linkname reflect_verifyNotInHeapPtr reflect.verifyNotInHeapPtr
func reflect_verifyNotInHeapPtr(p uintptr) bool {
// Conversion to a pointer is ok as long as findObject above does not call badPointer.
@@ -431,6 +439,7 @@ func reflect_verifyNotInHeapPtr(p uintptr) bool {
// Note that next does not modify h. The caller must record the result.
//
// nosplit because it is used during write barriers and must not be preempted.
+//
//go:nosplit
func (h heapBits) next() heapBits {
if h.shift < 3*heapBitsShift {
@@ -477,6 +486,7 @@ func (h heapBits) nextArena() heapBits {
// h.forward(1) is equivalent to h.next(), just slower.
// Note that forward does not modify h. The caller must record the result.
// bits returns the heap bits for the current word.
+//
//go:nosplit
func (h heapBits) forward(n uintptr) heapBits {
n += uintptr(h.shift) / heapBitsShift
@@ -517,6 +527,7 @@ func (h heapBits) forwardOrBoundary(n uintptr) (heapBits, uintptr) {
// described by the same bitmap byte.
//
// nosplit because it is used during write barriers and must not be preempted.
+//
//go:nosplit
func (h heapBits) bits() uint32 {
// The (shift & 31) eliminates a test and conditional branch
@@ -534,6 +545,7 @@ func (h heapBits) morePointers() bool {
// isPointer reports whether the heap bits describe a pointer word.
//
// nosplit because it is used during write barriers and must not be preempted.
+//
//go:nosplit
func (h heapBits) isPointer() bool {
return h.bits()&bitPointer != 0
@@ -633,6 +645,7 @@ func bulkBarrierPreWrite(dst, src, size uintptr) {
//
// This is used for special cases where e.g. dst was just
// created and zeroed with malloc.
+//
//go:nosplit
func bulkBarrierPreWriteSrcOnly(dst, src, size uintptr) {
if (dst|src|size)&(goarch.PtrSize-1) != 0 {
@@ -1951,6 +1964,7 @@ func getgcmaskcb(frame *stkframe, ctxt unsafe.Pointer) bool {
// gcbits returns the GC type info for x, for testing.
// The result is the bitmap entries (0 or 1), one entry per byte.
+//
//go:linkname reflect_gcbits reflect.gcbits
func reflect_gcbits(x any) []byte {
ret := getgcmask(x)