mirror of
https://github.com/golang/go
synced 2024-11-23 00:20:12 -07:00
runtime: allow copying of onM frame
Currently goroutines in onM can't be copied/shrunk (including the very goroutine that triggers GC). Special case onM to allow copying. LGTM=daniel.morsing, khr R=golang-codereviews, daniel.morsing, khr, rsc CC=golang-codereviews, rlh https://golang.org/cl/124550043
This commit is contained in:
parent
266d350f5e
commit
9198ed4bd6
@ -399,6 +399,7 @@ struct CopyableInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void runtime·main(void);
|
void runtime·main(void);
|
||||||
|
void runtime·switchtoM(void(*)(void));
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
checkframecopy(Stkframe *frame, void *arg)
|
checkframecopy(Stkframe *frame, void *arg)
|
||||||
@ -424,6 +425,13 @@ checkframecopy(Stkframe *frame, void *arg)
|
|||||||
cinfo->frames++;
|
cinfo->frames++;
|
||||||
return false; // stop traceback
|
return false; // stop traceback
|
||||||
}
|
}
|
||||||
|
if(f->entry == (uintptr)runtime·switchtoM) {
|
||||||
|
// A special routine at the bottom of stack of a goroutine that does onM call.
|
||||||
|
// We will allow it to be copied even though we don't
|
||||||
|
// have full GC info for it (because it is written in asm).
|
||||||
|
cinfo->frames++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if(frame->varp != (byte*)frame->sp) { // not in prologue (and has at least one local or outarg)
|
if(frame->varp != (byte*)frame->sp) { // not in prologue (and has at least one local or outarg)
|
||||||
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
|
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
|
||||||
if(stackmap == nil) {
|
if(stackmap == nil) {
|
||||||
@ -648,7 +656,8 @@ adjustframe(Stkframe *frame, void *arg)
|
|||||||
f = frame->fn;
|
f = frame->fn;
|
||||||
if(StackDebug >= 2)
|
if(StackDebug >= 2)
|
||||||
runtime·printf(" adjusting %s frame=[%p,%p] pc=%p continpc=%p\n", runtime·funcname(f), frame->sp, frame->fp, frame->pc, frame->continpc);
|
runtime·printf(" adjusting %s frame=[%p,%p] pc=%p continpc=%p\n", runtime·funcname(f), frame->sp, frame->fp, frame->pc, frame->continpc);
|
||||||
if(f->entry == (uintptr)runtime·main)
|
if(f->entry == (uintptr)runtime·main ||
|
||||||
|
f->entry == (uintptr)runtime·switchtoM)
|
||||||
return true;
|
return true;
|
||||||
targetpc = frame->continpc;
|
targetpc = frame->continpc;
|
||||||
if(targetpc == 0) {
|
if(targetpc == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user