Commit b91cf505 authored by Russ Cox's avatar Russ Cox

cmd/6l, cmd/8l: fix chaining bug in jump rewrite

The code was inconsistent about when it used
brchain(x) and when it used x directly, with the result
that you could end up emitting code for brchain(x) but
leave the jump pointing at an unemitted x.

R=ken2
CC=golang-dev
https://golang.org/cl/6250077
parent 37f046ba
......@@ -192,6 +192,10 @@ loop:
* recurse to follow one path.
* continue loop on the other.
*/
if((q = brchain(p->pcond)) != P)
p->pcond = q;
if((q = brchain(p->link)) != P)
p->link = q;
if(p->from.type == D_CONST) {
if(p->from.offset == 1) {
/*
......@@ -204,8 +208,8 @@ loop:
p->pcond = q;
}
} else {
q = brchain(p->link);
if(q != P && q->mark)
q = p->link;
if(q->mark)
if(a != ALOOP) {
p->as = relinv(a);
p->link = p->pcond;
......@@ -213,12 +217,9 @@ loop:
}
}
xfol(p->link, last);
q = brchain(p->pcond);
if(q->mark) {
p->pcond = q;
if(p->pcond->mark)
return;
}
p = q;
p = p->pcond;
goto loop;
}
p = p->link;
......
......@@ -184,6 +184,10 @@ loop:
* recurse to follow one path.
* continue loop on the other.
*/
if((q = brchain(p->pcond)) != P)
p->pcond = q;
if((q = brchain(p->link)) != P)
p->link = q;
if(p->from.type == D_CONST) {
if(p->from.offset == 1) {
/*
......@@ -196,8 +200,8 @@ loop:
p->pcond = q;
}
} else {
q = brchain(p->link);
if(q != P && q->mark)
q = p->link;
if(q->mark)
if(a != ALOOP) {
p->as = relinv(a);
p->link = p->pcond;
......@@ -205,12 +209,9 @@ loop:
}
}
xfol(p->link, last);
q = brchain(p->pcond);
if(q->mark) {
p->pcond = q;
if(p->pcond->mark)
return;
}
p = q;
p = p->pcond;
goto loop;
}
p = p->link;
......
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