Commit 320df44f authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: switch to 64-bit goroutine ids

Fixes #4275.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6759053
parent 335eef85
...@@ -567,7 +567,7 @@ addstackroots(G *gp) ...@@ -567,7 +567,7 @@ addstackroots(G *gp)
n = 0; n = 0;
while(stk) { while(stk) {
if(sp < guard-StackGuard || (byte*)stk < sp) { 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"); runtime·throw("scanstack");
} }
addroot(sp, (byte*)stk - sp); addroot(sp, (byte*)stk - sp);
......
...@@ -55,7 +55,7 @@ struct Sched { ...@@ -55,7 +55,7 @@ struct Sched {
Lock; Lock;
G *gfree; // available g's (status == Gdead) G *gfree; // available g's (status == Gdead)
int32 goidgen; int64 goidgen;
G *ghead; // g's waiting to run G *ghead; // g's waiting to run
G *gtail; G *gtail;
...@@ -311,7 +311,7 @@ runtime·goroutineheader(G *gp) ...@@ -311,7 +311,7 @@ runtime·goroutineheader(G *gp)
status = "???"; status = "???";
break; break;
} }
runtime·printf("goroutine %d [%s]:\n", gp->goid, status); runtime·printf("goroutine %D [%s]:\n", gp->goid, status);
} }
void void
...@@ -391,7 +391,7 @@ gput(G *gp) ...@@ -391,7 +391,7 @@ gput(G *gp)
// If g is the idle goroutine for an m, hand it off. // If g is the idle goroutine for an m, hand it off.
if(gp->idlem != nil) { if(gp->idlem != nil) {
if(gp->idlem->idleg != 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->id,
gp->idlem->idleg->goid, gp->goid); gp->idlem->idleg->goid, gp->goid);
runtime·throw("runtime: double idle"); runtime·throw("runtime: double idle");
...@@ -493,7 +493,7 @@ readylocked(G *gp) ...@@ -493,7 +493,7 @@ readylocked(G *gp)
// Mark runnable. // Mark runnable.
if(gp->status == Grunnable || gp->status == Grunning) { 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"); runtime·throw("bad g->status in ready");
} }
gp->status = Grunnable; gp->status = Grunnable;
...@@ -1100,7 +1100,7 @@ runtime·oldstack(void) ...@@ -1100,7 +1100,7 @@ runtime·oldstack(void)
uintptr cret; uintptr cret;
byte *sp; byte *sp;
G *g1; G *g1;
int32 goid; int64 goid;
//printf("oldstack m->cret=%p\n", m->cret); //printf("oldstack m->cret=%p\n", m->cret);
...@@ -1294,7 +1294,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc) ...@@ -1294,7 +1294,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc)
byte *sp; byte *sp;
G *newg; G *newg;
int32 siz; int32 siz;
int32 goid; int64 goid;
//printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret); //printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret);
siz = narg + nret; siz = narg + nret;
...@@ -1307,7 +1307,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc) ...@@ -1307,7 +1307,7 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc)
if(siz > StackMin - 1024) if(siz > StackMin - 1024)
runtime·throw("runtime.newproc: function arguments too large for new goroutine"); 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) if(raceenabled)
runtime·racegostart(goid, callerpc); runtime·racegostart(goid, callerpc);
......
...@@ -203,7 +203,7 @@ struct G ...@@ -203,7 +203,7 @@ struct G
G* alllink; // on allg G* alllink; // on allg
void* param; // passed parameter on wakeup void* param; // passed parameter on wakeup
int16 status; int16 status;
int32 goid; int64 goid;
uint32 selgen; // valid sudog pointer uint32 selgen; // valid sudog pointer
int8* waitreason; // if status==Gwaiting int8* waitreason; // if status==Gwaiting
G* schedlink; G* schedlink;
......
...@@ -147,7 +147,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr ...@@ -147,7 +147,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr
waspanic = f->entry == (uintptr)runtime·sigpanic; 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 && 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; pc = (uintptr)m->morepc;
sp = (byte*)m->moreargp - sizeof(void*); sp = (byte*)m->moreargp - sizeof(void*);
lr = (uintptr)m->morebuf.pc; lr = (uintptr)m->morebuf.pc;
...@@ -158,7 +158,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr ...@@ -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) { 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; g = m->curg;
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
sp = (byte*)stk->gobuf.sp; sp = (byte*)stk->gobuf.sp;
......
...@@ -165,7 +165,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr ...@@ -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 // The fact that we saw newstack means that morestack
// has managed to record its information in m, so we can // has managed to record its information in m, so we can
// use it to keep unwinding the stack. // 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; pc = (uintptr)m->morepc;
sp = (byte*)m->morebuf.sp - sizeof(void*); sp = (byte*)m->morebuf.sp - sizeof(void*);
lr = (uintptr)m->morebuf.pc; lr = (uintptr)m->morebuf.pc;
...@@ -178,7 +178,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr ...@@ -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) { if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
// Lessstack is running on scheduler stack. Switch to original goroutine. // 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; g = m->curg;
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
sp = (byte*)stk->gobuf.sp; sp = (byte*)stk->gobuf.sp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment