Commit 7f0ee023 authored by Keith Randall's avatar Keith Randall

runtime: revert of CL 8852047: do hashmap grow work during reads.

seems to break freebsd-386.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9915047
parent 07b6add0
This diff is collapsed.
...@@ -17,7 +17,7 @@ void ...@@ -17,7 +17,7 @@ void
HASH_LOOKUP1(MapType *t, Hmap *h, KEYTYPE key, byte *value) HASH_LOOKUP1(MapType *t, Hmap *h, KEYTYPE key, byte *value)
{ {
uintptr hash; uintptr hash;
uintptr bucket; uintptr bucket, oldbucket;
Bucket *b; Bucket *b;
uintptr i; uintptr i;
KEYTYPE *k; KEYTYPE *k;
...@@ -83,14 +83,13 @@ dohash: ...@@ -83,14 +83,13 @@ dohash:
hash = h->hash0; hash = h->hash0;
HASHFUNC(&hash, sizeof(KEYTYPE), &key); HASHFUNC(&hash, sizeof(KEYTYPE), &key);
bucket = hash & (((uintptr)1 << h->B) - 1); bucket = hash & (((uintptr)1 << h->B) - 1);
b = runtime·atomicloadp(&h->oldbuckets); if(h->oldbuckets != nil) {
if(b != nil) { oldbucket = bucket & (((uintptr)1 << (h->B - 1)) - 1);
grow_work_read(t, h); b = (Bucket*)(h->oldbuckets + oldbucket * h->bucketsize);
b = (Bucket*)((byte*)b + (bucket & (((uintptr)1 << (h->B - 1)) - 1)) * h->bucketsize); if(evacuated(b)) {
if(((uintptr)runtime·atomicloadp(&b->overflow) & 1) != 0) b = (Bucket*)(h->buckets + bucket * h->bucketsize);
goto newbucket; }
} else { } else {
newbucket:
b = (Bucket*)(h->buckets + bucket * h->bucketsize); b = (Bucket*)(h->buckets + bucket * h->bucketsize);
} }
top = hash >> (sizeof(uintptr)*8 - 8); top = hash >> (sizeof(uintptr)*8 - 8);
...@@ -104,7 +103,7 @@ dohash: ...@@ -104,7 +103,7 @@ dohash:
return; return;
} }
} }
b = overflowptr(b); b = b->overflow;
} while(b != nil); } while(b != nil);
} }
value = empty_value; value = empty_value;
...@@ -116,7 +115,7 @@ void ...@@ -116,7 +115,7 @@ void
HASH_LOOKUP2(MapType *t, Hmap *h, KEYTYPE key, byte *value, bool res) HASH_LOOKUP2(MapType *t, Hmap *h, KEYTYPE key, byte *value, bool res)
{ {
uintptr hash; uintptr hash;
uintptr bucket; uintptr bucket, oldbucket;
Bucket *b; Bucket *b;
uintptr i; uintptr i;
KEYTYPE *k; KEYTYPE *k;
...@@ -188,14 +187,13 @@ dohash: ...@@ -188,14 +187,13 @@ dohash:
hash = h->hash0; hash = h->hash0;
HASHFUNC(&hash, sizeof(KEYTYPE), &key); HASHFUNC(&hash, sizeof(KEYTYPE), &key);
bucket = hash & (((uintptr)1 << h->B) - 1); bucket = hash & (((uintptr)1 << h->B) - 1);
b = runtime·atomicloadp(&h->oldbuckets); if(h->oldbuckets != nil) {
if(b != nil) { oldbucket = bucket & (((uintptr)1 << (h->B - 1)) - 1);
grow_work_read(t, h); b = (Bucket*)(h->oldbuckets + oldbucket * h->bucketsize);
b = (Bucket*)((byte*)b + (bucket & (((uintptr)1 << (h->B - 1)) - 1)) * h->bucketsize); if(evacuated(b)) {
if(((uintptr)runtime·atomicloadp(&b->overflow) & 1) != 0) b = (Bucket*)(h->buckets + bucket * h->bucketsize);
goto newbucket; }
} else { } else {
newbucket:
b = (Bucket*)(h->buckets + bucket * h->bucketsize); b = (Bucket*)(h->buckets + bucket * h->bucketsize);
} }
top = hash >> (sizeof(uintptr)*8 - 8); top = hash >> (sizeof(uintptr)*8 - 8);
...@@ -211,7 +209,7 @@ dohash: ...@@ -211,7 +209,7 @@ dohash:
return; return;
} }
} }
b = overflowptr(b); b = b->overflow;
} while(b != nil); } while(b != nil);
} }
value = empty_value; value = empty_value;
......
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