mirror of
https://github.com/golang/go
synced 2024-11-23 01:30:02 -07:00
runtime: remove atomic CAS loop from marknogc
Spans are now private to threads, and the loop is removed from all other functions. Remove it from marknogc for consistency. LGTM=khr, rsc R=golang-codereviews, bradfitz, khr CC=golang-codereviews, khr, rsc https://golang.org/cl/72520043
This commit is contained in:
parent
38f6c3f59d
commit
3877f1d9c8
@ -2614,26 +2614,12 @@ runfinq(void)
|
||||
void
|
||||
runtime·marknogc(void *v)
|
||||
{
|
||||
uintptr *b, obits, bits, off, shift;
|
||||
uintptr *b, off, shift;
|
||||
|
||||
off = (uintptr*)v - (uintptr*)runtime·mheap.arena_start; // word offset
|
||||
b = (uintptr*)runtime·mheap.arena_start - off/wordsPerBitmapWord - 1;
|
||||
shift = off % wordsPerBitmapWord;
|
||||
|
||||
for(;;) {
|
||||
obits = *b;
|
||||
if((obits>>shift & bitMask) != bitAllocated)
|
||||
runtime·throw("bad initial state for marknogc");
|
||||
bits = (obits & ~(bitAllocated<<shift)) | bitBlockBoundary<<shift;
|
||||
if(runtime·gomaxprocs == 1) {
|
||||
*b = bits;
|
||||
break;
|
||||
} else {
|
||||
// more than one goroutine is potentially running: use atomic op
|
||||
if(runtime·casp((void**)b, (void*)obits, (void*)bits))
|
||||
break;
|
||||
}
|
||||
}
|
||||
*b = (*b & ~(bitAllocated<<shift)) | bitBlockBoundary<<shift;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user