]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: switch to 64-bit goroutine ids
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 26 Oct 2012 06:13:06 +0000 (10:13 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 26 Oct 2012 06:13:06 +0000 (10:13 +0400)
Fixes #4275.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6759053

src/pkg/runtime/mgc0.c
src/pkg/runtime/proc.c
src/pkg/runtime/runtime.h
src/pkg/runtime/traceback_arm.c
src/pkg/runtime/traceback_x86.c

index dc3b877c4e461327dae293f353339f8a2a439005..4d857bf0b7260408e2dabf5bc15832156dff502d 100644 (file)
@@ -567,7 +567,7 @@ addstackroots(G *gp)
        n = 0;
        while(stk) {
                if(sp < guard-StackGuard || (byte*)stk < sp) {
-                       runtime·printf("scanstack inconsistent: g%d#%d sp=%p not in [%p,%p]\n", gp->goid, n, sp, guard-StackGuard, stk);
+                       runtime·printf("scanstack inconsistent: g%D#%d sp=%p not in [%p,%p]\n", gp->goid, n, sp, guard-StackGuard, stk);
                        runtime·throw("scanstack");
                }
                addroot(sp, (byte*)stk - sp);
index 5fecf055897b93f75d17bdb43a85b3e5e9e63e28..9da748f2f66709ca599a9a05669d12c7786a26a3 100644 (file)
@@ -55,7 +55,7 @@ struct Sched {
        Lock;
 
        G *gfree;       // available g's (status == Gdead)
-       int32 goidgen;
+       int64 goidgen;
 
        G *ghead;       // g's waiting to run
        G *gtail;
@@ -311,7 +311,7 @@ runtime·goroutineheader(G *gp)
                status = "???";
                break;
        }
-       runtime·printf("goroutine %d [%s]:\n", gp->goid, status);
+       runtime·printf("goroutine %D [%s]:\n", gp->goid, status);
 }
 
 void
@@ -391,7 +391,7 @@ gput(G *gp)
        // If g is the idle goroutine for an m, hand it off.
        if(gp->idlem != nil) {
                if(gp->idlem->idleg != nil) {
-                       runtime·printf("m%d idle out of sync: g%d g%d\n",
+                       runtime·printf("m%d idle out of sync: g%D g%D\n",
                                gp->idlem->id,
                                gp->idlem->idleg->goid, gp->goid);
                        runtime·throw("runtime: double idle");
@@ -493,7 +493,7 @@ readylocked(G *gp)
 
        // Mark runnable.
        if(gp->status == Grunnable || gp->status == Grunning) {
-               runtime·printf("goroutine %d has status %d\n", gp->goid, gp->status);
+               runtime·printf("goroutine %D has status %d\n", gp->goid, gp->status);
                runtime·throw("bad g->status in ready");
        }
        gp->status = Grunnable;
@@ -1100,7 +1100,7 @@ runtime·oldstack(void)
        uintptr cret;
        byte *sp;
        G *g1;
-       int32 goid;
+       int64 goid;
 
 //printf("oldstack m->cret=%p\n", m->cret);
 
@@ -1294,7 +1294,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc)
        byte *sp;
        G *newg;
        int32 siz;
-       int32 goid;
+       int64 goid;
 
 //printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret);
        siz = narg + nret;
@@ -1307,7 +1307,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc)
        if(siz > StackMin - 1024)
                runtime·throw("runtime.newproc: function arguments too large for new goroutine");
 
-       goid = runtime·xadd((uint32*)&runtime·sched.goidgen, 1);
+       goid = runtime·xadd64((uint64*)&runtime·sched.goidgen, 1);
        if(raceenabled)
                runtime·racegostart(goid, callerpc);
 
index 83757ba8a3887818e7c92a451690b1d122288f06..cd2f6f0587d7760b20f9e4a0c8c03f2219544eb9 100644 (file)
@@ -203,7 +203,7 @@ struct      G
        G*      alllink;        // on allg
        void*   param;          // passed parameter on wakeup
        int16   status;
-       int32   goid;
+       int64   goid;
        uint32  selgen;         // valid sudog pointer
        int8*   waitreason;     // if status==Gwaiting
        G*      schedlink;
index 9ca54784ff9f43b025a1985a530d7a82f73886df..c92feb6ed83de5eb0b0a90cb464178f070ef9836 100644 (file)
@@ -147,7 +147,7 @@ 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) {
-                       runtime·printf("----- newstack called from goroutine %d -----\n", m->curg->goid);
+                       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;
@@ -158,7 +158,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                }
                
                if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
-                       runtime·printf("----- lessstack called from goroutine %d -----\n", m->curg->goid);
+                       runtime·printf("----- lessstack called from goroutine %D -----\n", m->curg->goid);
                        g = m->curg;
                        stk = (Stktop*)g->stackbase;
                        sp = (byte*)stk->gobuf.sp;
index 5a307de3b5268a0f1c5bd6336d4a9744ebf6ae7c..7f53d1136bebba9df5aba1cd8658ee922967b2e4 100644 (file)
@@ -165,7 +165,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
                        // 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.
-                       runtime·printf("----- morestack called from goroutine %d -----\n", m->curg->goid);
+                       runtime·printf("----- morestack called from goroutine %D -----\n", m->curg->goid);
                        pc = (uintptr)m->morepc;
                        sp = (byte*)m->morebuf.sp - sizeof(void*);
                        lr = (uintptr)m->morebuf.pc;
@@ -178,7 +178,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
 
                if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
                        // Lessstack is running on scheduler stack.  Switch to original goroutine.
-                       runtime·printf("----- lessstack called from goroutine %d -----\n", m->curg->goid);
+                       runtime·printf("----- lessstack called from goroutine %D -----\n", m->curg->goid);
                        g = m->curg;
                        stk = (Stktop*)g->stackbase;
                        sp = (byte*)stk->gobuf.sp;