summaryrefslogtreecommitdiff
path: root/src/cmd/8l
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-02-01 15:20:19 -0800
committerRuss Cox <rsc@golang.org>2010-02-01 15:20:19 -0800
commit9bd745432a661b2de84bf5b3a07992654352c53b (patch)
treead27650003c4514b164eae388e99bcb2c82a42fa /src/cmd/8l
parent124894c18f26615fb798ac65cc4a1b0dfc1dec18 (diff)
downloadgolang-9bd745432a661b2de84bf5b3a07992654352c53b.tar.gz
nacl: fix build, finally fixed 8l convergence bug
R=r CC=golang-dev http://codereview.appspot.com/199042
Diffstat (limited to 'src/cmd/8l')
-rw-r--r--src/cmd/8l/l.h1
-rw-r--r--src/cmd/8l/span.c13
2 files changed, 10 insertions, 4 deletions
diff --git a/src/cmd/8l/l.h b/src/cmd/8l/l.h
index adc3f4dee..dd559e419 100644
--- a/src/cmd/8l/l.h
+++ b/src/cmd/8l/l.h
@@ -102,6 +102,7 @@ struct Prog
char tt;
uchar mark; /* work on these */
uchar back;
+ uchar bigjmp;
};
struct Auto
diff --git a/src/cmd/8l/span.c b/src/cmd/8l/span.c
index d46f86ff6..f649777ec 100644
--- a/src/cmd/8l/span.c
+++ b/src/cmd/8l/span.c
@@ -73,8 +73,7 @@ start:
if(debug['v'])
Bprint(&bso, "%5.2f span %d\n", cputime(), n);
Bflush(&bso);
- if(n > 500) {
- // TODO(rsc): figure out why nacl takes so long to converge.
+ if(n > 50) {
print("span must be looping - %d\n", textsize);
errorexit();
}
@@ -1183,10 +1182,13 @@ found:
q = p->pcond;
if(q) {
v = q->pc - p->pc - 2;
- if(v >= -128 && v <= 127) {
+ if(q->pc == 0)
+ v = 0;
+ if(v >= -128 && v <= 127 && !p->bigjmp) {
*andptr++ = op;
*andptr++ = v;
} else {
+ p->bigjmp = 1;
v -= 6-2;
*andptr++ = 0x0f;
*andptr++ = o->op[z+1];
@@ -1230,10 +1232,13 @@ found:
q = p->pcond;
if(q) {
v = q->pc - p->pc - 2;
- if(v >= -128 && v <= 127) {
+ if(q->pc == 0)
+ v = 0;
+ if(v >= -128 && v <= 127 && !p->bigjmp) {
*andptr++ = op;
*andptr++ = v;
} else {
+ p->bigjmp = 1;
v -= 5-2;
*andptr++ = o->op[z+1];
*andptr++ = v;