]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use "mp" and "gp" instead of "m" and "g" for local variable name to avoid...
authorJingcheng Zhang <diogin@gmail.com>
Tue, 18 Dec 2012 16:30:29 +0000 (00:30 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Tue, 18 Dec 2012 16:30:29 +0000 (00:30 +0800)
R=golang-dev, minux.ma, rsc
CC=bradfitz, golang-dev
https://golang.org/cl/6939064

25 files changed:
src/pkg/runtime/cgocall.c
src/pkg/runtime/malloc.goc
src/pkg/runtime/mgc0.c
src/pkg/runtime/mprof.goc
src/pkg/runtime/os_plan9.h
src/pkg/runtime/proc.c
src/pkg/runtime/runtime.h
src/pkg/runtime/signal_netbsd_386.c
src/pkg/runtime/signal_netbsd_amd64.c
src/pkg/runtime/sys_darwin_386.s
src/pkg/runtime/sys_darwin_amd64.s
src/pkg/runtime/sys_linux_386.s
src/pkg/runtime/sys_linux_amd64.s
src/pkg/runtime/sys_linux_arm.s
src/pkg/runtime/sys_openbsd_386.s
src/pkg/runtime/sys_openbsd_amd64.s
src/pkg/runtime/thread_darwin.c
src/pkg/runtime/thread_freebsd.c
src/pkg/runtime/thread_linux.c
src/pkg/runtime/thread_netbsd.c
src/pkg/runtime/thread_openbsd.c
src/pkg/runtime/thread_plan9.c
src/pkg/runtime/thread_windows.c
src/pkg/runtime/traceback_arm.c
src/pkg/runtime/traceback_x86.c

index 7a20379a9d29a908fb54ddd2d89ebefc93129908..2427883873635032f3e314e8dbe43c140b0056e6 100644 (file)
@@ -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 @@ unlockm(void)
 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);
 }
 
index 9353653acd33eca68e4e7cd59bd46b1b3c3bfdc3..f58045e63e9c63c86225657205be06cd4b60e780 100644 (file)
@@ -470,7 +470,7 @@ runtime·MHeap_SysAlloc(MHeap *h, uintptr n)
 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 @@ runtime·settype_flush(M *m, bool sysalloc)
        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·settype_flush(M *m, bool sysalloc)
        }
        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 @@ runtime·settype_flush(M *m, bool sysalloc)
 void
 runtime·settype(void *v, uintptr t)
 {
-       M *m1;
+       M *mp;
        uintptr *buf;
        uintptr i;
        MSpan *s;
@@ -597,16 +597,16 @@ runtime·settype(void *v, uintptr t)
        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) {
index a60684168bee42039d110b028aeda03d71be62f4..482190e52b9fe76093f3405409e938200a9f8fe2 100644 (file)
@@ -1160,16 +1160,16 @@ static int32 gcpercent = -2;
 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 @@ cachestats(GCStats *stats)
                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 @@ gc(struct gc_args *args)
        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 @@ gc(struct gc_args *args)
        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;
index 893ff3032e6565219aed69756082cce3c6f821b2..7a245b537d5339de9d32b246a88b55fe995724fc 100644 (file)
@@ -394,18 +394,18 @@ struct TRecord {
 
 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 @@ func Stack(b Slice, all bool) (n int) {
 }
 
 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;
 }
index 7fb8aa6249721d39a09315dcf699b6438e202a2f..b1dc8158b980cb374c187f185f1e37adc07bf548 100644 (file)
@@ -12,7 +12,7 @@ int32 runtime·close(int32 fd);
 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);
index 7dfd3c73fb398674d61909bd864230453041ef14..80e97795abb3a911dce7e26fea25737cbe3c2366 100644 (file)
@@ -264,13 +264,13 @@ schedlock(void)
 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 @@ runtime·oldstack(void)
        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 @@ runtime·oldstack(void)
        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 @@ runtime·newstack(void)
        int32 framesize, minalloc, argsize;
        Stktop *top;
        byte *stk, *sp;
-       G *g1;
+       G *gp;
        Gobuf label;
        bool reflectcall;
        uintptr free;
@@ -1145,12 +1145,12 @@ runtime·newstack(void)
        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 @@ runtime·newstack(void)
        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 @@ runtime·newstack(void)
 
        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 @@ runtime·newstack(void)
        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) {
index e6a78ba5709e4a77d872b6c479f8762367b5efaa..6c9d50eff4e0f6bfa4d3066e0959370323f96581 100644 (file)
@@ -620,7 +620,7 @@ void        runtime·exit1(int32);
 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);
index fcb92f3b209d235781c2f76d0e1b81b23066b2cb..756abe3f5c27f955418ee94ec4fa3ebefbcc4548 100644 (file)
@@ -139,11 +139,11 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
 }
 
 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;
 }
index 1971106e38f7724b97044f45596213cd07eafaef..556a7be8b056eca0a2b5ced180c389126e3fc8df 100644 (file)
@@ -146,12 +146,12 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
 }
 
 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;
 }
