Source File
mgcstack.go
Belonging Package
runtime
package runtime
import (
)
const stackTraceDebug = false
type stackWorkBuf struct {
stackWorkBufHdr
obj [(_WorkbufSize - unsafe.Sizeof(stackWorkBufHdr{})) / sys.PtrSize]uintptr
}
type stackWorkBufHdr struct {
workbufhdr
}
type stackObjectBuf struct {
stackObjectBufHdr
obj [(_WorkbufSize - unsafe.Sizeof(stackObjectBufHdr{})) / unsafe.Sizeof(stackObject{})]stackObject
}
type stackObjectBufHdr struct {
workbufhdr
next *stackObjectBuf
}
func () {
if unsafe.Sizeof(stackWorkBuf{}) > unsafe.Sizeof(workbuf{}) {
panic("stackWorkBuf too big")
}
if unsafe.Sizeof(stackObjectBuf{}) > unsafe.Sizeof(workbuf{}) {
panic("stackObjectBuf too big")
}
}
type stackObject struct {
off uint32 // offset above stack.lo
size uint32 // size of object
typ *_type // type info (for ptr/nonptr bits). nil if object has been scanned.
left *stackObject // objects with lower addresses
right *stackObject // objects with higher addresses
}
type stackScanState struct {
cache pcvalueCache
buf *stackWorkBuf
freeBuf *stackWorkBuf // keep around one free buffer for allocation hysteresis
root *stackObject
}
func ( *stackScanState) () ( uintptr, bool) {
for , := range []**stackWorkBuf{&.buf, &.cbuf} {
:= *
continue
}
if .nobj == 0 {
func ( *stackScanState) ( uintptr, *_type) {
:= .tail
.nobjs++
}
func ( *stackScanState) () {
.root, _, _ = binarySearchTree(.head, 0, .nobjs)
}
func ( *stackObjectBuf, int, int) ( *stackObject, *stackObjectBuf, int) {
if == 0 {
return nil, ,
}
var , *stackObject
, , = (, , /2)
= &.obj[]
++
if == len(.obj) {
= .next
= 0
}
, , = (, , -/2-1)
.left =
.right =
return , ,
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |