summaryrefslogtreecommitdiff
path: root/src/cmd/gc/range.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-12-05 09:40:22 -0500
committerRuss Cox <rsc@golang.org>2011-12-05 09:40:22 -0500
commit531134952ddf04ec44d3319720b50ebe857850a8 (patch)
treeeee90e78705f3e72558e5d0b05cc57a9af89596a /src/cmd/gc/range.c
parent30355daa70240096df49dfb5f7150c7d2c5f02bc (diff)
downloadgo-531134952ddf04ec44d3319720b50ebe857850a8.tar.gz
runtime: prep for type-specific algorithms
Equality on structs will require arbitrary code for type equality, so change algorithm in type data from uint8 to table pointer. In the process, trim top-level map structure from 104/80 bytes (64-bit/32-bit) to 24/12. Equality on structs will require being able to call code generated by the Go compiler, and C code has no way to access Go return values, so change the hash and equal algorithm functions to take a pointer to a result instead of returning the result. R=ken CC=golang-dev http://codereview.appspot.com/5453043
Diffstat (limited to 'src/cmd/gc/range.c')
-rw-r--r--src/cmd/gc/range.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/gc/range.c b/src/cmd/gc/range.c
index 25d1131ec..9bcd833a7 100644
--- a/src/cmd/gc/range.c
+++ b/src/cmd/gc/range.c
@@ -167,7 +167,9 @@ walkrange(Node *n)
case TMAP:
th = typ(TARRAY);
th->type = ptrto(types[TUINT8]);
- th->bound = (sizeof(struct Hiter) + widthptr - 1) / widthptr;
+ // see ../../pkg/runtime/hashmap.h:/hash_iter
+ // Size in words.
+ th->bound = 5 + 4*3 + 4*4/widthptr;
hit = temp(th);
fn = syslook("mapiterinit", 1);