index c1652090cbe8039abb1366dd7853de6fac877367..bdbe0737f26ee83b0a07d4378661743cb78d9445 100644 (file)
@@ -292,7 +292,7 @@ TEXT runtime·usleep(SB),7,$32
        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
index 69207c8d8ade5bc990cadfd825de8566e517bc38..c91501a91279a7edba3a1462289a2089cc5d7e2b 100644 (file)
@@ -254,7 +254,7 @@ TEXT runtime·usleep(SB),7,$16
        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
index b212f806c171f82765fb1f6aac5f1862aeb7efa2..60f76fa92fb85dc61c797efd72a96733e634208b 100644 (file)
@@ -259,7 +259,7 @@ TEXT runtime·futex(SB),7,$0
        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 @@ TEXT runtime·clone(SB),7,$0
        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)
index e8078158c6464e49d3aa8f0194f039c2157c14a5..3f7a207f375368cf9ae203f97cabb6faeaf6f15c 100644 (file)
@@ -268,12 +268,12 @@ TEXT runtime·futex(SB),7,$0
        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
index ec5b0ca135f111a3d23b537c88276f39aa558637..eda7b1f568bd79e4b713319db20d354fe4e4a892 100644 (file)
@@ -206,7 +206,7 @@ TEXT runtime·futex(SB),7,$0
        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 @@ TEXT runtime·clone(SB),7,$0
        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
index f7921552cf7077f26cb3f751e8efa69d0a026919..c62e0f94993a647d750e07e9dd3a258ed8e81b1f 100644 (file)
@@ -195,10 +195,10 @@ TEXT runtime·sigtramp(SB),7,$44
        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
index e569becfa1e6e0b07814cce4600589b72870538e..49eb7a9815ca838b06365320e9c8dbdef5ef78a6 100644 (file)
@@ -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
index aff2b6fd371f3a2f15333cd7ee51b862ddf20e78..ab3257572a7a2125a6600ba249c586db0fdd4e51 100644 (file)
@@ -87,19 +87,19 @@ runtime·goenvs(void)
 }
 
 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) {
index 884bbf4c8872b5f115920d6a70811bba09faae27..54c26215a605146451b5f64e9940005cc7c40beb 100644 (file)
@@ -77,32 +77,32 @@ runtime·futexwakeup(uint32 *addr, uint32 cnt)
 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*)&param, 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(&param, sizeof param);
        runtime·sigprocmask(&oset, nil);
index c428ba1b392dcdddd0252e4df5c3985fc0cf2256..dc8cad57a98f9de66904f5bb6e642d6678d468b4 100644 (file)
@@ -124,7 +124,7 @@ enum
 };
 
 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 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
                | 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) {
index a703e0714ad52e4198c50dce07bb2cc90eec8e4d..195dcfd2c2f05a8cf8631b1938db61c8c274d98a 100644 (file)
@@ -25,7 +25,7 @@ static Sigset sigset_none;
 
 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 @@ runtime·semawakeup(M *mp)
 #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 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
        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 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
        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);
index b696534e79374843a0f9b493a1a9ee783e3b7205..57f64cf589dd1017ad8a8c46c8f876bcb5558b79 100644 (file)
@@ -23,7 +23,7 @@ extern SigTab runtime·sigtab[];
 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 @@ runtime·semawakeup(M *mp)
 }
 
 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 @@ runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
        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*)&param, sizeof(param), m, g, fn);
+       ret = runtime·tfork((byte*)&param, sizeof(param), mp, gp, fn);
        runtime·sigprocmask(SIG_SETMASK, oset);
 
        if(ret < 0) {
index 6fd1ba72251532fd4fb0f0a358e48db4279584e8..b7a7de7ee716834e9b12a7cd0fa3a7cd6036aee5 100644 (file)
@@ -171,13 +171,13 @@ runtime·itoa(int32 n, byte *p, uint32 len)
 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 @@ runtime·exit(int32 e)
 }
 
 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");
 }
 
index 5f893c1613aaf1b5d5086477fb97a7865aacd541..600a48ab62801736ee54c8262601109181fb8ab8 100644 (file)
@@ -186,22 +186,22 @@ runtime·semacreate(void)
 #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).
index c92feb6ed83de5eb0b0a90cb464178f070ef9836..e67ccd415324fee970fa3e9b77e1d8182acfb190 100644 (file)
@@ -17,7 +17,7 @@ void _divu(void);
 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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
 
        // 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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
        }
 
        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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                
                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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                        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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
 }
 
 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)
index 7f53d1136bebba9df5aba1cd8658ee922967b2e4..45475560968c83aba3de3a4f71ad76c013e6178b 100644 (file)
@@ -23,7 +23,7 @@ void runtime·sigpanic(void);
 // 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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
        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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
 
        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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                        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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
        }
        
        // 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 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
 }
 
 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