From: Shenghou Ma Date: Tue, 31 Jan 2012 15:59:34 +0000 (-0500) Subject: 5l: optimize the common case in patch() X-Git-Tag: weekly.2012-02-07~180 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2d64bab1ded3c17d1e73ee1dcacf1aafae223317;p=gostls13.git 5l: optimize the common case in patch() If p->to.sym->text is non-nil, then no need to search for sym->value. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5601046 --- diff --git a/src/cmd/5l/pass.c b/src/cmd/5l/pass.c index c430494597..0f2afbd850 100644 --- a/src/cmd/5l/pass.c +++ b/src/cmd/5l/pass.c @@ -213,6 +213,8 @@ patch(void) if((a == ABL || a == ABX || a == AB || a == ARET) && p->to.type != D_BRANCH && p->to.sym != S) { s = p->to.sym; + if(s->text == nil) + continue; switch(s->type) { default: diag("undefined: %s", s->name); @@ -222,7 +224,8 @@ patch(void) case STEXT: p->to.offset = s->value; p->to.type = D_BRANCH; - break; + p->cond = s->text; + continue; } } if(p->to.type != D_BRANCH)