diff options
| author | Jan Ziak <0xe2.0x9a.0x9b@gmail.com> | 2012-10-21 17:41:32 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-10-21 17:41:32 -0400 |
| commit | 4a191c2c1b3fe1325ab8617472aef628fd494076 (patch) | |
| tree | f257db791881a8690e69ae85100f4d8b01a4f161 /src/pkg/runtime/hashmap.c | |
| parent | 4545dc6a6953b2be6d0d50719ad165d46278d9bf (diff) | |
| download | go-4a191c2c1b3fe1325ab8617472aef628fd494076.tar.xz | |
runtime: store types of allocated objects
R=rsc
CC=golang-dev
https://golang.org/cl/6569057
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
| -rw-r--r-- | src/pkg/runtime/hashmap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index fec407b67a..4869669b6e 100644 --- a/src/pkg/runtime/hashmap.c +++ b/src/pkg/runtime/hashmap.c @@ -3,6 +3,8 @@ // license that can be found in the LICENSE file. #include "runtime.h" +#include "arch_GOARCH.h" +#include "malloc.h" #include "hashmap.h" #include "type.h" #include "race.h" @@ -748,6 +750,13 @@ runtime·makemap_c(MapType *typ, int64 hint) h = runtime·mal(sizeof(*h)); h->flag |= CanFreeTable; /* until reflect gets involved, free is okay */ + if(UseSpanType) { + if(false) { + runtime·printf("makemap %S: %p\n", *typ->string, h); + } + runtime·settype(h, (uintptr)typ | TypeInfo_Map); + } + ksize = ROUND(key->size, sizeof(void*)); vsize = ROUND(val->size, sizeof(void*)); if(ksize > MaxData || vsize > MaxData || ksize+vsize > MaxData) { |
