summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--6/gen.c1
-rw-r--r--6/genp9.c25
-rw-r--r--lib/std/env+plan9.myr4
-rw-r--r--lib/std/wait+plan9.myr1
-rw-r--r--mi/cfg.c2
-rwxr-xr-xmk/bootstrap/bootstrap+Plan9-amd64.sh5
-rw-r--r--parse/gram.y2
-rw-r--r--parse/node.c2
8 files changed, 24 insertions, 18 deletions
diff --git a/6/gen.c b/6/gen.c
index 25df139..036edbf 100644
--- a/6/gen.c
+++ b/6/gen.c
@@ -138,6 +138,7 @@ char *tydescid(char *buf, size_t bufsz, Type *ty)
p += bprintf(p, end - p, "_tydesc$%s%s%s$%d", ns, sep, ty->name->name.name, ty->tid);
for (i = 0; i < ty->narg; i++)
p += tyidfmt(p, end - p, ty->arg[i]);
+ printf("gen %s => %s\n", tystr(ty), buf);
} else {
if (file->file.globls->name) {
ns = file->file.globls->name;
diff --git a/6/genp9.c b/6/genp9.c
index 5d9a27e..0757581 100644
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -226,7 +226,7 @@ static size_t writebytes(FILE *fd, char *name, size_t off, char *p, size_t sz)
for (i = 0; i < sz; i++) {
len = min(sz - i, 8);
if (i % 8 == 0)
- fprintf(fd, "DATA %s+%zd(SB)/%zd,$\"", name, off + i, len);
+ fprintf(fd, "\tDATA %s+%zd(SB)/%zd,$\"", name, off + i, len);
if (p[i] == '"' || p[i] == '\\')
fprintf(fd, "\\");
if (isprint(p[i]))
@@ -286,7 +286,7 @@ static size_t encodemin(FILE *fd, uint64_t val, size_t off, char *lbl)
uint8_t b;
if (val < 128) {
- fprintf(fd, "\tDATA %s+%zd(SB)/1,$%zd\n", lbl, off, val);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$%zd //x\n", lbl, off, val);
return 1;
}
@@ -302,7 +302,7 @@ static size_t encodemin(FILE *fd, uint64_t val, size_t off, char *lbl)
val >>= shift;
while (val != 0) {
n++;
- fprintf(fd, "\tDATA %s+%zd(SB)/1,$%u\n", lbl, off+n, (uint)val & 0xff);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$%u// y\n", lbl, off+n, (uint)val & 0xff);
val >>= 8;
}
return i;
@@ -317,19 +317,19 @@ static size_t writeblob(FILE *fd, Blob *b, size_t off, char *lbl)
return 0;
switch (b->type) {
case Bti8:
- fprintf(fd, "DATA %s+%zd(SB)/1,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$%zd\n", lbl, off+n, b->ival);
n += 1;
break;
case Bti16:
- fprintf(fd, "DATA %s+%zd(SB)/2,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/2,$%zd\n", lbl, off+n, b->ival);
n += 2;
break;
case Bti32:
- fprintf(fd, "DATA %s+%zd(SB)/4,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/4,$%zd\n", lbl, off+n, b->ival);
n += 4;
break;
case Bti64:
- fprintf(fd, "DATA %s+%zd(SB)/8,$%lld\n", lbl, off+n, (vlong)b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/8,$%lld\n", lbl, off+n, (vlong)b->ival);
n += 8;
break;
case Btimin:
@@ -337,10 +337,10 @@ static size_t writeblob(FILE *fd, Blob *b, size_t off, char *lbl)
break;
case Btref:
if (b->ref.isextern || b->ref.str[0] == '.')
- fprintf(fd, "DATA %s+%zd(SB)/8,$%s+%zd(SB)\n",
+ fprintf(fd, "\tDATA %s+%zd(SB)/8,$%s+%zd(SB)\n",
lbl, off+n, b->ref.str, b->ref.off);
else
- fprintf(fd, "DATA %s+%zd(SB)/8,$%s<>+%zd(SB)\n",
+ fprintf(fd, "\tDATA %s+%zd(SB)/8,$%s<>+%zd(SB)\n",
lbl, off+n, b->ref.str, b->ref.off);
n += 8;
break;
@@ -353,7 +353,7 @@ static size_t writeblob(FILE *fd, Blob *b, size_t off, char *lbl)
break;
case Btpad:
for (i = 0; i < b->npad; i++)
- fprintf(fd, "DATA %s+%zd(SB)/1,$0\n", lbl, off+n+i);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$0\n", lbl, off+n+i);
n += b->npad;
break;
}
@@ -452,6 +452,7 @@ void genp9(Node *file, char *out)
case Nimpl:
break;
case Ndecl:
+ n = flattenfn(n);
simpglobl(n, globls, &fn, &nfn, &blob, &nblob);
break;
default:
@@ -471,8 +472,10 @@ void genp9(Node *file, char *out)
for (i = 0; i < nfn; i++)
genfunc(fd, fn[i], globls, strtab);
for (i = 0; i < ntypes; i++)
- if (types[i]->isreflect && !types[i]->isimport)
+ if (types[i]->isreflect && !types[i]->isimport) {
gentype(fd, types[i]);
+ printf("gen %s\n", tystr(types[i]));
+ }
fprintf(fd, "\n");
genstrings(fd, strtab);
diff --git a/lib/std/env+plan9.myr b/lib/std/env+plan9.myr
index 79c27ac..2c54eea 100644
--- a/lib/std/env+plan9.myr
+++ b/lib/std/env+plan9.myr
@@ -42,8 +42,8 @@ const getenv = {name
| `Fail m: -> `None
| `Ok data:
data = cstrconv(data)
- envkey = slpush(envkey, sldup(data))
- envval = slpush(envval, data)
+ slpush(&envkey, sldup(data))
+ slpush(&envval, data)
-> `Some data
;;
;;
diff --git a/lib/std/wait+plan9.myr b/lib/std/wait+plan9.myr
index 60d1134..5d22aea 100644
--- a/lib/std/wait+plan9.myr
+++ b/lib/std/wait+plan9.myr
@@ -10,6 +10,7 @@ use "htab"
use "intparse"
use "option"
use "strsplit"
+use "striter"
use "syswrap"
use "utf"
diff --git a/mi/cfg.c b/mi/cfg.c
index 2009960..5405cd4 100644
--- a/mi/cfg.c
+++ b/mi/cfg.c
@@ -215,7 +215,7 @@ Cfg *mkcfg(Node *fn, Node **nl, size_t nn)
}
}
post = mkbb(cfg);
- bprintf(buf, sizeof buf, ".Lret.%d", nextret++);
+ bprintf(buf, sizeof buf, ".Lret%d", nextret++);
label(cfg, mklbl(fn->loc, buf), post);
cfg->start = pre;
diff --git a/mk/bootstrap/bootstrap+Plan9-amd64.sh b/mk/bootstrap/bootstrap+Plan9-amd64.sh
index 41f766a..1d412b5 100755
--- a/mk/bootstrap/bootstrap+Plan9-amd64.sh
+++ b/mk/bootstrap/bootstrap+Plan9-amd64.sh
@@ -19,6 +19,7 @@ echo $pwd/6/6.out -I ../sys -I . cstrconv.myr ; $pwd/6/6.out -I ../sys -I . cst
echo $pwd/6/6.out -I ../sys -I . strfind.myr ; $pwd/6/6.out -I ../sys -I . strfind.myr
echo $pwd/6/6.out -I ../sys -I . syswrap+plan9.myr ; $pwd/6/6.out -I ../sys -I . syswrap+plan9.myr
echo $pwd/6/6.out -I ../sys -I . die.myr ; $pwd/6/6.out -I ../sys -I . die.myr
+echo $pwd/6/6.out -I ../sys -I . striter.myr ; $pwd/6/6.out -I ../sys -I . striter.myr
echo $pwd/6/6.out -I ../sys -I . sleq.myr ; $pwd/6/6.out -I ../sys -I . sleq.myr
echo $pwd/6/6.out -I ../sys -I . hassuffix.myr ; $pwd/6/6.out -I ../sys -I . hassuffix.myr
echo $pwd/6/6.out -I ../sys -I . extremum.myr ; $pwd/6/6.out -I ../sys -I . extremum.myr
@@ -82,8 +83,8 @@ echo $pwd/6/6.out -I ../sys -I . getcwd.myr ; $pwd/6/6.out -I ../sys -I . getcw
echo $pwd/6/6.out -I ../sys -I . swap.myr ; $pwd/6/6.out -I ../sys -I . swap.myr
echo $pwd/6/6.out -I ../sys -I . dial+plan9.myr ; $pwd/6/6.out -I ../sys -I . dial+plan9.myr
echo 6a -o memops-impl.6 memops-impl+plan9-x64.s ; 6a -o memops-impl.6 memops-impl+plan9-x64.s
-echo $pwd/muse/6.out -o std fmtfuncs.use fmt.use try.use pathjoin.use strjoin.use syswrap-ss.use sljoin.use slpush.use strstrip.use htab.use now.use getcwd.use rand.use env.use slurp.use varargs.use strbuf.use clear.use slput.use strsplit.use introspect.use resolve.use alloc.use optparse.use memops.use fltbits.use sldup.use fltfmt.use extremum.use option.use slcp.use writeall.use putint.use sort.use blat.use mk.use errno.use hassuffix.use execvp.use swap.use ipparse.use types.use slpop.use strfind.use utf.use cstrconv.use search.use die.use units.use wait.use result.use bitset.use intparse.use hasprefix.use mkpath.use getint.use syswrap.use dirname.use sleq.use endian.use spork.use dial.use assert.use cmp.use chartype.use bigint.use hashfuncs.use slfill.use fndup.use ; $pwd/muse/6.out -o std fmtfuncs.use fmt.use try.use pathjoin.use strjoin.use syswrap-ss.use sljoin.use slpush.use strstrip.use htab.use now.use getcwd.use rand.use env.use slurp.use varargs.use strbuf.use clear.use slput.use strsplit.use introspect.use resolve.use alloc.use optparse.use memops.use fltbits.use sldup.use fltfmt.use extremum.use option.use slcp.use writeall.use putint.use sort.use blat.use mk.use errno.use hassuffix.use execvp.use swap.use ipparse.use types.use slpop.use strfind.use utf.use cstrconv.use search.use die.use units.use wait.use result.use bitset.use intparse.use hasprefix.use mkpath.use getint.use syswrap.use dirname.use sleq.use endian.use spork.use dial.use assert.use cmp.use chartype.use bigint.use hashfuncs.use slfill.use fndup.use mktemp.use
-echo ar vu libstd.a fmtfuncs.6 fmt.6 try.6 pathjoin.6 strjoin.6 syswrap-ss.6 sljoin.6 slpush.6 strstrip.6 htab.6 now.6 getcwd.6 rand.6 env.6 slurp.6 varargs.6 strbuf.6 clear.6 slput.6 strsplit.6 introspect.6 resolve.6 alloc.6 optparse.6 memops.6 fltbits.6 sldup.6 fltfmt.6 extremum.6 option.6 slcp.6 writeall.6 putint.6 sort.6 blat.6 mk.6 errno.6 hassuffix.6 execvp.6 swap.6 ipparse.6 types.6 slpop.6 strfind.6 utf.6 cstrconv.6 search.6 die.6 units.6 wait.6 result.6 bitset.6 intparse.6 hasprefix.6 mkpath.6 getint.6 syswrap.6 dirname.6 sleq.6 endian.6 spork.6 dial.6 assert.6 cmp.6 chartype.6 memops-impl.6 bigint.6 hashfuncs.6 slfill.6 fndup.6 ; ar vu libstd.a fmtfuncs.6 fmt.6 try.6 pathjoin.6 strjoin.6 syswrap-ss.6 sljoin.6 slpush.6 strstrip.6 htab.6 now.6 getcwd.6 rand.6 env.6 slurp.6 varargs.6 strbuf.6 clear.6 slput.6 strsplit.6 introspect.6 resolve.6 alloc.6 optparse.6 memops.6 fltbits.6 sldup.6 fltfmt.6 extremum.6 option.6 slcp.6 writeall.6 putint.6 sort.6 blat.6 mk.6 errno.6 hassuffix.6 execvp.6 swap.6 ipparse.6 types.6 slpop.6 strfind.6 utf.6 cstrconv.6 search.6 die.6 units.6 wait.6 result.6 bitset.6 intparse.6 hasprefix.6 mkpath.6 getint.6 syswrap.6 dirname.6 sleq.6 endian.6 spork.6 dial.6 assert.6 cmp.6 chartype.6 memops-impl.6 bigint.6 hashfuncs.6 slfill.6 fndup.6 mktemp.6
+echo $pwd/muse/6.out -o std fmtfuncs.use fmt.use try.use pathjoin.use strjoin.use syswrap-ss.use sljoin.use slpush.use strstrip.use htab.use now.use getcwd.use rand.use env.use slurp.use varargs.use strbuf.use clear.use slput.use strsplit.use introspect.use resolve.use alloc.use optparse.use memops.use fltbits.use sldup.use fltfmt.use extremum.use option.use slcp.use writeall.use putint.use sort.use blat.use mk.use errno.use hassuffix.use execvp.use swap.use ipparse.use types.use slpop.use strfind.use utf.use cstrconv.use search.use die.use units.use wait.use result.use bitset.use intparse.use hasprefix.use mkpath.use getint.use syswrap.use dirname.use sleq.use endian.use spork.use dial.use assert.use cmp.use chartype.use bigint.use hashfuncs.use slfill.use fndup.use ; $pwd/muse/6.out -o std fmtfuncs.use fmt.use try.use pathjoin.use strjoin.use syswrap-ss.use sljoin.use slpush.use strstrip.use htab.use now.use getcwd.use rand.use env.use slurp.use varargs.use strbuf.use clear.use slput.use strsplit.use introspect.use resolve.use alloc.use optparse.use memops.use fltbits.use sldup.use fltfmt.use extremum.use option.use slcp.use writeall.use putint.use sort.use blat.use mk.use errno.use hassuffix.use execvp.use swap.use ipparse.use types.use slpop.use strfind.use utf.use cstrconv.use search.use die.use units.use wait.use result.use bitset.use intparse.use hasprefix.use mkpath.use getint.use syswrap.use dirname.use sleq.use endian.use spork.use dial.use assert.use cmp.use chartype.use bigint.use striter.use hashfuncs.use slfill.use fndup.use mktemp.use
+echo ar vu libstd.a fmtfuncs.6 fmt.6 try.6 pathjoin.6 strjoin.6 syswrap-ss.6 sljoin.6 slpush.6 strstrip.6 htab.6 now.6 getcwd.6 rand.6 env.6 slurp.6 varargs.6 strbuf.6 clear.6 slput.6 strsplit.6 introspect.6 resolve.6 alloc.6 optparse.6 memops.6 fltbits.6 sldup.6 fltfmt.6 extremum.6 option.6 slcp.6 writeall.6 putint.6 sort.6 blat.6 mk.6 errno.6 hassuffix.6 execvp.6 swap.6 ipparse.6 types.6 slpop.6 strfind.6 utf.6 cstrconv.6 search.6 die.6 units.6 wait.6 result.6 bitset.6 intparse.6 hasprefix.6 mkpath.6 getint.6 syswrap.6 dirname.6 sleq.6 endian.6 spork.6 dial.6 assert.6 cmp.6 chartype.6 memops-impl.6 bigint.6 hashfuncs.6 slfill.6 fndup.6 ; ar vu libstd.a fmtfuncs.6 fmt.6 try.6 pathjoin.6 strjoin.6 syswrap-ss.6 sljoin.6 slpush.6 strstrip.6 htab.6 now.6 getcwd.6 rand.6 env.6 slurp.6 varargs.6 strbuf.6 clear.6 slput.6 strsplit.6 introspect.6 resolve.6 alloc.6 optparse.6 memops.6 fltbits.6 sldup.6 fltfmt.6 extremum.6 option.6 slcp.6 writeall.6 putint.6 sort.6 blat.6 mk.6 errno.6 hassuffix.6 execvp.6 swap.6 ipparse.6 types.6 slpop.6 strfind.6 utf.6 cstrconv.6 search.6 die.6 units.6 wait.6 result.6 bitset.6 intparse.6 hasprefix.6 mkpath.6 getint.6 syswrap.6 dirname.6 sleq.6 endian.6 spork.6 dial.6 assert.6 cmp.6 chartype.6 memops-impl.6 bigint.6 hashfuncs.6 slfill.6 fndup.6 mktemp.6 striter.6
echo cd $pwd/lib/regex; cd $pwd/lib/regex
echo $pwd/6/6.out -I ../std -I ../sys types.myr ; $pwd/6/6.out -I ../std -I ../sys types.myr
echo $pwd/6/6.out -I ../std -I ../sys interp.myr ; $pwd/6/6.out -I ../std -I ../sys interp.myr
diff --git a/parse/gram.y b/parse/gram.y
index fc29391..c53c763 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -805,7 +805,7 @@ funclit : Tobrace params Tendln blkbody Tcbrace {
fn = $$->lit.fnval;
for (i = 0; i < nlbls; i++) {
lit = lbls[i]->expr.args[0];
- putlbl(fn->func.scope, lbls[i]->lit.lblname, lbls[i]);
+ putlbl(fn->func.scope, lit->lit.lblname, lbls[i]);
}
lfree(&lbls, &nlbls);
}
diff --git a/parse/node.c b/parse/node.c
index 59bfcd2..d4dee5c 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -242,7 +242,7 @@ char *genlblstr(char *buf, size_t sz, char *suffix)
static int nextlbl;
size_t len;
- len = snprintf(buf, 128, ".L%d.%s", nextlbl++, suffix);
+ len = snprintf(buf, 128, ".L%d%s", nextlbl++, suffix);
assert(len <= sz);
return buf;
}