mirror of
https://github.com/golang/go
synced 2024-11-24 21:10:04 -07:00
runtime: put lockorder before pollorder in Select memory block.
Otherwise lockorder may be misaligned, since lockorder is a list of pointers and pollorder is a list of uint16. Discovered running gccgo (which uses a modified copy of this code) on SPARC. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5655054
This commit is contained in:
parent
f91cc3bdbb
commit
53e139c7a0
@ -586,6 +586,10 @@ newselect(int32 size, Select **selp)
|
||||
if(size > 1)
|
||||
n = size-1;
|
||||
|
||||
// allocate all the memory we need in a single allocation
|
||||
// start with Select with size cases
|
||||
// then lockorder with size entries
|
||||
// then pollorder with size entries
|
||||
sel = runtime·mal(sizeof(*sel) +
|
||||
n*sizeof(sel->scase[0]) +
|
||||
size*sizeof(sel->lockorder[0]) +
|
||||
@ -593,8 +597,8 @@ newselect(int32 size, Select **selp)
|
||||
|
||||
sel->tcase = size;
|
||||
sel->ncase = 0;
|
||||
sel->pollorder = (void*)(sel->scase + size);
|
||||
sel->lockorder = (void*)(sel->pollorder + size);
|
||||
sel->lockorder = (void*)(sel->scase + size);
|
||||
sel->pollorder = (void*)(sel->lockorder + size);
|
||||
*selp = sel;
|
||||
|
||||
if(debug)
|
||||
|
Loading…
Reference in New Issue
Block a user