aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcwork.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/mgcwork.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/mgcwork.go')
-rw-r--r--src/runtime/mgcwork.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/mgcwork.go b/src/runtime/mgcwork.go
index 56d0b1cd62..5c47006cc2 100644
--- a/src/runtime/mgcwork.go
+++ b/src/runtime/mgcwork.go
@@ -107,6 +107,7 @@ func (w *gcWork) init() {
// put enqueues a pointer for the garbage collector to trace.
// obj must point to the beginning of a heap object or an oblet.
+//
//go:nowritebarrierrec
func (w *gcWork) put(obj uintptr) {
flushed := false
@@ -145,6 +146,7 @@ func (w *gcWork) put(obj uintptr) {
// putFast does a put and reports whether it can be done quickly
// otherwise it returns false and the caller needs to call put.
+//
//go:nowritebarrierrec
func (w *gcWork) putFast(obj uintptr) bool {
wbuf := w.wbuf1
@@ -196,6 +198,7 @@ func (w *gcWork) putBatch(obj []uintptr) {
// If there are no pointers remaining in this gcWork or in the global
// queue, tryGet returns 0. Note that there may still be pointers in
// other gcWork instances or other caches.
+//
//go:nowritebarrierrec
func (w *gcWork) tryGet() uintptr {
wbuf := w.wbuf1
@@ -225,6 +228,7 @@ func (w *gcWork) tryGet() uintptr {
// tryGetFast dequeues a pointer for the garbage collector to trace
// if one is readily available. Otherwise it returns 0 and
// the caller is expected to call tryGet().
+//
//go:nowritebarrierrec
func (w *gcWork) tryGetFast() uintptr {
wbuf := w.wbuf1
@@ -278,6 +282,7 @@ func (w *gcWork) dispose() {
// balance moves some work that's cached in this gcWork back on the
// global queue.
+//
//go:nowritebarrierrec
func (w *gcWork) balance() {
if w.wbuf1 == nil {
@@ -300,6 +305,7 @@ func (w *gcWork) balance() {
}
// empty reports whether w has no mark work available.
+//
//go:nowritebarrierrec
func (w *gcWork) empty() bool {
return w.wbuf1 == nil || (w.wbuf1.nobj == 0 && w.wbuf2.nobj == 0)
@@ -340,6 +346,7 @@ func (b *workbuf) checkempty() {
// getempty pops an empty work buffer off the work.empty list,
// allocating new buffers if none are available.
+//
//go:nowritebarrier
func getempty() *workbuf {
var b *workbuf
@@ -395,6 +402,7 @@ func getempty() *workbuf {
// putempty puts a workbuf onto the work.empty list.
// Upon entry this goroutine owns b. The lfstack.push relinquishes ownership.
+//
//go:nowritebarrier
func putempty(b *workbuf) {
b.checkempty()
@@ -404,6 +412,7 @@ func putempty(b *workbuf) {
// putfull puts the workbuf on the work.full list for the GC.
// putfull accepts partially full buffers so the GC can avoid competing
// with the mutators for ownership of partially full buffers.
+//
//go:nowritebarrier
func putfull(b *workbuf) {
b.checknonempty()
@@ -412,6 +421,7 @@ func putfull(b *workbuf) {
// trygetfull tries to get a full or partially empty workbuffer.
// If one is not immediately available return nil
+//
//go:nowritebarrier
func trygetfull() *workbuf {
b := (*workbuf)(work.full.pop())