aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-12-06 13:54:07 -0500
committerAustin Clements <austin@google.com>2018-12-06 20:13:40 +0000
commitbae1e70ac4a963bfb167136fc6b40988bc9cd546 (patch)
treee72fbc7242950d216bad26bfa5f831c46ea604c3 /src
parent5b48ab8881928e7a23678b93836e32f961a9dddb (diff)
downloadgo-bae1e70ac4a963bfb167136fc6b40988bc9cd546.tar.xz
runtime: print pointers being put in checkPut
In order to further diagnose #27993, I need to see exactly what pointers are being added to the gcWork buffer too late. Change-Id: I8d92113426ffbc6e55d819c39e7ab5eafa68668d Reviewed-on: https://go-review.googlesource.com/c/152957 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/mgcwork.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/runtime/mgcwork.go b/src/runtime/mgcwork.go
index 8a77ff55e4..cdc94b8ffb 100644
--- a/src/runtime/mgcwork.go
+++ b/src/runtime/mgcwork.go
@@ -115,11 +115,19 @@ func (w *gcWork) init() {
w.wbuf2 = wbuf2
}
-func (w *gcWork) checkPut() {
+func (w *gcWork) checkPut(ptr uintptr, ptrs []uintptr) {
if debugCachedWork {
for atomic.Load(&gcWorkPauseGen) == w.pauseGen {
}
if throwOnGCWork {
+ printlock()
+ println("runtime: late gcWork put")
+ if ptr != 0 {
+ gcDumpObject("ptr", ptr, ^uintptr(0))
+ }
+ for _, ptr := range ptrs {
+ gcDumpObject("ptrs", ptr, ^uintptr(0))
+ }
throw("throwOnGCWork")
}
}
@@ -129,7 +137,7 @@ func (w *gcWork) checkPut() {
// obj must point to the beginning of a heap object or an oblet.
//go:nowritebarrierrec
func (w *gcWork) put(obj uintptr) {
- w.checkPut()
+ w.checkPut(obj, nil)
flushed := false
wbuf := w.wbuf1
@@ -165,7 +173,7 @@ func (w *gcWork) put(obj uintptr) {
// otherwise it returns false and the caller needs to call put.
//go:nowritebarrierrec
func (w *gcWork) putFast(obj uintptr) bool {
- w.checkPut()
+ w.checkPut(obj, nil)
wbuf := w.wbuf1
if wbuf == nil {
@@ -188,7 +196,7 @@ func (w *gcWork) putBatch(obj []uintptr) {
return
}
- w.checkPut()
+ w.checkPut(0, obj)
flushed := false
wbuf := w.wbuf1
@@ -311,12 +319,12 @@ func (w *gcWork) balance() {
return
}
if wbuf := w.wbuf2; wbuf.nobj != 0 {
- w.checkPut()
+ w.checkPut(0, wbuf.obj[:wbuf.nobj])
putfull(wbuf)
w.flushedWork = true
w.wbuf2 = getempty()
} else if wbuf := w.wbuf1; wbuf.nobj > 4 {
- w.checkPut()
+ w.checkPut(0, wbuf.obj[:wbuf.nobj])
w.wbuf1 = handoff(wbuf)
w.flushedWork = true // handoff did putfull
} else {