[dev.typeparams] runtime: remove tracebackdefers

tracebackdefers is used for scanning/copying deferred functions'
arguments. Now that deferred functions are always argumentless,
it does nothing. Remove.

Change-Id: I55bedabe5584ea41a12cdb03d55ec9692a5aacd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/325916
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Cherry Mui 2021-06-04 17:18:09 -04:00
parent 12b37b713f
commit 00d01b5786
3 changed files with 2 additions and 42 deletions

View file

@ -750,14 +750,11 @@ func scanstack(gp *g, gcw *gcWork) {
// Find additional pointers that point into the stack from the heap. // Find additional pointers that point into the stack from the heap.
// Currently this includes defers and panics. See also function copystack. // Currently this includes defers and panics. See also function copystack.
// Find and trace all defer arguments.
tracebackdefers(gp, scanframe, nil)
// Find and trace other pointers in defer records. // Find and trace other pointers in defer records.
for d := gp._defer; d != nil; d = d.link { for d := gp._defer; d != nil; d = d.link {
if d.fn != nil { if d.fn != nil {
// tracebackdefers above does not scan the func value, which could // Scan the func value, which could be a stack allocated closure.
// be a stack allocated closure. See issue 30453. // See issue 30453.
scanblock(uintptr(unsafe.Pointer(&d.fn)), sys.PtrSize, &oneptrmask[0], gcw, &state) scanblock(uintptr(unsafe.Pointer(&d.fn)), sys.PtrSize, &oneptrmask[0], gcw, &state)
} }
if d.link != nil { if d.link != nil {

View file

@ -753,11 +753,6 @@ func adjustdefers(gp *g, adjinfo *adjustinfo) {
adjustpointer(adjinfo, unsafe.Pointer(&d.varp)) adjustpointer(adjinfo, unsafe.Pointer(&d.varp))
adjustpointer(adjinfo, unsafe.Pointer(&d.fd)) adjustpointer(adjinfo, unsafe.Pointer(&d.fd))
} }
// Adjust defer argument blocks the same way we adjust active stack frames.
// Note: this code is after the loop above, so that if a defer record is
// stack allocated, we work on the copy in the new stack.
tracebackdefers(gp, adjustframe, noescape(unsafe.Pointer(adjinfo)))
} }
func adjustpanics(gp *g, adjinfo *adjustinfo) { func adjustpanics(gp *g, adjinfo *adjustinfo) {

View file

@ -21,38 +21,6 @@ import (
const usesLR = sys.MinFrameSize > 0 const usesLR = sys.MinFrameSize > 0
// Traceback over the deferred function calls.
// Report them like calls that have been invoked but not started executing yet.
func tracebackdefers(gp *g, callback func(*stkframe, unsafe.Pointer) bool, v unsafe.Pointer) {
var frame stkframe
for d := gp._defer; d != nil; d = d.link {
fn := d.fn
if fn == nil {
// Defer of nil function. Args don't matter.
frame.pc = 0
frame.fn = funcInfo{}
frame.argp = 0
frame.arglen = 0
frame.argmap = nil
} else {
frame.pc = fn.fn
f := findfunc(frame.pc)
if !f.valid() {
print("runtime: unknown pc in defer ", hex(frame.pc), "\n")
throw("unknown pc")
}
frame.fn = f
frame.argp = 0
frame.arglen = 0
frame.argmap = nil
}
frame.continpc = frame.pc
if !callback((*stkframe)(noescape(unsafe.Pointer(&frame))), v) {
return
}
}
}
const sizeofSkipFunction = 256 const sizeofSkipFunction = 256
// Generic traceback. Handles runtime stack prints (pcbuf == nil), // Generic traceback. Handles runtime stack prints (pcbuf == nil),