Reviewers: golang-dev1,
Message:
Hello
golan...@googlegroups.com,
I'd like you to review this change to
https://dvyukov%
40goog...@code.google.com/p/go/
Description:
runtime: remove unused filed from Hchan
Remove alignment logic as well, it's not respected by chanbuf() anyway.
Please review this at
https://codereview.appspot.com/9678046/
Affected files:
M src/pkg/runtime/chan.c
Index: src/pkg/runtime/chan.c
===================================================================
--- a/src/pkg/runtime/chan.c
+++ b/src/pkg/runtime/chan.c
@@ -39,7 +39,6 @@
uintgo dataqsiz; // size of the circular q
uint16 elemsize;
bool closed;
- uint8 elemalign;
Alg* elemalg; // interface for element type
uintgo sendx; // send index
uintgo recvx; // receive index
@@ -93,7 +92,6 @@
runtime·makechan_c(ChanType *t, int64 hint)
{
Hchan *c;
- uintptr n;
Type *elem;
elem = t->elem;
@@ -105,22 +103,19 @@
if(hint < 0 || (intgo)hint != hint || (elem->size > 0 && hint > MaxMem /
elem->size))
runtime·panicstring("makechan: size out of range");
- // calculate rounded size of Hchan
- n = sizeof(*c);
- while(n & MAXALIGN)
- n++;
+ if(sizeof(*c)&MAXALIGN)
+ runtime·throw("makechan: bad chan size");
// allocate memory in one call
- c = (Hchan*)runtime·mal(n + hint*elem->size);
+ c = (Hchan*)runtime·mal(sizeof(*c) + hint*elem->size);
c->elemsize = elem->size;
c->elemalg = elem->alg;
- c->elemalign = elem->align;
c->dataqsiz = hint;
runtime·settype(c, (uintptr)t | TypeInfo_Chan);
if(debug)
- runtime·printf("makechan: chan=%p; elemsize=%D; elemalg=%p;
elemalign=%d; dataqsiz=%D\n",
- c, (int64)elem->size, elem->alg, elem->align, (int64)c->dataqsiz);
+ runtime·printf("makechan: chan=%p; elemsize=%D; elemalg=%p;
dataqsiz=%D\n",
+ c, (int64)elem->size, elem->alg, (int64)c->dataqsiz);
return c;
}