mirror of https://github.com/golang/go.git
runtime: correct iteration of large map values
The hash_next_and_deref was a dreg from a previous large value scheme. Fixes #1163. R=r, r2 CC=golang-dev https://golang.org/cl/2369043
This commit is contained in:
parent
335a318c27
commit
8599a83727
|
|
@ -920,17 +920,6 @@ void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
|
||||||
hash_next_and_deref(struct hash_iter *it)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
p = hash_next(it);
|
|
||||||
if(it->h->indirectval)
|
|
||||||
p = *(void**)p;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mapiterinit(hmap *map[any]any, hiter *any);
|
// mapiterinit(hmap *map[any]any, hiter *any);
|
||||||
void
|
void
|
||||||
·mapiterinit(Hmap *h, struct hash_iter *it)
|
·mapiterinit(Hmap *h, struct hash_iter *it)
|
||||||
|
|
@ -940,7 +929,7 @@ void
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hash_iter_init(h, it);
|
hash_iter_init(h, it);
|
||||||
it->data = hash_next_and_deref(it);
|
it->data = hash_next(it);
|
||||||
if(debug) {
|
if(debug) {
|
||||||
prints("runtime.mapiterinit: map=");
|
prints("runtime.mapiterinit: map=");
|
||||||
·printpointer(h);
|
·printpointer(h);
|
||||||
|
|
@ -969,7 +958,7 @@ void
|
||||||
if(gcwaiting)
|
if(gcwaiting)
|
||||||
gosched();
|
gosched();
|
||||||
|
|
||||||
it->data = hash_next_and_deref(it);
|
it->data = hash_next(it);
|
||||||
if(debug) {
|
if(debug) {
|
||||||
prints("runtime.mapiternext: iter=");
|
prints("runtime.mapiternext: iter=");
|
||||||
·printpointer(it);
|
·printpointer(it);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
// $G $D/$F.go && $L $F.$A && ./$A.out
|
||||||
|
|
||||||
|
// Copyright 2010 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
m := make(map[string][1000]byte)
|
||||||
|
m["hi"] = [1000]byte{1}
|
||||||
|
|
||||||
|
v := m["hi"]
|
||||||
|
|
||||||
|
for k, vv := range m {
|
||||||
|
if k != "hi" || string(v[:]) != string(vv[:]) {
|
||||||
|
panic("bad iter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue