]> Cypherpunks repositories - gostls13.git/commitdiff
fixed len/cap for chan. disable gc for now.
authorKai Backman <kaib@golang.org>
Sat, 24 Oct 2009 03:31:03 +0000 (20:31 -0700)
committerKai Backman <kaib@golang.org>
Sat, 24 Oct 2009 03:31:03 +0000 (20:31 -0700)
        go/test: passes 93% (323/345)

R=rsc
http://go/go-review/1015006

src/all-arm.bash
src/cmd/5g/cgen.c
test/arm-pass.txt

index 81cba295e93160074c2830653d33cadd1b40fa89..0bf9927af24412c74be8698877ba72b66d124035 100755 (executable)
@@ -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 $?
index 347a530f008de3401a6adb17bd25ab44648d40e8..b6190c256d5c74320970d06eb64cb39a94dc11ba 100644 (file)
@@ -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);
index e0d2822fe704db4c42c4c9efbd47c39af861db9d..64f4b544be66cf55bfcf1410d329f3eee3c30984 100644 (file)
@@ -1,3 +1,4 @@
+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