Commit f860bc0f authored by Kai Backman's avatar Kai Backman

fixed len/cap for chan. disable gc for now.

        go/test: passes 93% (323/345)

R=rsc
http://go/go-review/1015006
parent fb39a4d6
......@@ -17,6 +17,10 @@ xcd() {
builtin cd $1
}
# temporarily turn GC off
# TODO(kaib): reenable GC once everything else works
export GOGC=off
(xcd ../test
./run-arm
) || exit $?
......@@ -271,7 +271,7 @@ cgen(Node *n, Node *res)
break;
case OLEN:
if(istype(nl->type, TMAP)) {
if(istype(nl->type, TMAP) || istype(nl->type, TCHAN)) {
// map has len in the first 32-bit word.
// a zero pointer means zero length
regalloc(&n1, types[tptr], res);
......@@ -313,6 +313,31 @@ cgen(Node *n, Node *res)
break;
case OCAP:
if(istype(nl->type, TCHAN)) {
// chan has cap in the second 32-bit word.
// a zero pointer means zero length
regalloc(&n1, types[tptr], res);
cgen(nl, &n1);
nodconst(&n2, types[tptr], 0);
regalloc(&n3, n2.type, N);
gmove(&n2, &n3);
gcmp(optoas(OCMP, types[tptr]), &n1, &n3);
regfree(&n3);
p1 = gbranch(optoas(OEQ, types[tptr]), T);
n2 = n1;
n2.op = OINDREG;
n2.xoffset = 4;
n2.type = types[TINT32];
gmove(&n2, &n1);
patch(p1, pc);
gmove(&n1, res);
regfree(&n1);
break;
}
if(isslice(nl->type)) {
regalloc(&n1, types[tptr], res);
agen(nl, &n1);
......
235.go
64bit.go
args.go
assign.go
......@@ -7,8 +8,11 @@ blank1.go
chan/fifo.go
chan/goroutines.go
chan/perm.go
chan/powser1.go
chan/powser2.go
chan/select.go
chan/sieve.go
chancap.go
char_lit.go
closedchan.go
closure.go
......@@ -256,6 +260,7 @@ interface/returntype.go
interface/struct.go
iota.go
ken/array.go
ken/chan.go
ken/chan1.go
ken/complit.go
ken/divconst.go
......@@ -297,6 +302,7 @@ named.go
named1.go
nil.go
parentype.go
peano.go
printbig.go
range.go
rename.go
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment