diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-12-05 23:09:51 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-12-05 23:09:51 +0000 |
commit | c43137e800bb9ca2ecda0a6b6189e0eb5c22f0d7 (patch) | |
tree | df5d750d82dff84b98ec03163cc8c2b2552a559a /libgo/go/runtime/runtime2.go | |
parent | e4a9a572770b48375561c7ca424eb94eb45a9fcb (diff) | |
download | gcc-c43137e800bb9ca2ecda0a6b6189e0eb5c22f0d7.zip gcc-c43137e800bb9ca2ecda0a6b6189e0eb5c22f0d7.tar.gz gcc-c43137e800bb9ca2ecda0a6b6189e0eb5c22f0d7.tar.bz2 |
runtime: add precise stack scan support
This CL adds support of precise stack scan using stack maps to
the runtime. The stack maps are generated by the compiler (if
supported). Each safepoint is associated with a (real or dummy)
landing pad, and its "type info" in the exception table is a
pointer to the stack map. When a stack is scanned, the stack map
is found by the stack unwinding code by inspecting the exception
table (LSDA).
For precise stack scan we need to unwind the stack. There are
three cases:
- If a goroutine is scanning its own stack, it can unwind the
stack and scan the frames.
- If a goroutine is scanning another, stopped, goroutine, it
cannot directly unwind the target stack. We handle this by
switching (runtime.gogo) to the target g, letting it unwind
and scan the stack, and switch back.
- If we are scanning a goroutine that is blocked in a syscall,
we send a signal to the target goroutine's thread, and let the
signal handler unwind and scan the stack. Extra care is needed
as this races with enter/exit syscall.
Currently this is only implemented on linux.
Reviewed-on: https://go-review.googlesource.com/c/140518
From-SVN: r266832
Diffstat (limited to 'libgo/go/runtime/runtime2.go')
-rw-r--r-- | libgo/go/runtime/runtime2.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index e12e832..6eb9491 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -430,6 +430,9 @@ type g struct { scanningself bool // whether goroutine is scanning its own stack + scang uintptr // the g that wants to scan this g's stack (uintptr to avoid write barrier) + scangcw uintptr // gc worker for scanning stack (uintptr to avoid write barrier) + isSystemGoroutine bool // whether goroutine is a "system" goroutine traceback uintptr // stack traceback buffer @@ -514,6 +517,8 @@ type m struct { exiting bool // thread is exiting gcing int32 + + scannote note // synchonization for signal-based stack scanning } type p struct { |