mirror of
https://github.com/golang/go
synced 2024-11-18 15:54:42 -07:00
runtime: run getgcmask on the M stack.
LGTM=rsc R=rsc, khr CC=golang-codereviews https://golang.org/cl/132660043
This commit is contained in:
parent
277ef8fa07
commit
005806cab1
@ -111,8 +111,19 @@ func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) {
|
||||
return begin, end
|
||||
}
|
||||
|
||||
// in mgc0.c
|
||||
//go:noescape
|
||||
func GCMask(x interface{}) []byte
|
||||
func getgcmask(data unsafe.Pointer, typ *_type, array **byte, len *uint)
|
||||
|
||||
func GCMask(x interface{}) (ret []byte) {
|
||||
e := (*eface)(unsafe.Pointer(&x))
|
||||
s := (*slice)(unsafe.Pointer(&ret))
|
||||
onM(func() {
|
||||
getgcmask(e.data, e._type, &s.array, &s.len)
|
||||
s.cap = s.len
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func testSchedLocalQueue()
|
||||
func testSchedLocalQueueSteal()
|
||||
|
@ -1805,7 +1805,7 @@ getgcmaskcb(Stkframe *frame, void *ctxt)
|
||||
Stkframe *frame0;
|
||||
|
||||
frame0 = ctxt;
|
||||
if(frame0->sp >= frame->varp - frame->sp && frame0->sp < frame->varp) {
|
||||
if(frame->sp <= frame0->sp && frame0->sp < frame->varp) {
|
||||
*frame0 = *frame;
|
||||
return false;
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ runtime·getgcmask(byte *p, Type *t, byte **mask, uintptr *len)
|
||||
frame.fn = nil;
|
||||
frame.sp = (uintptr)p;
|
||||
cb = getgcmaskcb;
|
||||
runtime·gentraceback((uintptr)runtime·getcallerpc(&p), (uintptr)runtime·getcallersp(&p), 0, g, 0, nil, 1000, &cb, &frame, false);
|
||||
runtime·gentraceback(g->m->curg->sched.pc, g->m->curg->sched.sp, 0, g->m->curg, 0, nil, 1000, &cb, &frame, false);
|
||||
if(frame.fn != nil) {
|
||||
Func *f;
|
||||
StackMap *stackmap;
|
||||
|
@ -54,13 +54,6 @@ func runtime·gomcache() (ret *MCache) {
|
||||
ret = g->m->mcache;
|
||||
}
|
||||
|
||||
// For testing.
|
||||
// TODO: find a better place for this.
|
||||
func GCMask(x Eface) (mask Slice) {
|
||||
runtime·getgcmask(x.data, x.type, &mask.array, &mask.len);
|
||||
mask.cap = mask.len;
|
||||
}
|
||||
|
||||
#pragma textflag NOSPLIT
|
||||
func reflect·typelinks() (ret Slice) {
|
||||
extern Type *runtime·typelink[], *runtime·etypelink[];
|
||||
|
Loading…
Reference in New Issue
Block a user