diff options
| author | Russ Cox <rsc@golang.org> | 2011-12-05 09:40:22 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-12-05 09:40:22 -0500 |
| commit | b9ccd077dc478fca2e8bd00633c1a60a54f342d8 (patch) | |
| tree | 7e721c41503113d404fa3e99ab7bd8d5ba1c8110 /src/pkg/runtime/chan.c | |
| parent | 263c955f2fff2016b5ff77d787d8e1b50555930a (diff) | |
| download | go-b9ccd077dc478fca2e8bd00633c1a60a54f342d8.tar.xz | |
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
https://golang.org/cl/5453043
Diffstat (limited to 'src/pkg/runtime/chan.c')
| -rw-r--r-- | src/pkg/runtime/chan.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c index e128accbec..bea1a34f8f 100644 --- a/src/pkg/runtime/chan.c +++ b/src/pkg/runtime/chan.c @@ -92,11 +92,6 @@ runtime·makechan_c(ChanType *t, int64 hint) if(hint < 0 || (int32)hint != hint || (elem->size > 0 && hint > ((uintptr)-1) / elem->size)) runtime·panicstring("makechan: size out of range"); - if(elem->alg >= nelem(runtime·algarray)) { - runtime·printf("chan(alg=%d)\n", elem->alg); - runtime·throw("runtime.makechan: unsupported elem type"); - } - // calculate rounded size of Hchan n = sizeof(*c); while(n & MAXALIGN) @@ -105,12 +100,12 @@ runtime·makechan_c(ChanType *t, int64 hint) // allocate memory in one call c = (Hchan*)runtime·mal(n + hint*elem->size); c->elemsize = elem->size; - c->elemalg = &runtime·algarray[elem->alg]; + c->elemalg = elem->alg; c->elemalign = elem->align; c->dataqsiz = hint; if(debug) - runtime·printf("makechan: chan=%p; elemsize=%D; elemalg=%d; elemalign=%d; dataqsiz=%d\n", + runtime·printf("makechan: chan=%p; elemsize=%D; elemalg=%p; elemalign=%d; dataqsiz=%d\n", c, (int64)elem->size, elem->alg, elem->align, c->dataqsiz); return c; |
