runtime: use "mp" and "gp" instead of "m" and "g" for local variable name to avoid confusion with the global "m" and "g".
R=golang-dev, minux.ma, rsc
CC=bradfitz, golang-dev
https://golang.org/cl/6939064
diff --git a/src/pkg/runtime/cgocall.c b/src/pkg/runtime/cgocall.c
index 7a20379..2427883 100644
--- a/src/pkg/runtime/cgocall.c
+++ b/src/pkg/runtime/cgocall.c
@@ -42,7 +42,7 @@
// know about packages). The gcc-compiled C function f calls GoF.
//
// GoF calls crosscall2(_cgoexp_GoF, frame, framesize). Crosscall2
-// (in cgo/$GOOS.S, a gcc-compiled assembly file) is a two-argument
+// (in cgo/gcc_$GOARCH.S, a gcc-compiled assembly file) is a two-argument
// adapter from the gcc function call ABI to the 6c function call ABI.
// It is called from gcc to call 6c functions. In this case it calls
// _cgoexp_GoF(frame, framesize), still running on m->g0's stack
@@ -181,11 +181,11 @@
void
runtime·NumCgoCall(int64 ret)
{
- M *m;
+ M *mp;
ret = 0;
- for(m=runtime·atomicloadp(&runtime·allm); m; m=m->alllink)
- ret += m->ncgocall;
+ for(mp=runtime·atomicloadp(&runtime·allm); mp; mp=mp->alllink)
+ ret += mp->ncgocall;
FLUSH(&ret);
}
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index 9353653..f58045e 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -470,7 +470,7 @@
static Lock settype_lock;
void
-runtime·settype_flush(M *m, bool sysalloc)
+runtime·settype_flush(M *mp, bool sysalloc)
{
uintptr *buf, *endbuf;
uintptr size, ofs, j, t;
@@ -482,8 +482,8 @@
uintptr typ, p;
MSpan *s;
- buf = m->settype_buf;
- endbuf = buf + m->settype_bufsize;
+ buf = mp->settype_buf;
+ endbuf = buf + mp->settype_bufsize;
runtime·lock(&settype_lock);
while(buf < endbuf) {
@@ -581,7 +581,7 @@
}
runtime·unlock(&settype_lock);
- m->settype_bufsize = 0;
+ mp->settype_bufsize = 0;
}
// It is forbidden to use this function if it is possible that
@@ -589,7 +589,7 @@
void
runtime·settype(void *v, uintptr t)
{
- M *m1;
+ M *mp;
uintptr *buf;
uintptr i;
MSpan *s;
@@ -597,16 +597,16 @@
if(t == 0)
runtime·throw("settype: zero type");
- m1 = m;
- buf = m1->settype_buf;
- i = m1->settype_bufsize;
+ mp = m;
+ buf = mp->settype_buf;
+ i = mp->settype_bufsize;
buf[i+0] = (uintptr)v;
buf[i+1] = t;
i += 2;
- m1->settype_bufsize = i;
+ mp->settype_bufsize = i;
- if(i == nelem(m1->settype_buf)) {
- runtime·settype_flush(m1, false);
+ if(i == nelem(mp->settype_buf)) {
+ runtime·settype_flush(mp, false);
}
if(DebugTypeAtBlockEnd) {
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index a606841..482190e 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -1160,16 +1160,16 @@
static void
stealcache(void)
{
- M *m;
+ M *mp;
- for(m=runtime·allm; m; m=m->alllink)
- runtime·MCache_ReleaseAll(m->mcache);
+ for(mp=runtime·allm; mp; mp=mp->alllink)
+ runtime·MCache_ReleaseAll(mp->mcache);
}
static void
cachestats(GCStats *stats)
{
- M *m;
+ M *mp;
MCache *c;
int32 i;
uint64 stacks_inuse;
@@ -1180,17 +1180,17 @@
runtime·memclr((byte*)stats, sizeof(*stats));
stacks_inuse = 0;
stacks_sys = 0;
- for(m=runtime·allm; m; m=m->alllink) {
- c = m->mcache;
+ for(mp=runtime·allm; mp; mp=mp->alllink) {
+ c = mp->mcache;
runtime·purgecachedstats(c);
- stacks_inuse += m->stackalloc->inuse;
- stacks_sys += m->stackalloc->sys;
+ stacks_inuse += mp->stackalloc->inuse;
+ stacks_sys += mp->stackalloc->sys;
if(stats) {
- src = (uint64*)&m->gcstats;
+ src = (uint64*)&mp->gcstats;
dst = (uint64*)stats;
for(i=0; i<sizeof(*stats)/sizeof(uint64); i++)
dst[i] += src[i];
- runtime·memclr((byte*)&m->gcstats, sizeof(m->gcstats));
+ runtime·memclr((byte*)&mp->gcstats, sizeof(mp->gcstats));
}
for(i=0; i<nelem(c->local_by_size); i++) {
mstats.by_size[i].nmalloc += c->local_by_size[i].nmalloc;
@@ -1270,7 +1270,7 @@
int64 t0, t1, t2, t3;
uint64 heap0, heap1, obj0, obj1;
GCStats stats;
- M *m1;
+ M *mp;
uint32 i;
runtime·semacquire(&runtime·worldsema);
@@ -1284,8 +1284,8 @@
m->gcing = 1;
runtime·stoptheworld();
- for(m1=runtime·allm; m1; m1=m1->alllink)
- runtime·settype_flush(m1, false);
+ for(mp=runtime·allm; mp; mp=mp->alllink)
+ runtime·settype_flush(mp, false);
heap0 = 0;
obj0 = 0;
diff --git a/src/pkg/runtime/mprof.goc b/src/pkg/runtime/mprof.goc
index 893ff30..7a245b5 100644
--- a/src/pkg/runtime/mprof.goc
+++ b/src/pkg/runtime/mprof.goc
@@ -394,18 +394,18 @@
func ThreadCreateProfile(p Slice) (n int, ok bool) {
TRecord *r;
- M *first, *m;
+ M *first, *mp;
first = runtime·atomicloadp(&runtime·allm);
n = 0;
- for(m=first; m; m=m->alllink)
+ for(mp=first; mp; mp=mp->alllink)
n++;
ok = false;
if(n <= p.len) {
ok = true;
r = (TRecord*)p.array;
- for(m=first; m; m=m->alllink) {
- runtime·memmove(r->stk, m->createstack, sizeof r->stk);
+ for(mp=first; mp; mp=mp->alllink) {
+ runtime·memmove(r->stk, mp->createstack, sizeof r->stk);
r++;
}
}
@@ -445,11 +445,11 @@
}
static void
-saveg(byte *pc, byte *sp, G *g, TRecord *r)
+saveg(byte *pc, byte *sp, G *gp, TRecord *r)
{
int32 n;
- n = runtime·gentraceback(pc, sp, 0, g, 0, r->stk, nelem(r->stk));
+ n = runtime·gentraceback(pc, sp, 0, gp, 0, r->stk, nelem(r->stk));
if(n < nelem(r->stk))
r->stk[n] = 0;
}
diff --git a/src/pkg/runtime/os_plan9.h b/src/pkg/runtime/os_plan9.h
index 7fb8aa6..b1dc815 100644
--- a/src/pkg/runtime/os_plan9.h
+++ b/src/pkg/runtime/os_plan9.h
@@ -12,7 +12,7 @@
void runtime·exits(int8* msg);
intptr runtime·brk_(void*);
int32 runtime·sleep(int32 ms);
-int32 runtime·rfork(int32 flags, void *stk, M *m, G *g, void (*fn)(void));
+int32 runtime·rfork(int32 flags, void *stk, M *mp, G *gp, void (*fn)(void));
int32 runtime·plan9_semacquire(uint32 *addr, int32 block);
int32 runtime·plan9_tsemacquire(uint32 *addr, int32 ms);
int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 7dfd3c7..80e9779 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -264,13 +264,13 @@
static void
schedunlock(void)
{
- M *m;
+ M *mp;
- m = mwakeup;
+ mp = mwakeup;
mwakeup = nil;
runtime·unlock(&runtime·sched);
- if(m != nil)
- runtime·notewakeup(&m->havenextg);
+ if(mp != nil)
+ runtime·notewakeup(&mp->havenextg);
}
void
@@ -1099,13 +1099,13 @@
uint32 argsize;
uintptr cret;
byte *sp;
- G *g1;
+ G *gp;
int64 goid;
//printf("oldstack m->cret=%p\n", m->cret);
- g1 = m->curg;
- top = (Stktop*)g1->stackbase;
+ gp = m->curg;
+ top = (Stktop*)gp->stackbase;
sp = (byte*)top;
old = *top;
argsize = old.argsize;
@@ -1117,9 +1117,9 @@
USED(goid);
if(old.free != 0)
- runtime·stackfree((byte*)g1->stackguard - StackGuard, old.free);
- g1->stackbase = (uintptr)old.stackbase;
- g1->stackguard = (uintptr)old.stackguard;
+ runtime·stackfree((byte*)gp->stackguard - StackGuard, old.free);
+ gp->stackbase = (uintptr)old.stackbase;
+ gp->stackguard = (uintptr)old.stackguard;
cret = m->cret;
m->cret = 0; // drop reference
@@ -1137,7 +1137,7 @@
int32 framesize, minalloc, argsize;
Stktop *top;
byte *stk, *sp;
- G *g1;
+ G *gp;
Gobuf label;
bool reflectcall;
uintptr free;
@@ -1145,12 +1145,12 @@
framesize = m->moreframesize;
minalloc = m->moreframesize_minalloc;
argsize = m->moreargsize;
- g1 = m->curg;
+ gp = m->curg;
m->moreframesize_minalloc = 0;
- if(m->morebuf.sp < g1->stackguard - StackGuard) {
- runtime·printf("runtime: split stack overflow: %p < %p\n", m->morebuf.sp, g1->stackguard - StackGuard);
+ if(m->morebuf.sp < gp->stackguard - StackGuard) {
+ runtime·printf("runtime: split stack overflow: %p < %p\n", m->morebuf.sp, gp->stackguard - StackGuard);
runtime·throw("runtime: split stack overflow");
}
if(argsize % sizeof(uintptr) != 0) {
@@ -1165,14 +1165,14 @@
if(framesize < minalloc)
framesize = minalloc;
- if(reflectcall && minalloc == 0 && m->morebuf.sp - sizeof(Stktop) - argsize - 32 > g1->stackguard) {
+ if(reflectcall && minalloc == 0 && m->morebuf.sp - sizeof(Stktop) - argsize - 32 > gp->stackguard) {
// special case: called from reflect.call (framesize==1)
// to call code with an arbitrary argument size,
// and we have enough space on the current stack.
// the new Stktop* is necessary to unwind, but
// we don't need to create a new segment.
top = (Stktop*)(m->morebuf.sp - sizeof(*top));
- stk = (byte*)g1->stackguard - StackGuard;
+ stk = (byte*)gp->stackguard - StackGuard;
free = 0;
} else {
// allocate new segment.
@@ -1188,11 +1188,11 @@
if(0) {
runtime·printf("newstack framesize=%d argsize=%d morepc=%p moreargp=%p gobuf=%p, %p top=%p old=%p\n",
- framesize, argsize, m->morepc, m->moreargp, m->morebuf.pc, m->morebuf.sp, top, g1->stackbase);
+ framesize, argsize, m->morepc, m->moreargp, m->morebuf.pc, m->morebuf.sp, top, gp->stackbase);
}
- top->stackbase = (byte*)g1->stackbase;
- top->stackguard = (byte*)g1->stackguard;
+ top->stackbase = (byte*)gp->stackbase;
+ top->stackguard = (byte*)gp->stackguard;
top->gobuf = m->morebuf;
top->argp = m->moreargp;
top->argsize = argsize;
@@ -1202,11 +1202,11 @@
m->morebuf.sp = (uintptr)nil;
// copy flag from panic
- top->panic = g1->ispanic;
- g1->ispanic = false;
+ top->panic = gp->ispanic;
+ gp->ispanic = false;
- g1->stackbase = (uintptr)top;
- g1->stackguard = (uintptr)stk + StackGuard;
+ gp->stackbase = (uintptr)top;
+ gp->stackguard = (uintptr)stk + StackGuard;
sp = (byte*)top;
if(argsize > 0) {
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index e6a78ba..6c9d50e 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -620,7 +620,7 @@
void runtime·ready(G*);
byte* runtime·getenv(int8*);
int32 runtime·atoi(byte*);
-void runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void));
+void runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void));
void runtime·signalstack(byte*, int32);
G* runtime·malg(int32);
void runtime·asminit(void);
diff --git a/src/pkg/runtime/signal_netbsd_386.c b/src/pkg/runtime/signal_netbsd_386.c
index fcb92f3..756abe3 100644
--- a/src/pkg/runtime/signal_netbsd_386.c
+++ b/src/pkg/runtime/signal_netbsd_386.c
@@ -139,11 +139,11 @@
}
void
-runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *m, G *g, void (*fn)(void))
+runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *mp, G *gp, void (*fn)(void))
{
mc->__gregs[REG_EIP] = (uint32)runtime·lwp_tramp;
mc->__gregs[REG_UESP] = (uint32)stack;
- mc->__gregs[REG_EBX] = (uint32)m;
- mc->__gregs[REG_EDX] = (uint32)g;
+ mc->__gregs[REG_EBX] = (uint32)mp;
+ mc->__gregs[REG_EDX] = (uint32)gp;
mc->__gregs[REG_ESI] = (uint32)fn;
}
diff --git a/src/pkg/runtime/signal_netbsd_amd64.c b/src/pkg/runtime/signal_netbsd_amd64.c
index 1971106..556a7be 100644
--- a/src/pkg/runtime/signal_netbsd_amd64.c
+++ b/src/pkg/runtime/signal_netbsd_amd64.c
@@ -146,12 +146,12 @@
}
void
-runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *m, G *g, void (*fn)(void))
+runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *mp, G *gp, void (*fn)(void))
{
// Machine dependent mcontext initialisation for LWP.
mc->__gregs[REG_RIP] = (uint64)runtime·lwp_tramp;
mc->__gregs[REG_RSP] = (uint64)stack;
- mc->__gregs[REG_R8] = (uint64)m;
- mc->__gregs[REG_R9] = (uint64)g;
+ mc->__gregs[REG_R8] = (uint64)mp;
+ mc->__gregs[REG_R9] = (uint64)gp;
mc->__gregs[REG_R12] = (uint64)fn;
}
diff --git a/src/pkg/runtime/sys_darwin_386.s b/src/pkg/runtime/sys_darwin_386.s
index c165209..bdbe073 100644
--- a/src/pkg/runtime/sys_darwin_386.s
+++ b/src/pkg/runtime/sys_darwin_386.s
@@ -292,7 +292,7 @@
INT $0x80
RET
-// void bsdthread_create(void *stk, M *m, G *g, void (*fn)(void))
+// void bsdthread_create(void *stk, M *mp, G *gp, void (*fn)(void))
// System call args are: func arg stack pthread flags.
TEXT runtime·bsdthread_create(SB),7,$32
MOVL $360, AX
diff --git a/src/pkg/runtime/sys_darwin_amd64.s b/src/pkg/runtime/sys_darwin_amd64.s
index 69207c8..c91501a 100644
--- a/src/pkg/runtime/sys_darwin_amd64.s
+++ b/src/pkg/runtime/sys_darwin_amd64.s
@@ -254,7 +254,7 @@
SYSCALL
RET
-// void bsdthread_create(void *stk, M *m, G *g, void (*fn)(void))
+// void bsdthread_create(void *stk, M *mp, G *gp, void (*fn)(void))
TEXT runtime·bsdthread_create(SB),7,$0
// Set up arguments to bsdthread_create system call.
// The ones in quotes pass through to the thread callback
diff --git a/src/pkg/runtime/sys_linux_386.s b/src/pkg/runtime/sys_linux_386.s
index b212f80..60f76fa 100644
--- a/src/pkg/runtime/sys_linux_386.s
+++ b/src/pkg/runtime/sys_linux_386.s
@@ -259,7 +259,7 @@
CALL *runtime·_vdso(SB)
RET
-// int32 clone(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
+// int32 clone(int32 flags, void *stack, M *mp, G *gp, void (*fn)(void));
TEXT runtime·clone(SB),7,$0
MOVL $120, AX // clone
MOVL flags+4(SP), BX
@@ -267,7 +267,7 @@
MOVL $0, DX // parent tid ptr
MOVL $0, DI // child tid ptr
- // Copy m, g, fn off parent stack for use by child.
+ // Copy mp, gp, fn off parent stack for use by child.
SUBL $16, CX
MOVL mm+12(SP), SI
MOVL SI, 0(CX)
diff --git a/src/pkg/runtime/sys_linux_amd64.s b/src/pkg/runtime/sys_linux_amd64.s
index e807815..3f7a207 100644
--- a/src/pkg/runtime/sys_linux_amd64.s
+++ b/src/pkg/runtime/sys_linux_amd64.s
@@ -268,12 +268,12 @@
SYSCALL
RET
-// int64 clone(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
+// int64 clone(int32 flags, void *stack, M *mp, G *gp, void (*fn)(void));
TEXT runtime·clone(SB),7,$0
MOVL flags+8(SP), DI
MOVQ stack+16(SP), SI
- // Copy m, g, fn off parent stack for use by child.
+ // Copy mp, gp, fn off parent stack for use by child.
// Careful: Linux system call clobbers CX and R11.
MOVQ mm+24(SP), R8
MOVQ gg+32(SP), R9
diff --git a/src/pkg/runtime/sys_linux_arm.s b/src/pkg/runtime/sys_linux_arm.s
index ec5b0ca..eda7b1f 100644
--- a/src/pkg/runtime/sys_linux_arm.s
+++ b/src/pkg/runtime/sys_linux_arm.s
@@ -206,7 +206,7 @@
RET
-// int32 clone(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
+// int32 clone(int32 flags, void *stack, M *mp, G *gp, void (*fn)(void));
TEXT runtime·clone(SB),7,$0
MOVW flags+0(FP), R0
MOVW stack+4(FP), R1
@@ -215,7 +215,7 @@
MOVW $0, R4 // child tid ptr
MOVW $0, R5
- // Copy m, g, fn off parent stack for use by child.
+ // Copy mp, gp, fn off parent stack for use by child.
// TODO(kaib): figure out which registers are clobbered by clone and avoid stack copying
MOVW $-16(R1), R1
MOVW mm+8(FP), R6
diff --git a/src/pkg/runtime/sys_openbsd_386.s b/src/pkg/runtime/sys_openbsd_386.s
index f792155..c62e0f9 100644
--- a/src/pkg/runtime/sys_openbsd_386.s
+++ b/src/pkg/runtime/sys_openbsd_386.s
@@ -195,10 +195,10 @@
MOVL $0xf1, 0xf1 // crash
RET
-// int32 tfork(void *param, uintptr psize, M *m, G *g, void (*fn)(void));
+// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
TEXT runtime·tfork(SB),7,$12
- // Copy m, g and fn from the parent stack onto the child stack.
+ // Copy mp, gp and fn from the parent stack onto the child stack.
MOVL params+4(FP), AX
MOVL 8(AX), CX // tf_stack
SUBL $16, CX
diff --git a/src/pkg/runtime/sys_openbsd_amd64.s b/src/pkg/runtime/sys_openbsd_amd64.s
index e569bec..49eb7a9 100644
--- a/src/pkg/runtime/sys_openbsd_amd64.s
+++ b/src/pkg/runtime/sys_openbsd_amd64.s
@@ -8,10 +8,10 @@
#include "zasm_GOOS_GOARCH.h"
-// int64 tfork(void *param, uintptr psize, M *m, G *g, void (*fn)(void));
+// int64 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
TEXT runtime·tfork(SB),7,$32
- // Copy m, g and fn off parent stack for use by child.
+ // Copy mp, gp and fn off parent stack for use by child.
MOVQ mm+16(FP), R8
MOVQ gg+24(FP), R9
MOVQ fn+32(FP), R12
diff --git a/src/pkg/runtime/thread_darwin.c b/src/pkg/runtime/thread_darwin.c
index aff2b6f..ab32575 100644
--- a/src/pkg/runtime/thread_darwin.c
+++ b/src/pkg/runtime/thread_darwin.c
@@ -87,19 +87,19 @@
}
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
int32 errno;
Sigset oset;
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
if(0){
runtime·printf("newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, mp->id, mp->tls[0], &mp);
}
runtime·sigprocmask(SIG_SETMASK, &sigset_all, &oset);
- errno = runtime·bsdthread_create(stk, m, g, fn);
+ errno = runtime·bsdthread_create(stk, mp, gp, fn);
runtime·sigprocmask(SIG_SETMASK, &oset, nil);
if(errno < 0) {
diff --git a/src/pkg/runtime/thread_freebsd.c b/src/pkg/runtime/thread_freebsd.c
index 884bbf4..54c2621 100644
--- a/src/pkg/runtime/thread_freebsd.c
+++ b/src/pkg/runtime/thread_freebsd.c
@@ -77,32 +77,32 @@
void runtime·thr_start(void*);
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
ThrParam param;
Sigset oset;
USED(fn); // thr_start assumes fn == mstart
- USED(g); // thr_start assumes g == m->g0
+ USED(gp); // thr_start assumes gp == mp->g0
if(0){
runtime·printf("newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, mp->id, mp->tls[0], &mp);
}
runtime·sigprocmask(&sigset_all, &oset);
runtime·memclr((byte*)¶m, sizeof param);
param.start_func = runtime·thr_start;
- param.arg = (byte*)m;
- param.stack_base = (void*)g->stackbase;
- param.stack_size = (byte*)stk - (byte*)g->stackbase;
- param.child_tid = (intptr*)&m->procid;
+ param.arg = (byte*)mp;
+ param.stack_base = (void*)gp->stackbase;
+ param.stack_size = (byte*)stk - (byte*)gp->stackbase;
+ param.child_tid = (intptr*)&mp->procid;
param.parent_tid = nil;
- param.tls_base = (void*)&m->tls[0];
- param.tls_size = sizeof m->tls;
+ param.tls_base = (void*)&mp->tls[0];
+ param.tls_size = sizeof mp->tls;
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
runtime·thr_new(¶m, sizeof param);
runtime·sigprocmask(&oset, nil);
diff --git a/src/pkg/runtime/thread_linux.c b/src/pkg/runtime/thread_linux.c
index c428ba1..dc8cad5 100644
--- a/src/pkg/runtime/thread_linux.c
+++ b/src/pkg/runtime/thread_linux.c
@@ -124,7 +124,7 @@
};
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
int32 ret;
int32 flags;
@@ -140,16 +140,16 @@
| CLONE_THREAD /* revisit - okay for now */
;
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
if(0){
runtime·printf("newosproc stk=%p m=%p g=%p fn=%p clone=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, runtime·clone, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, runtime·clone, mp->id, mp->tls[0], &mp);
}
// Disable signals during clone, so that the new thread starts
// with signals disabled. It will enable them in minit.
runtime·rtsigprocmask(SIG_SETMASK, &sigset_all, &oset, sizeof oset);
- ret = runtime·clone(flags, stk, m, g, fn);
+ ret = runtime·clone(flags, stk, mp, gp, fn);
runtime·rtsigprocmask(SIG_SETMASK, &oset, nil, sizeof oset);
if(ret < 0) {
diff --git a/src/pkg/runtime/thread_netbsd.c b/src/pkg/runtime/thread_netbsd.c
index a703e07..195dcfd 100644
--- a/src/pkg/runtime/thread_netbsd.c
+++ b/src/pkg/runtime/thread_netbsd.c
@@ -25,7 +25,7 @@
extern void runtime·getcontext(UcontextT *context);
extern int32 runtime·lwp_create(UcontextT *context, uintptr flags, void *lwpid);
-extern void runtime·lwp_mcontext_init(void *mc, void *stack, M *m, G *g, void (*fn)(void));
+extern void runtime·lwp_mcontext_init(void *mc, void *stack, M *mp, G *gp, void (*fn)(void));
extern int32 runtime·lwp_park(Timespec *abstime, int32 unpark, void *hint, void *unparkhint);
extern int32 runtime·lwp_unpark(int32 lwp, void *hint);
extern int32 runtime·lwp_self(void);
@@ -149,7 +149,7 @@
#define _UC_CPU 0x04
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
UcontextT uc;
int32 ret;
@@ -157,10 +157,10 @@
if(0) {
runtime·printf(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, mp->id, mp->tls[0], &mp);
}
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
runtime·getcontext(&uc);
@@ -168,9 +168,9 @@
uc.uc_link = nil;
uc.uc_sigmask = sigset_all;
- runtime·lwp_mcontext_init(&uc.uc_mcontext, stk, m, g, fn);
+ runtime·lwp_mcontext_init(&uc.uc_mcontext, stk, mp, gp, fn);
- ret = runtime·lwp_create(&uc, 0, &m->procid);
+ ret = runtime·lwp_create(&uc, 0, &mp->procid);
if(ret < 0) {
runtime·printf("runtime: failed to create new OS thread (have %d already; errno=%d)\n", runtime·mcount() - 1, -ret);
diff --git a/src/pkg/runtime/thread_openbsd.c b/src/pkg/runtime/thread_openbsd.c
index b696534..57f64cf 100644
--- a/src/pkg/runtime/thread_openbsd.c
+++ b/src/pkg/runtime/thread_openbsd.c
@@ -23,7 +23,7 @@
static Sigset sigset_all = ~(Sigset)0;
static Sigset sigset_none;
-extern int64 runtime·tfork(void *param, uintptr psize, M *m, G *g, void (*fn)(void));
+extern int64 runtime·tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
extern int32 runtime·thrsleep(void *ident, int32 clock_id, void *tsp, void *lock, const int32 *abort);
extern int32 runtime·thrwakeup(void *ident, int32 n);
@@ -123,7 +123,7 @@
}
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
Tfork param;
Sigset oset;
@@ -132,17 +132,17 @@
if(0) {
runtime·printf(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, mp->id, mp->tls[0], &mp);
}
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
- param.tf_tcb = (byte*)&m->tls[0];
- param.tf_tid = (int32*)&m->procid;
+ param.tf_tcb = (byte*)&mp->tls[0];
+ param.tf_tid = (int32*)&mp->procid;
param.tf_stack = stk;
oset = runtime·sigprocmask(SIG_SETMASK, sigset_all);
- ret = runtime·tfork((byte*)¶m, sizeof(param), m, g, fn);
+ ret = runtime·tfork((byte*)¶m, sizeof(param), mp, gp, fn);
runtime·sigprocmask(SIG_SETMASK, oset);
if(ret < 0) {
diff --git a/src/pkg/runtime/thread_plan9.c b/src/pkg/runtime/thread_plan9.c
index 6fd1ba7..b7a7de7 100644
--- a/src/pkg/runtime/thread_plan9.c
+++ b/src/pkg/runtime/thread_plan9.c
@@ -171,13 +171,13 @@
void
goexitsall(void)
{
- M *m;
+ M *mp;
int32 pid;
pid = getpid();
- for(m=runtime·atomicloadp(&runtime·allm); m; m=m->alllink)
- if(m->procid != pid)
- runtime·postnote(m->procid, "gointr");
+ for(mp=runtime·atomicloadp(&runtime·allm); mp; mp=mp->alllink)
+ if(mp->procid != pid)
+ runtime·postnote(mp->procid, "gointr");
}
void
@@ -254,15 +254,15 @@
}
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
- m->tls[0] = m->id; // so 386 asm can find it
+ mp->tls[0] = mp->id; // so 386 asm can find it
if(0){
runtime·printf("newosproc stk=%p m=%p g=%p fn=%p rfork=%p id=%d/%d ostk=%p\n",
- stk, m, g, fn, runtime·rfork, m->id, m->tls[0], &m);
+ stk, mp, gp, fn, runtime·rfork, mp->id, mp->tls[0], &mp);
}
- if(runtime·rfork(RFPROC|RFMEM|RFNOWAIT, stk, m, g, fn) < 0)
+ if(runtime·rfork(RFPROC|RFMEM|RFNOWAIT, stk, mp, gp, fn) < 0)
runtime·throw("newosproc: rfork failed");
}
diff --git a/src/pkg/runtime/thread_windows.c b/src/pkg/runtime/thread_windows.c
index 5f893c1..600a48a 100644
--- a/src/pkg/runtime/thread_windows.c
+++ b/src/pkg/runtime/thread_windows.c
@@ -186,22 +186,22 @@
#define STACK_SIZE_PARAM_IS_A_RESERVATION ((uintptr)0x00010000)
void
-runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
+runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
{
void *thandle;
USED(stk);
- USED(g); // assuming g = m->g0
+ USED(gp); // assuming gp = mp->g0
USED(fn); // assuming fn = mstart
thandle = runtime·stdcall(runtime·CreateThread, 6,
- nil, (uintptr)0x20000, runtime·tstart_stdcall, m,
+ nil, (uintptr)0x20000, runtime·tstart_stdcall, mp,
STACK_SIZE_PARAM_IS_A_RESERVATION, nil);
if(thandle == nil) {
runtime·printf("runtime: failed to create new OS thread (have %d already; errno=%d)\n", runtime·mcount(), runtime·getlasterror());
runtime·throw("runtime.newosproc");
}
- runtime·atomicstorep(&m->thread, thandle);
+ runtime·atomicstorep(&mp->thread, thandle);
}
// Called to initialize a new m (including the bootstrap m).
diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c
index c92feb6..e67ccd4 100644
--- a/src/pkg/runtime/traceback_arm.c
+++ b/src/pkg/runtime/traceback_arm.c
@@ -17,7 +17,7 @@
void _modu(void);
int32
-runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr *pcbuf, int32 max)
+runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max)
{
int32 i, n, iter;
uintptr pc, lr, tracepc, x;
@@ -33,7 +33,7 @@
// If the PC is goexit, the goroutine hasn't started yet.
if(pc == (uintptr)runtime·goexit) {
- pc = (uintptr)g->entry;
+ pc = (uintptr)gp->entry;
lr = (uintptr)runtime·goexit;
}
@@ -45,7 +45,7 @@
}
n = 0;
- stk = (Stktop*)g->stackbase;
+ stk = (Stktop*)gp->stackbase;
for(iter = 0; iter < 100 && n < max; iter++) { // iter avoids looping forever
// Typically:
// pc is the PC of the running function.
@@ -146,21 +146,21 @@
waspanic = f->entry == (uintptr)runtime·sigpanic;
- if(pcbuf == nil && f->entry == (uintptr)runtime·newstack && g == m->g0) {
+ if(pcbuf == nil && f->entry == (uintptr)runtime·newstack && gp == m->g0) {
runtime·printf("----- newstack called from goroutine %D -----\n", m->curg->goid);
pc = (uintptr)m->morepc;
sp = (byte*)m->moreargp - sizeof(void*);
lr = (uintptr)m->morebuf.pc;
fp = (byte*)m->morebuf.sp;
- g = m->curg;
- stk = (Stktop*)g->stackbase;
+ gp = m->curg;
+ stk = (Stktop*)gp->stackbase;
continue;
}
- if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
+ if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && gp == m->g0) {
runtime·printf("----- lessstack called from goroutine %D -----\n", m->curg->goid);
- g = m->curg;
- stk = (Stktop*)g->stackbase;
+ gp = m->curg;
+ stk = (Stktop*)gp->stackbase;
sp = (byte*)stk->gobuf.sp;
pc = (uintptr)stk->gobuf.pc;
fp = nil;
@@ -184,7 +184,7 @@
sp += 12;
}
- if(pcbuf == nil && (pc = g->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && g->goid != 1) {
+ if(pcbuf == nil && (pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && gp->goid != 1) {
runtime·printf("created by %S\n", f->name);
tracepc = pc; // back up to CALL instruction for funcline.
if(n > 0 && pc > f->entry)
@@ -199,9 +199,9 @@
}
void
-runtime·traceback(byte *pc0, byte *sp, byte *lr, G *g)
+runtime·traceback(byte *pc0, byte *sp, byte *lr, G *gp)
{
- runtime·gentraceback(pc0, sp, lr, g, 0, nil, 100);
+ runtime·gentraceback(pc0, sp, lr, gp, 0, nil, 100);
}
// func caller(n int) (pc uintptr, file string, line int, ok bool)
diff --git a/src/pkg/runtime/traceback_x86.c b/src/pkg/runtime/traceback_x86.c
index 7f53d11..4547556 100644
--- a/src/pkg/runtime/traceback_x86.c
+++ b/src/pkg/runtime/traceback_x86.c
@@ -23,7 +23,7 @@
// A little clunky to merge the two but avoids duplicating
// the code and all its subtlety.
int32
-runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr *pcbuf, int32 max)
+runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max)
{
byte *p;
int32 i, n, iter, sawnewstack;
@@ -40,10 +40,10 @@
waspanic = false;
// If the PC is goexit, the goroutine hasn't started yet.
- if(pc0 == g->sched.pc && sp == (byte*)g->sched.sp && pc0 == (byte*)runtime·goexit) {
+ if(pc0 == gp->sched.pc && sp == (byte*)gp->sched.sp && pc0 == (byte*)runtime·goexit) {
fp = sp;
lr = pc;
- pc = (uintptr)g->entry;
+ pc = (uintptr)gp->entry;
}
// If the PC is zero, it's likely a nil function call.
@@ -62,7 +62,7 @@
n = 0;
sawnewstack = 0;
- stk = (Stktop*)g->stackbase;
+ stk = (Stktop*)gp->stackbase;
for(iter = 0; iter < 100 && n < max; iter++) { // iter avoids looping forever
// Typically:
// pc is the PC of the running function.
@@ -161,7 +161,7 @@
if(f->entry == (uintptr)runtime·newstack)
sawnewstack = 1;
- if(pcbuf == nil && f->entry == (uintptr)runtime·morestack && g == m->g0 && sawnewstack) {
+ if(pcbuf == nil && f->entry == (uintptr)runtime·morestack && gp == m->g0 && sawnewstack) {
// The fact that we saw newstack means that morestack
// has managed to record its information in m, so we can
// use it to keep unwinding the stack.
@@ -171,16 +171,16 @@
lr = (uintptr)m->morebuf.pc;
fp = (byte*)m->morebuf.sp;
sawnewstack = 0;
- g = m->curg;
- stk = (Stktop*)g->stackbase;
+ gp = m->curg;
+ stk = (Stktop*)gp->stackbase;
continue;
}
- if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
+ if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && gp == m->g0) {
// Lessstack is running on scheduler stack. Switch to original goroutine.
runtime·printf("----- lessstack called from goroutine %D -----\n", m->curg->goid);
- g = m->curg;
- stk = (Stktop*)g->stackbase;
+ gp = m->curg;
+ stk = (Stktop*)gp->stackbase;
sp = (byte*)stk->gobuf.sp;
pc = (uintptr)stk->gobuf.pc;
fp = nil;
@@ -196,7 +196,7 @@
}
// Show what created goroutine, except main goroutine (goid 1).
- if(pcbuf == nil && (pc = g->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && g->goid != 1) {
+ if(pcbuf == nil && (pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && gp->goid != 1) {
runtime·printf("created by %S\n", f->name);
tracepc = pc; // back up to CALL instruction for funcline.
if(n > 0 && pc > f->entry)
@@ -211,9 +211,9 @@
}
void
-runtime·traceback(byte *pc0, byte *sp, byte*, G *g)
+runtime·traceback(byte *pc0, byte *sp, byte*, G *gp)
{
- runtime·gentraceback(pc0, sp, nil, g, 0, nil, 100);
+ runtime·gentraceback(pc0, sp, nil, gp, 0, nil, 100);
}
int32