mirror of
https://github.com/golang/go
synced 2024-11-21 15:54:43 -07:00
libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/Bputc
Also introduce BGET2/4, BPUT2/4 as they are widely used. Slightly improve BGETC/BPUTC implementation. This gives ~5% CPU time improvement on go install -a -p1 std. Before: real user sys 0m23.561s 0m16.625s 0m5.848s 0m23.766s 0m16.624s 0m5.846s 0m23.742s 0m16.621s 0m5.868s after: 0m22.999s 0m15.841s 0m5.889s 0m22.845s 0m15.808s 0m5.850s 0m22.889s 0m15.832s 0m5.848s R=golang-dev, r CC=golang-dev https://golang.org/cl/12745047
This commit is contained in:
parent
2df3d80037
commit
79dca0327e
@ -70,10 +70,28 @@ struct Biobuf
|
|||||||
unsigned char b[Bungetsize+Bsize];
|
unsigned char b[Bungetsize+Bsize];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros get 1-, 2-, and 4-byte integer values by reading the
|
||||||
|
* next few bytes in little-endian order.
|
||||||
|
*/
|
||||||
#define BGETC(bp)\
|
#define BGETC(bp)\
|
||||||
((bp)->icount?(bp)->bbuf[(bp)->bsize+(bp)->icount++]:Bgetc((bp)))
|
((bp)->icount?(bp)->ebuf[(bp)->icount++]:Bgetc((bp)))
|
||||||
|
#define BGETLE2(bp)\
|
||||||
|
((bp)->icount<=-2?((bp)->icount+=2,((bp)->ebuf[(bp)->icount-2])|((bp)->ebuf[(bp)->icount-1]<<8)):Bgetle2((bp)))
|
||||||
|
#define BGETLE4(bp)\
|
||||||
|
((bp)->icount<=-4?((bp)->icount+=4,((bp)->ebuf[(bp)->icount-4])|((bp)->ebuf[(bp)->icount-3]<<8)|((bp)->ebuf[(bp)->icount-2]<<16)|((bp)->ebuf[(bp)->icount-1]<<24)):Bgetle4((bp)))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros put 1-, 2-, and 4-byte integer values by writing the
|
||||||
|
* next few bytes in little-endian order.
|
||||||
|
*/
|
||||||
#define BPUTC(bp,c)\
|
#define BPUTC(bp,c)\
|
||||||
((bp)->ocount?(bp)->bbuf[(bp)->bsize+(bp)->ocount++]=(c),0:Bputc((bp),(c)))
|
((bp)->ocount?(bp)->ebuf[(bp)->ocount++]=(unsigned char)(c),0:Bputc((bp),(c)))
|
||||||
|
#define BPUTLE2(bp,c)\
|
||||||
|
((bp)->ocount<=-2?(bp)->ocount+=2,(bp)->ebuf[(bp)->ocount-2]=(unsigned char)(c),(bp)->ebuf[(bp)->ocount-1]=(unsigned char)(c>>8),0:Bputle2((bp),(c)))
|
||||||
|
#define BPUTLE4(bp,c)\
|
||||||
|
((bp)->ocount<=-4?(bp)->ocount+=4,(bp)->ebuf[(bp)->ocount-4]=(unsigned char)(c),(bp)->ebuf[(bp)->ocount-3]=(unsigned char)(c>>8),(bp)->ebuf[(bp)->ocount-2]=(unsigned char)(c>>16),(bp)->ebuf[(bp)->ocount-1]=(unsigned char)(c>>24),0:Bputle4((bp),(c)))
|
||||||
|
|
||||||
#define BOFFSET(bp)\
|
#define BOFFSET(bp)\
|
||||||
(((bp)->state==Bractive)?\
|
(((bp)->state==Bractive)?\
|
||||||
(bp)->offset + (bp)->icount:\
|
(bp)->offset + (bp)->icount:\
|
||||||
@ -90,6 +108,8 @@ Biobuf* Bfdopen(int, int);
|
|||||||
int Bfildes(Biobuf*);
|
int Bfildes(Biobuf*);
|
||||||
int Bflush(Biobuf*);
|
int Bflush(Biobuf*);
|
||||||
int Bgetc(Biobuf*);
|
int Bgetc(Biobuf*);
|
||||||
|
int Bgetle2(Biobuf*);
|
||||||
|
int Bgetle4(Biobuf*);
|
||||||
int Bgetd(Biobuf*, double*);
|
int Bgetd(Biobuf*, double*);
|
||||||
long Bgetrune(Biobuf*);
|
long Bgetrune(Biobuf*);
|
||||||
int Binit(Biobuf*, int, int);
|
int Binit(Biobuf*, int, int);
|
||||||
@ -99,6 +119,8 @@ vlong Boffset(Biobuf*);
|
|||||||
Biobuf* Bopen(char*, int);
|
Biobuf* Bopen(char*, int);
|
||||||
int Bprint(Biobuf*, char*, ...);
|
int Bprint(Biobuf*, char*, ...);
|
||||||
int Bputc(Biobuf*, int);
|
int Bputc(Biobuf*, int);
|
||||||
|
int Bputle2(Biobuf*, int);
|
||||||
|
int Bputle4(Biobuf*, int);
|
||||||
int Bputrune(Biobuf*, long);
|
int Bputrune(Biobuf*, long);
|
||||||
void* Brdline(Biobuf*, int);
|
void* Brdline(Biobuf*, int);
|
||||||
char* Brdstr(Biobuf*, int, int);
|
char* Brdstr(Biobuf*, int, int);
|
||||||
|
@ -485,14 +485,14 @@ void
|
|||||||
zname(char *n, int t, int s)
|
zname(char *n, int t, int s)
|
||||||
{
|
{
|
||||||
|
|
||||||
Bputc(&obuf, ANAME);
|
BPUTC(&obuf, ANAME);
|
||||||
Bputc(&obuf, t); /* type */
|
BPUTC(&obuf, t); /* type */
|
||||||
Bputc(&obuf, s); /* sym */
|
BPUTC(&obuf, s); /* sym */
|
||||||
while(*n) {
|
while(*n) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -503,11 +503,11 @@ zaddr(Gen *a, int s)
|
|||||||
char *n;
|
char *n;
|
||||||
Ieee e;
|
Ieee e;
|
||||||
|
|
||||||
Bputc(&obuf, a->type);
|
BPUTC(&obuf, a->type);
|
||||||
Bputc(&obuf, a->reg);
|
BPUTC(&obuf, a->reg);
|
||||||
Bputc(&obuf, s);
|
BPUTC(&obuf, s);
|
||||||
Bputc(&obuf, a->name);
|
BPUTC(&obuf, a->name);
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
switch(a->type) {
|
switch(a->type) {
|
||||||
default:
|
default:
|
||||||
print("unknown type %d\n", a->type);
|
print("unknown type %d\n", a->type);
|
||||||
@ -522,45 +522,33 @@ zaddr(Gen *a, int s)
|
|||||||
|
|
||||||
case D_REGREG:
|
case D_REGREG:
|
||||||
case D_REGREG2:
|
case D_REGREG2:
|
||||||
Bputc(&obuf, a->offset);
|
BPUTC(&obuf, a->offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_CONST2:
|
case D_CONST2:
|
||||||
l = a->offset2;
|
l = a->offset2;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
// fall through
|
// fall through
|
||||||
case D_OREG:
|
case D_OREG:
|
||||||
case D_CONST:
|
case D_CONST:
|
||||||
case D_BRANCH:
|
case D_BRANCH:
|
||||||
case D_SHIFT:
|
case D_SHIFT:
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_SCONST:
|
case D_SCONST:
|
||||||
n = a->sval;
|
n = a->sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_FCONST:
|
case D_FCONST:
|
||||||
ieeedtod(&e, a->dval);
|
ieeedtod(&e, a->dval);
|
||||||
Bputc(&obuf, e.l);
|
BPUTLE4(&obuf, e.l);
|
||||||
Bputc(&obuf, e.l>>8);
|
BPUTLE4(&obuf, e.h);
|
||||||
Bputc(&obuf, e.l>>16);
|
|
||||||
Bputc(&obuf, e.l>>24);
|
|
||||||
Bputc(&obuf, e.h);
|
|
||||||
Bputc(&obuf, e.h>>8);
|
|
||||||
Bputc(&obuf, e.h>>16);
|
|
||||||
Bputc(&obuf, e.h>>24);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -642,13 +630,10 @@ jackpot:
|
|||||||
goto jackpot;
|
goto jackpot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, a);
|
BPUTC(&obuf, a);
|
||||||
Bputc(&obuf, scond);
|
BPUTC(&obuf, scond);
|
||||||
Bputc(&obuf, reg);
|
BPUTC(&obuf, reg);
|
||||||
Bputc(&obuf, stmtline);
|
BPUTLE4(&obuf, stmtline);
|
||||||
Bputc(&obuf, stmtline>>8);
|
|
||||||
Bputc(&obuf, stmtline>>16);
|
|
||||||
Bputc(&obuf, stmtline>>24);
|
|
||||||
zaddr(g1, sf);
|
zaddr(g1, sf);
|
||||||
zaddr(g2, st);
|
zaddr(g2, st);
|
||||||
|
|
||||||
@ -722,12 +707,12 @@ outhist(void)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(&obuf, ANAME);
|
BPUTC(&obuf, ANAME);
|
||||||
Bputc(&obuf, D_FILE); /* type */
|
BPUTC(&obuf, D_FILE); /* type */
|
||||||
Bputc(&obuf, 1); /* sym */
|
BPUTC(&obuf, 1); /* sym */
|
||||||
Bputc(&obuf, '<');
|
BPUTC(&obuf, '<');
|
||||||
Bwrite(&obuf, p, n);
|
Bwrite(&obuf, p, n);
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
@ -737,13 +722,10 @@ outhist(void)
|
|||||||
}
|
}
|
||||||
g.offset = h->offset;
|
g.offset = h->offset;
|
||||||
|
|
||||||
Bputc(&obuf, AHISTORY);
|
BPUTC(&obuf, AHISTORY);
|
||||||
Bputc(&obuf, Always);
|
BPUTC(&obuf, Always);
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
Bputc(&obuf, h->line);
|
BPUTLE4(&obuf, h->line);
|
||||||
Bputc(&obuf, h->line>>8);
|
|
||||||
Bputc(&obuf, h->line>>16);
|
|
||||||
Bputc(&obuf, h->line>>24);
|
|
||||||
zaddr(&nullgen, 0);
|
zaddr(&nullgen, 0);
|
||||||
zaddr(&g, 0);
|
zaddr(&g, 0);
|
||||||
|
|
||||||
|
@ -525,12 +525,12 @@ outhist(Biobuf *b)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(b, ANAME);
|
BPUTC(b, ANAME);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, 1);
|
BPUTC(b, 1);
|
||||||
Bputc(b, '<');
|
BPUTC(b, '<');
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
void
|
void
|
||||||
zname(Biobuf *b, Sym *s, int t)
|
zname(Biobuf *b, Sym *s, int t)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME); /* as */
|
BPUTC(b, ANAME); /* as */
|
||||||
Bputc(b, t); /* type */
|
BPUTC(b, t); /* type */
|
||||||
Bputc(b, s->sym); /* sym */
|
BPUTC(b, s->sym); /* sym */
|
||||||
|
|
||||||
Bputname(b, s);
|
Bputname(b, s);
|
||||||
}
|
}
|
||||||
@ -45,12 +45,12 @@ zname(Biobuf *b, Sym *s, int t)
|
|||||||
void
|
void
|
||||||
zfile(Biobuf *b, char *p, int n)
|
zfile(Biobuf *b, char *p, int n)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME);
|
BPUTC(b, ANAME);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, 1);
|
BPUTC(b, 1);
|
||||||
Bputc(b, '<');
|
BPUTC(b, '<');
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -58,13 +58,10 @@ zhist(Biobuf *b, int line, vlong offset)
|
|||||||
{
|
{
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
Bputc(b, AHISTORY);
|
BPUTC(b, AHISTORY);
|
||||||
Bputc(b, C_SCOND_NONE);
|
BPUTC(b, C_SCOND_NONE);
|
||||||
Bputc(b, NREG);
|
BPUTC(b, NREG);
|
||||||
Bputc(b, line);
|
BPUTLE4(b, line);
|
||||||
Bputc(b, line>>8);
|
|
||||||
Bputc(b, line>>16);
|
|
||||||
Bputc(b, line>>24);
|
|
||||||
zaddr(b, &zprog.from, 0, 0);
|
zaddr(b, &zprog.from, 0, 0);
|
||||||
a = zprog.to;
|
a = zprog.to;
|
||||||
if(offset != 0) {
|
if(offset != 0) {
|
||||||
@ -91,11 +88,11 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
fatal("We should no longer generate these as types");
|
fatal("We should no longer generate these as types");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Bputc(b, a->type);
|
BPUTC(b, a->type);
|
||||||
Bputc(b, a->reg);
|
BPUTC(b, a->reg);
|
||||||
Bputc(b, s);
|
BPUTC(b, s);
|
||||||
Bputc(b, a->name);
|
BPUTC(b, a->name);
|
||||||
Bputc(b, gotype);
|
BPUTC(b, gotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(a->type) {
|
switch(a->type) {
|
||||||
@ -110,10 +107,7 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
|
|
||||||
case D_CONST2:
|
case D_CONST2:
|
||||||
l = a->offset2;
|
l = a->offset2;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l); // fall through
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24); // fall through
|
|
||||||
case D_OREG:
|
case D_OREG:
|
||||||
case D_CONST:
|
case D_CONST:
|
||||||
case D_SHIFT:
|
case D_SHIFT:
|
||||||
@ -122,10 +116,7 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
case D_EXTERN:
|
case D_EXTERN:
|
||||||
case D_PARAM:
|
case D_PARAM:
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_BRANCH:
|
case D_BRANCH:
|
||||||
@ -133,37 +124,26 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
fatal("unpatched branch");
|
fatal("unpatched branch");
|
||||||
a->offset = a->u.branch->loc;
|
a->offset = a->u.branch->loc;
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_SCONST:
|
case D_SCONST:
|
||||||
n = a->u.sval;
|
n = a->u.sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_REGREG:
|
case D_REGREG:
|
||||||
case D_REGREG2:
|
case D_REGREG2:
|
||||||
Bputc(b, a->offset);
|
BPUTC(b, a->offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_FCONST:
|
case D_FCONST:
|
||||||
ieeedtod(&e, a->u.dval);
|
ieeedtod(&e, a->u.dval);
|
||||||
l = e;
|
BPUTLE4(b, e);
|
||||||
Bputc(b, l);
|
BPUTLE4(b, e >> 32);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
l = e >> 32;
|
|
||||||
Bputc(b, l);
|
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,13 +251,10 @@ dumpfuncs(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bputc(bout, p->as);
|
BPUTC(bout, p->as);
|
||||||
Bputc(bout, p->scond);
|
BPUTC(bout, p->scond);
|
||||||
Bputc(bout, p->reg);
|
BPUTC(bout, p->reg);
|
||||||
Bputc(bout, p->lineno);
|
BPUTLE4(bout, p->lineno);
|
||||||
Bputc(bout, p->lineno>>8);
|
|
||||||
Bputc(bout, p->lineno>>16);
|
|
||||||
Bputc(bout, p->lineno>>24);
|
|
||||||
zaddr(bout, &p->from, sf, gf);
|
zaddr(bout, &p->from, sf, gf);
|
||||||
zaddr(bout, &p->to, st, gt);
|
zaddr(bout, &p->to, st, gt);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
c = BGETC(f);
|
c = BGETC(f);
|
||||||
if(c < 0 || c > NSYM){
|
if(c < 0 || c > NSYM){
|
||||||
print("sym out of range: %d\n", c);
|
print("sym out of range: %d\n", c);
|
||||||
Bputc(f, ALAST+1);
|
BPUTC(f, ALAST+1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a->sym = h[c];
|
a->sym = h[c];
|
||||||
@ -343,7 +343,7 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
|
|
||||||
if((schar)a->reg < 0 || a->reg > NREG) {
|
if((schar)a->reg < 0 || a->reg > NREG) {
|
||||||
print("register out of range %d\n", a->reg);
|
print("register out of range %d\n", a->reg);
|
||||||
Bputc(f, ALAST+1);
|
BPUTC(f, ALAST+1);
|
||||||
return; /* force real diagnostic */
|
return; /* force real diagnostic */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
switch(a->type) {
|
switch(a->type) {
|
||||||
default:
|
default:
|
||||||
print("unknown type %d\n", a->type);
|
print("unknown type %d\n", a->type);
|
||||||
Bputc(f, ALAST+1);
|
BPUTC(f, ALAST+1);
|
||||||
return; /* force real diagnostic */
|
return; /* force real diagnostic */
|
||||||
|
|
||||||
case D_NONE:
|
case D_NONE:
|
||||||
@ -377,13 +377,13 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case D_CONST2:
|
case D_CONST2:
|
||||||
a->offset2 = Bget4(f); // fall through
|
a->offset2 = BGETLE4(f); // fall through
|
||||||
case D_BRANCH:
|
case D_BRANCH:
|
||||||
case D_OREG:
|
case D_OREG:
|
||||||
case D_CONST:
|
case D_CONST:
|
||||||
case D_OCONST:
|
case D_OCONST:
|
||||||
case D_SHIFT:
|
case D_SHIFT:
|
||||||
a->offset = Bget4(f);
|
a->offset = BGETLE4(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D_SCONST:
|
case D_SCONST:
|
||||||
@ -392,8 +392,8 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case D_FCONST:
|
case D_FCONST:
|
||||||
a->ieee.l = Bget4(f);
|
a->ieee.l = BGETLE4(f);
|
||||||
a->ieee.h = Bget4(f);
|
a->ieee.h = BGETLE4(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s = a->sym;
|
s = a->sym;
|
||||||
@ -476,7 +476,7 @@ loop:
|
|||||||
if(o == ANAME || o == ASIGNAME) {
|
if(o == ANAME || o == ASIGNAME) {
|
||||||
sig = 0;
|
sig = 0;
|
||||||
if(o == ASIGNAME)
|
if(o == ASIGNAME)
|
||||||
sig = Bget4(f);
|
sig = BGETLE4(f);
|
||||||
v = BGETC(f); /* type */
|
v = BGETC(f); /* type */
|
||||||
o = BGETC(f); /* sym */
|
o = BGETC(f); /* sym */
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -531,7 +531,7 @@ loop:
|
|||||||
p->as = o;
|
p->as = o;
|
||||||
p->scond = BGETC(f);
|
p->scond = BGETC(f);
|
||||||
p->reg = BGETC(f);
|
p->reg = BGETC(f);
|
||||||
p->line = Bget4(f);
|
p->line = BGETLE4(f);
|
||||||
|
|
||||||
zaddr(pn, f, &p->from, h);
|
zaddr(pn, f, &p->from, h);
|
||||||
fromgotype = adrgotype;
|
fromgotype = adrgotype;
|
||||||
|
@ -1101,15 +1101,14 @@ void
|
|||||||
zname(char *n, int t, int s)
|
zname(char *n, int t, int s)
|
||||||
{
|
{
|
||||||
|
|
||||||
Bputc(&obuf, ANAME); /* as(2) */
|
BPUTLE2(&obuf, ANAME); /* as(2) */
|
||||||
Bputc(&obuf, ANAME>>8);
|
BPUTC(&obuf, t); /* type */
|
||||||
Bputc(&obuf, t); /* type */
|
BPUTC(&obuf, s); /* sym */
|
||||||
Bputc(&obuf, s); /* sym */
|
|
||||||
while(*n) {
|
while(*n) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1145,52 +1144,40 @@ zaddr(Gen *a, int s)
|
|||||||
case D_NONE:
|
case D_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, t);
|
BPUTC(&obuf, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(&obuf, a->index);
|
BPUTC(&obuf, a->index);
|
||||||
Bputc(&obuf, a->scale);
|
BPUTC(&obuf, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
if(t & T_64) {
|
if(t & T_64) {
|
||||||
l = a->offset>>32;
|
l = a->offset>>32;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(&obuf, s);
|
BPUTC(&obuf, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->dval);
|
ieeedtod(&e, a->dval);
|
||||||
l = e.l;
|
l = e.l;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
l = e.h;
|
l = e.h;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->sval;
|
n = a->sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(&obuf, a->type);
|
BPUTC(&obuf, a->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1249,12 +1236,8 @@ jackpot:
|
|||||||
goto jackpot;
|
goto jackpot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, a);
|
BPUTLE2(&obuf, a);
|
||||||
Bputc(&obuf, a>>8);
|
BPUTLE4(&obuf, stmtline);
|
||||||
Bputc(&obuf, stmtline);
|
|
||||||
Bputc(&obuf, stmtline>>8);
|
|
||||||
Bputc(&obuf, stmtline>>16);
|
|
||||||
Bputc(&obuf, stmtline>>24);
|
|
||||||
zaddr(&g2->from, sf);
|
zaddr(&g2->from, sf);
|
||||||
zaddr(&g2->to, st);
|
zaddr(&g2->to, st);
|
||||||
|
|
||||||
@ -1329,13 +1312,12 @@ outhist(void)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(&obuf, ANAME);
|
BPUTLE2(&obuf, ANAME);
|
||||||
Bputc(&obuf, ANAME>>8);
|
BPUTC(&obuf, D_FILE); /* type */
|
||||||
Bputc(&obuf, D_FILE); /* type */
|
BPUTC(&obuf, 1); /* sym */
|
||||||
Bputc(&obuf, 1); /* sym */
|
BPUTC(&obuf, '<');
|
||||||
Bputc(&obuf, '<');
|
|
||||||
Bwrite(&obuf, p, n);
|
Bwrite(&obuf, p, n);
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
@ -1345,12 +1327,8 @@ outhist(void)
|
|||||||
}
|
}
|
||||||
g.offset = h->offset;
|
g.offset = h->offset;
|
||||||
|
|
||||||
Bputc(&obuf, AHISTORY);
|
BPUTLE2(&obuf, AHISTORY);
|
||||||
Bputc(&obuf, AHISTORY>>8);
|
BPUTLE4(&obuf, h->line);
|
||||||
Bputc(&obuf, h->line);
|
|
||||||
Bputc(&obuf, h->line>>8);
|
|
||||||
Bputc(&obuf, h->line>>16);
|
|
||||||
Bputc(&obuf, h->line>>24);
|
|
||||||
zaddr(&nullgen, 0);
|
zaddr(&nullgen, 0);
|
||||||
zaddr(&g, 0);
|
zaddr(&g, 0);
|
||||||
|
|
||||||
|
@ -311,12 +311,8 @@ outcode(void)
|
|||||||
goto jackpot;
|
goto jackpot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&b, p->as);
|
BPUTLE2(&b, p->as);
|
||||||
Bputc(&b, p->as>>8);
|
BPUTLE4(&b, p->lineno);
|
||||||
Bputc(&b, p->lineno);
|
|
||||||
Bputc(&b, p->lineno>>8);
|
|
||||||
Bputc(&b, p->lineno>>16);
|
|
||||||
Bputc(&b, p->lineno>>24);
|
|
||||||
zaddr(&b, &p->from, sf);
|
zaddr(&b, &p->from, sf);
|
||||||
zaddr(&b, &p->to, st);
|
zaddr(&b, &p->to, st);
|
||||||
}
|
}
|
||||||
@ -392,13 +388,12 @@ outhist(Biobuf *b)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(b, ANAME);
|
BPUTLE2(b, ANAME);
|
||||||
Bputc(b, ANAME>>8);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, 1);
|
||||||
Bputc(b, 1);
|
BPUTC(b, '<');
|
||||||
Bputc(b, '<');
|
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
@ -412,12 +407,8 @@ outhist(Biobuf *b)
|
|||||||
if(h->offset)
|
if(h->offset)
|
||||||
pg.to.type = D_CONST;
|
pg.to.type = D_CONST;
|
||||||
|
|
||||||
Bputc(b, pg.as);
|
BPUTLE2(b, pg.as);
|
||||||
Bputc(b, pg.as>>8);
|
BPUTLE4(b, pg.lineno);
|
||||||
Bputc(b, pg.lineno);
|
|
||||||
Bputc(b, pg.lineno>>8);
|
|
||||||
Bputc(b, pg.lineno>>16);
|
|
||||||
Bputc(b, pg.lineno>>24);
|
|
||||||
zaddr(b, &pg.from, 0);
|
zaddr(b, &pg.from, 0);
|
||||||
zaddr(b, &pg.to, 0);
|
zaddr(b, &pg.to, 0);
|
||||||
|
|
||||||
@ -436,26 +427,21 @@ zname(Biobuf *b, Sym *s, int t)
|
|||||||
|
|
||||||
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
|
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
|
||||||
sig = sign(s);
|
sig = sign(s);
|
||||||
Bputc(b, ASIGNAME);
|
BPUTLE2(b, ASIGNAME);
|
||||||
Bputc(b, ASIGNAME>>8);
|
BPUTLE4(b, sig);
|
||||||
Bputc(b, sig);
|
|
||||||
Bputc(b, sig>>8);
|
|
||||||
Bputc(b, sig>>16);
|
|
||||||
Bputc(b, sig>>24);
|
|
||||||
s->sig = SIGDONE;
|
s->sig = SIGDONE;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Bputc(b, ANAME); /* as */
|
BPUTLE2(b, ANAME); /* as */
|
||||||
Bputc(b, ANAME>>8); /* as */
|
|
||||||
}
|
}
|
||||||
Bputc(b, t); /* type */
|
BPUTC(b, t); /* type */
|
||||||
Bputc(b, s->sym); /* sym */
|
BPUTC(b, s->sym); /* sym */
|
||||||
n = s->name;
|
n = s->name;
|
||||||
while(*n) {
|
while(*n) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -490,52 +476,40 @@ zaddr(Biobuf *b, Adr *a, int s)
|
|||||||
t |= T_SCONST;
|
t |= T_SCONST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(b, t);
|
BPUTC(b, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(b, a->index);
|
BPUTC(b, a->index);
|
||||||
Bputc(b, a->scale);
|
BPUTC(b, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
if(t & T_64) {
|
if(t & T_64) {
|
||||||
l = a->offset>>32;
|
l = a->offset>>32;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(b, s);
|
BPUTC(b, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->dval);
|
ieeedtod(&e, a->dval);
|
||||||
l = e.l;
|
l = e.l;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
l = e.h;
|
l = e.h;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->sval;
|
n = a->sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(b, a->type);
|
BPUTC(b, a->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
|
@ -35,10 +35,9 @@
|
|||||||
void
|
void
|
||||||
zname(Biobuf *b, Sym *s, int t)
|
zname(Biobuf *b, Sym *s, int t)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME); /* as */
|
BPUTLE2(b, ANAME); /* as */
|
||||||
Bputc(b, ANAME>>8); /* as */
|
BPUTC(b, t); /* type */
|
||||||
Bputc(b, t); /* type */
|
BPUTC(b, s->sym); /* sym */
|
||||||
Bputc(b, s->sym); /* sym */
|
|
||||||
|
|
||||||
Bputname(b, s);
|
Bputname(b, s);
|
||||||
}
|
}
|
||||||
@ -46,13 +45,12 @@ zname(Biobuf *b, Sym *s, int t)
|
|||||||
void
|
void
|
||||||
zfile(Biobuf *b, char *p, int n)
|
zfile(Biobuf *b, char *p, int n)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME);
|
BPUTLE2(b, ANAME);
|
||||||
Bputc(b, ANAME>>8);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, 1);
|
||||||
Bputc(b, 1);
|
BPUTC(b, '<');
|
||||||
Bputc(b, '<');
|
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -60,12 +58,8 @@ zhist(Biobuf *b, int line, vlong offset)
|
|||||||
{
|
{
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
Bputc(b, AHISTORY);
|
BPUTLE2(b, AHISTORY);
|
||||||
Bputc(b, AHISTORY>>8);
|
BPUTLE4(b, line);
|
||||||
Bputc(b, line);
|
|
||||||
Bputc(b, line>>8);
|
|
||||||
Bputc(b, line>>16);
|
|
||||||
Bputc(b, line>>24);
|
|
||||||
zaddr(b, &zprog.from, 0, 0);
|
zaddr(b, &zprog.from, 0, 0);
|
||||||
a = zprog.to;
|
a = zprog.to;
|
||||||
if(offset != 0) {
|
if(offset != 0) {
|
||||||
@ -116,54 +110,40 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
t |= T_SCONST;
|
t |= T_SCONST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(b, t);
|
BPUTC(b, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(b, a->index);
|
BPUTC(b, a->index);
|
||||||
Bputc(b, a->scale);
|
BPUTC(b, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
if(t & T_64) {
|
if(t & T_64) {
|
||||||
l = a->offset>>32;
|
l = a->offset>>32;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(b, s);
|
BPUTC(b, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->u.dval);
|
ieeedtod(&e, a->u.dval);
|
||||||
l = e;
|
BPUTLE4(b, e);
|
||||||
Bputc(b, l);
|
BPUTLE4(b, e >> 32);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
l = e >> 32;
|
|
||||||
Bputc(b, l);
|
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->u.sval;
|
n = a->u.sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(b, a->type);
|
BPUTC(b, a->type);
|
||||||
if(t & T_GOTYPE)
|
if(t & T_GOTYPE)
|
||||||
Bputc(b, gotype);
|
BPUTC(b, gotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -269,12 +249,8 @@ dumpfuncs(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bputc(bout, p->as);
|
BPUTLE2(bout, p->as);
|
||||||
Bputc(bout, p->as>>8);
|
BPUTLE4(bout, p->lineno);
|
||||||
Bputc(bout, p->lineno);
|
|
||||||
Bputc(bout, p->lineno>>8);
|
|
||||||
Bputc(bout, p->lineno>>16);
|
|
||||||
Bputc(bout, p->lineno>>24);
|
|
||||||
zaddr(bout, &p->from, sf, gf);
|
zaddr(bout, &p->from, sf, gf);
|
||||||
zaddr(bout, &p->to, st, gt);
|
zaddr(bout, &p->to, st, gt);
|
||||||
}
|
}
|
||||||
|
@ -342,10 +342,10 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
}
|
}
|
||||||
a->offset = 0;
|
a->offset = 0;
|
||||||
if(t & T_OFFSET) {
|
if(t & T_OFFSET) {
|
||||||
a->offset = Bget4(f);
|
a->offset = BGETLE4(f);
|
||||||
if(t & T_64) {
|
if(t & T_64) {
|
||||||
a->offset &= 0xFFFFFFFFULL;
|
a->offset &= 0xFFFFFFFFULL;
|
||||||
a->offset |= (vlong)Bget4(f) << 32;
|
a->offset |= (vlong)BGETLE4(f) << 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a->sym = S;
|
a->sym = S;
|
||||||
@ -353,8 +353,8 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
a->sym = zsym(pn, f, h);
|
a->sym = zsym(pn, f, h);
|
||||||
a->type = D_NONE;
|
a->type = D_NONE;
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
a->ieee.l = Bget4(f);
|
a->ieee.l = BGETLE4(f);
|
||||||
a->ieee.h = Bget4(f);
|
a->ieee.h = BGETLE4(f);
|
||||||
a->type = D_FCONST;
|
a->type = D_FCONST;
|
||||||
} else
|
} else
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
@ -461,7 +461,7 @@ loop:
|
|||||||
if(o == ANAME || o == ASIGNAME) {
|
if(o == ANAME || o == ASIGNAME) {
|
||||||
sig = 0;
|
sig = 0;
|
||||||
if(o == ASIGNAME)
|
if(o == ASIGNAME)
|
||||||
sig = Bget4(f);
|
sig = BGETLE4(f);
|
||||||
v = BGETC(f); /* type */
|
v = BGETC(f); /* type */
|
||||||
o = BGETC(f); /* sym */
|
o = BGETC(f); /* sym */
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -516,7 +516,7 @@ loop:
|
|||||||
|
|
||||||
p = mal(sizeof(*p));
|
p = mal(sizeof(*p));
|
||||||
p->as = o;
|
p->as = o;
|
||||||
p->line = Bget4(f);
|
p->line = BGETLE4(f);
|
||||||
p->back = 2;
|
p->back = 2;
|
||||||
p->mode = mode;
|
p->mode = mode;
|
||||||
zaddr(pn, f, &p->from, h);
|
zaddr(pn, f, &p->from, h);
|
||||||
|
@ -880,15 +880,14 @@ void
|
|||||||
zname(char *n, int t, int s)
|
zname(char *n, int t, int s)
|
||||||
{
|
{
|
||||||
|
|
||||||
Bputc(&obuf, ANAME); /* as(2) */
|
BPUTLE2(&obuf, ANAME); /* as(2) */
|
||||||
Bputc(&obuf, ANAME>>8);
|
BPUTC(&obuf, t); /* type */
|
||||||
Bputc(&obuf, t); /* type */
|
BPUTC(&obuf, s); /* sym */
|
||||||
Bputc(&obuf, s); /* sym */
|
|
||||||
while(*n) {
|
while(*n) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -923,52 +922,38 @@ zaddr(Gen *a, int s)
|
|||||||
case D_NONE:
|
case D_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, t);
|
BPUTC(&obuf, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(&obuf, a->index);
|
BPUTC(&obuf, a->index);
|
||||||
Bputc(&obuf, a->scale);
|
BPUTC(&obuf, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET2) {
|
if(t & T_OFFSET2) {
|
||||||
l = a->offset2;
|
l = a->offset2;
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, l);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(&obuf, s);
|
BPUTC(&obuf, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->dval);
|
ieeedtod(&e, a->dval);
|
||||||
l = e.l;
|
BPUTLE4(&obuf, e.l);
|
||||||
Bputc(&obuf, l);
|
BPUTLE4(&obuf, e.h);
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
l = e.h;
|
|
||||||
Bputc(&obuf, l);
|
|
||||||
Bputc(&obuf, l>>8);
|
|
||||||
Bputc(&obuf, l>>16);
|
|
||||||
Bputc(&obuf, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->sval;
|
n = a->sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(&obuf, *n);
|
BPUTC(&obuf, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(&obuf, a->type);
|
BPUTC(&obuf, a->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1027,12 +1012,8 @@ jackpot:
|
|||||||
goto jackpot;
|
goto jackpot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&obuf, a);
|
BPUTLE2(&obuf, a);
|
||||||
Bputc(&obuf, a>>8);
|
BPUTLE4(&obuf, stmtline);
|
||||||
Bputc(&obuf, stmtline);
|
|
||||||
Bputc(&obuf, stmtline>>8);
|
|
||||||
Bputc(&obuf, stmtline>>16);
|
|
||||||
Bputc(&obuf, stmtline>>24);
|
|
||||||
zaddr(&g2->from, sf);
|
zaddr(&g2->from, sf);
|
||||||
zaddr(&g2->to, st);
|
zaddr(&g2->to, st);
|
||||||
|
|
||||||
@ -1107,13 +1088,12 @@ outhist(void)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(&obuf, ANAME);
|
BPUTLE2(&obuf, ANAME);
|
||||||
Bputc(&obuf, ANAME>>8);
|
BPUTC(&obuf, D_FILE); /* type */
|
||||||
Bputc(&obuf, D_FILE); /* type */
|
BPUTC(&obuf, 1); /* sym */
|
||||||
Bputc(&obuf, 1); /* sym */
|
BPUTC(&obuf, '<');
|
||||||
Bputc(&obuf, '<');
|
|
||||||
Bwrite(&obuf, p, n);
|
Bwrite(&obuf, p, n);
|
||||||
Bputc(&obuf, 0);
|
BPUTC(&obuf, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
@ -1123,12 +1103,8 @@ outhist(void)
|
|||||||
}
|
}
|
||||||
g.offset = h->offset;
|
g.offset = h->offset;
|
||||||
|
|
||||||
Bputc(&obuf, AHISTORY);
|
BPUTLE2(&obuf, AHISTORY);
|
||||||
Bputc(&obuf, AHISTORY>>8);
|
BPUTLE4(&obuf, h->line);
|
||||||
Bputc(&obuf, h->line);
|
|
||||||
Bputc(&obuf, h->line>>8);
|
|
||||||
Bputc(&obuf, h->line>>16);
|
|
||||||
Bputc(&obuf, h->line>>24);
|
|
||||||
zaddr(&nullgen, 0);
|
zaddr(&nullgen, 0);
|
||||||
zaddr(&g, 0);
|
zaddr(&g, 0);
|
||||||
|
|
||||||
|
@ -315,12 +315,8 @@ outcode(void)
|
|||||||
goto jackpot;
|
goto jackpot;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(&b, p->as);
|
BPUTLE2(&b, p->as);
|
||||||
Bputc(&b, p->as>>8);
|
BPUTLE4(&b, p->lineno);
|
||||||
Bputc(&b, p->lineno);
|
|
||||||
Bputc(&b, p->lineno>>8);
|
|
||||||
Bputc(&b, p->lineno>>16);
|
|
||||||
Bputc(&b, p->lineno>>24);
|
|
||||||
zaddr(&b, &p->from, sf);
|
zaddr(&b, &p->from, sf);
|
||||||
zaddr(&b, &p->to, st);
|
zaddr(&b, &p->to, st);
|
||||||
}
|
}
|
||||||
@ -396,13 +392,12 @@ outhist(Biobuf *b)
|
|||||||
q = 0;
|
q = 0;
|
||||||
}
|
}
|
||||||
if(n) {
|
if(n) {
|
||||||
Bputc(b, ANAME);
|
BPUTLE2(b, ANAME);
|
||||||
Bputc(b, ANAME>>8);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, 1);
|
||||||
Bputc(b, 1);
|
BPUTC(b, '<');
|
||||||
Bputc(b, '<');
|
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
if(p == 0 && op) {
|
if(p == 0 && op) {
|
||||||
@ -416,12 +411,8 @@ outhist(Biobuf *b)
|
|||||||
if(h->offset)
|
if(h->offset)
|
||||||
pg.to.type = D_CONST;
|
pg.to.type = D_CONST;
|
||||||
|
|
||||||
Bputc(b, pg.as);
|
BPUTLE2(b, pg.as);
|
||||||
Bputc(b, pg.as>>8);
|
BPUTLE4(b, pg.lineno);
|
||||||
Bputc(b, pg.lineno);
|
|
||||||
Bputc(b, pg.lineno>>8);
|
|
||||||
Bputc(b, pg.lineno>>16);
|
|
||||||
Bputc(b, pg.lineno>>24);
|
|
||||||
zaddr(b, &pg.from, 0);
|
zaddr(b, &pg.from, 0);
|
||||||
zaddr(b, &pg.to, 0);
|
zaddr(b, &pg.to, 0);
|
||||||
|
|
||||||
@ -440,26 +431,21 @@ zname(Biobuf *b, Sym *s, int t)
|
|||||||
|
|
||||||
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
|
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
|
||||||
sig = sign(s);
|
sig = sign(s);
|
||||||
Bputc(b, ASIGNAME);
|
BPUTLE2(b, ASIGNAME);
|
||||||
Bputc(b, ASIGNAME>>8);
|
BPUTLE4(b, sig);
|
||||||
Bputc(b, sig);
|
|
||||||
Bputc(b, sig>>8);
|
|
||||||
Bputc(b, sig>>16);
|
|
||||||
Bputc(b, sig>>24);
|
|
||||||
s->sig = SIGDONE;
|
s->sig = SIGDONE;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Bputc(b, ANAME); /* as */
|
BPUTLE2(b, ANAME); /* as */
|
||||||
Bputc(b, ANAME>>8); /* as */
|
|
||||||
}
|
}
|
||||||
Bputc(b, t); /* type */
|
BPUTC(b, t); /* type */
|
||||||
Bputc(b, s->sym); /* sym */
|
BPUTC(b, s->sym); /* sym */
|
||||||
n = s->name;
|
n = s->name;
|
||||||
while(*n) {
|
while(*n) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -493,52 +479,38 @@ zaddr(Biobuf *b, Adr *a, int s)
|
|||||||
t |= T_OFFSET|T_OFFSET2;
|
t |= T_OFFSET|T_OFFSET2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(b, t);
|
BPUTC(b, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(b, a->index);
|
BPUTC(b, a->index);
|
||||||
Bputc(b, a->scale);
|
BPUTC(b, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET2) { /* implies offset2 */
|
if(t & T_OFFSET2) { /* implies offset2 */
|
||||||
l = a->offset2;
|
l = a->offset2;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(b, s);
|
BPUTC(b, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->dval);
|
ieeedtod(&e, a->dval);
|
||||||
l = e.l;
|
BPUTLE4(b, e.l);
|
||||||
Bputc(b, l);
|
BPUTLE4(b, e.h);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
l = e.h;
|
|
||||||
Bputc(b, l);
|
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->sval;
|
n = a->sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(b, a->type);
|
BPUTC(b, a->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
|
@ -35,10 +35,9 @@
|
|||||||
void
|
void
|
||||||
zname(Biobuf *b, Sym *s, int t)
|
zname(Biobuf *b, Sym *s, int t)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME); /* as */
|
BPUTLE2(b, ANAME); /* as */
|
||||||
Bputc(b, ANAME>>8); /* as */
|
BPUTC(b, t); /* type */
|
||||||
Bputc(b, t); /* type */
|
BPUTC(b, s->sym); /* sym */
|
||||||
Bputc(b, s->sym); /* sym */
|
|
||||||
|
|
||||||
Bputname(b, s);
|
Bputname(b, s);
|
||||||
}
|
}
|
||||||
@ -46,13 +45,12 @@ zname(Biobuf *b, Sym *s, int t)
|
|||||||
void
|
void
|
||||||
zfile(Biobuf *b, char *p, int n)
|
zfile(Biobuf *b, char *p, int n)
|
||||||
{
|
{
|
||||||
Bputc(b, ANAME);
|
BPUTLE2(b, ANAME);
|
||||||
Bputc(b, ANAME>>8);
|
BPUTC(b, D_FILE);
|
||||||
Bputc(b, D_FILE);
|
BPUTC(b, 1);
|
||||||
Bputc(b, 1);
|
BPUTC(b, '<');
|
||||||
Bputc(b, '<');
|
|
||||||
Bwrite(b, p, n);
|
Bwrite(b, p, n);
|
||||||
Bputc(b, 0);
|
BPUTC(b, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -60,12 +58,8 @@ zhist(Biobuf *b, int line, vlong offset)
|
|||||||
{
|
{
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
Bputc(b, AHISTORY);
|
BPUTLE2(b, AHISTORY);
|
||||||
Bputc(b, AHISTORY>>8);
|
BPUTLE4(b, line);
|
||||||
Bputc(b, line);
|
|
||||||
Bputc(b, line>>8);
|
|
||||||
Bputc(b, line>>16);
|
|
||||||
Bputc(b, line>>24);
|
|
||||||
zaddr(b, &zprog.from, 0, 0);
|
zaddr(b, &zprog.from, 0, 0);
|
||||||
a = zprog.to;
|
a = zprog.to;
|
||||||
if(offset != 0) {
|
if(offset != 0) {
|
||||||
@ -114,54 +108,40 @@ zaddr(Biobuf *b, Addr *a, int s, int gotype)
|
|||||||
t |= T_SCONST;
|
t |= T_SCONST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Bputc(b, t);
|
BPUTC(b, t);
|
||||||
|
|
||||||
if(t & T_INDEX) { /* implies index, scale */
|
if(t & T_INDEX) { /* implies index, scale */
|
||||||
Bputc(b, a->index);
|
BPUTC(b, a->index);
|
||||||
Bputc(b, a->scale);
|
BPUTC(b, a->scale);
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET) { /* implies offset */
|
if(t & T_OFFSET) { /* implies offset */
|
||||||
l = a->offset;
|
l = a->offset;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_OFFSET2) { /* implies offset */
|
if(t & T_OFFSET2) { /* implies offset */
|
||||||
l = a->offset2;
|
l = a->offset2;
|
||||||
Bputc(b, l);
|
BPUTLE4(b, l);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
}
|
}
|
||||||
if(t & T_SYM) /* implies sym */
|
if(t & T_SYM) /* implies sym */
|
||||||
Bputc(b, s);
|
BPUTC(b, s);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
ieeedtod(&e, a->u.dval);
|
ieeedtod(&e, a->u.dval);
|
||||||
l = e;
|
BPUTLE4(b, e);
|
||||||
Bputc(b, l);
|
BPUTLE4(b, e >> 32);
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
l = e >> 32;
|
|
||||||
Bputc(b, l);
|
|
||||||
Bputc(b, l>>8);
|
|
||||||
Bputc(b, l>>16);
|
|
||||||
Bputc(b, l>>24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
n = a->u.sval;
|
n = a->u.sval;
|
||||||
for(i=0; i<NSNAME; i++) {
|
for(i=0; i<NSNAME; i++) {
|
||||||
Bputc(b, *n);
|
BPUTC(b, *n);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(t & T_TYPE)
|
if(t & T_TYPE)
|
||||||
Bputc(b, a->type);
|
BPUTC(b, a->type);
|
||||||
if(t & T_GOTYPE)
|
if(t & T_GOTYPE)
|
||||||
Bputc(b, gotype);
|
BPUTC(b, gotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -267,12 +247,8 @@ dumpfuncs(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bputc(bout, p->as);
|
BPUTLE2(bout, p->as);
|
||||||
Bputc(bout, p->as>>8);
|
BPUTLE4(bout, p->lineno);
|
||||||
Bputc(bout, p->lineno);
|
|
||||||
Bputc(bout, p->lineno>>8);
|
|
||||||
Bputc(bout, p->lineno>>16);
|
|
||||||
Bputc(bout, p->lineno>>24);
|
|
||||||
zaddr(bout, &p->from, sf, gf);
|
zaddr(bout, &p->from, sf, gf);
|
||||||
zaddr(bout, &p->to, st, gt);
|
zaddr(bout, &p->to, st, gt);
|
||||||
}
|
}
|
||||||
|
@ -365,18 +365,18 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
|
|||||||
a->type = D_NONE;
|
a->type = D_NONE;
|
||||||
a->offset = 0;
|
a->offset = 0;
|
||||||
if(t & T_OFFSET)
|
if(t & T_OFFSET)
|
||||||
a->offset = Bget4(f);
|
a->offset = BGETLE4(f);
|
||||||
a->offset2 = 0;
|
a->offset2 = 0;
|
||||||
if(t & T_OFFSET2) {
|
if(t & T_OFFSET2) {
|
||||||
a->offset2 = Bget4(f);
|
a->offset2 = BGETLE4(f);
|
||||||
a->type = D_CONST2;
|
a->type = D_CONST2;
|
||||||
}
|
}
|
||||||
a->sym = S;
|
a->sym = S;
|
||||||
if(t & T_SYM)
|
if(t & T_SYM)
|
||||||
a->sym = zsym(pn, f, h);
|
a->sym = zsym(pn, f, h);
|
||||||
if(t & T_FCONST) {
|
if(t & T_FCONST) {
|
||||||
a->ieee.l = Bget4(f);
|
a->ieee.l = BGETLE4(f);
|
||||||
a->ieee.h = Bget4(f);
|
a->ieee.h = BGETLE4(f);
|
||||||
a->type = D_FCONST;
|
a->type = D_FCONST;
|
||||||
} else
|
} else
|
||||||
if(t & T_SCONST) {
|
if(t & T_SCONST) {
|
||||||
@ -475,7 +475,7 @@ loop:
|
|||||||
if(o == ANAME || o == ASIGNAME) {
|
if(o == ANAME || o == ASIGNAME) {
|
||||||
sig = 0;
|
sig = 0;
|
||||||
if(o == ASIGNAME)
|
if(o == ASIGNAME)
|
||||||
sig = Bget4(f);
|
sig = BGETLE4(f);
|
||||||
v = BGETC(f); /* type */
|
v = BGETC(f); /* type */
|
||||||
o = BGETC(f); /* sym */
|
o = BGETC(f); /* sym */
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -530,7 +530,7 @@ loop:
|
|||||||
|
|
||||||
p = mal(sizeof(*p));
|
p = mal(sizeof(*p));
|
||||||
p->as = o;
|
p->as = o;
|
||||||
p->line = Bget4(f);
|
p->line = BGETLE4(f);
|
||||||
p->back = 2;
|
p->back = 2;
|
||||||
zaddr(pn, f, &p->from, h);
|
zaddr(pn, f, &p->from, h);
|
||||||
fromgotype = adrgotype;
|
fromgotype = adrgotype;
|
||||||
|
@ -1616,10 +1616,10 @@ getc(void)
|
|||||||
curio.cp++;
|
curio.cp++;
|
||||||
} else {
|
} else {
|
||||||
loop:
|
loop:
|
||||||
c = Bgetc(curio.bin);
|
c = BGETC(curio.bin);
|
||||||
if(c == 0xef) {
|
if(c == 0xef) {
|
||||||
c1 = Bgetc(curio.bin);
|
c1 = BGETC(curio.bin);
|
||||||
c2 = Bgetc(curio.bin);
|
c2 = BGETC(curio.bin);
|
||||||
if(c1 == 0xbb && c2 == 0xbf) {
|
if(c1 == 0xbb && c2 == 0xbf) {
|
||||||
yyerrorl(lexlineno, "Unicode (UTF-8) BOM in middle of file");
|
yyerrorl(lexlineno, "Unicode (UTF-8) BOM in middle of file");
|
||||||
goto loop;
|
goto loop;
|
||||||
|
@ -87,7 +87,7 @@ void
|
|||||||
Bputname(Biobuf *b, Sym *s)
|
Bputname(Biobuf *b, Sym *s)
|
||||||
{
|
{
|
||||||
Bprint(b, "%s", s->pkg->prefix);
|
Bprint(b, "%s", s->pkg->prefix);
|
||||||
Bputc(b, '.');
|
BPUTC(b, '.');
|
||||||
Bwrite(b, s->name, strlen(s->name)+1);
|
Bwrite(b, s->name, strlen(s->name)+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,10 +801,10 @@ ldobj(Biobuf *f, char *pkg, int64 len, char *pn, char *file, int whence)
|
|||||||
|
|
||||||
pn = estrdup(pn);
|
pn = estrdup(pn);
|
||||||
|
|
||||||
c1 = Bgetc(f);
|
c1 = BGETC(f);
|
||||||
c2 = Bgetc(f);
|
c2 = BGETC(f);
|
||||||
c3 = Bgetc(f);
|
c3 = BGETC(f);
|
||||||
c4 = Bgetc(f);
|
c4 = BGETC(f);
|
||||||
Bungetc(f);
|
Bungetc(f);
|
||||||
Bungetc(f);
|
Bungetc(f);
|
||||||
Bungetc(f);
|
Bungetc(f);
|
||||||
@ -882,12 +882,12 @@ ldobj(Biobuf *f, char *pkg, int64 len, char *pn, char *file, int whence)
|
|||||||
/* skip over exports and other info -- ends with \n!\n */
|
/* skip over exports and other info -- ends with \n!\n */
|
||||||
import0 = Boffset(f);
|
import0 = Boffset(f);
|
||||||
c1 = '\n'; // the last line ended in \n
|
c1 = '\n'; // the last line ended in \n
|
||||||
c2 = Bgetc(f);
|
c2 = BGETC(f);
|
||||||
c3 = Bgetc(f);
|
c3 = BGETC(f);
|
||||||
while(c1 != '\n' || c2 != '!' || c3 != '\n') {
|
while(c1 != '\n' || c2 != '!' || c3 != '\n') {
|
||||||
c1 = c2;
|
c1 = c2;
|
||||||
c2 = c3;
|
c2 = c3;
|
||||||
c3 = Bgetc(f);
|
c3 = BGETC(f);
|
||||||
if(c3 == Beof)
|
if(c3 == Beof)
|
||||||
goto eof;
|
goto eof;
|
||||||
}
|
}
|
||||||
@ -1221,16 +1221,6 @@ zerosig(char *sp)
|
|||||||
s->sig = 0;
|
s->sig = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
|
||||||
Bget4(Biobuf *f)
|
|
||||||
{
|
|
||||||
uchar p[4];
|
|
||||||
|
|
||||||
if(Bread(f, p, 4) != 4)
|
|
||||||
return 0;
|
|
||||||
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mywhatsys(void)
|
mywhatsys(void)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,6 @@ double ieeedtod(Ieee *e);
|
|||||||
void undefsym(Sym *s);
|
void undefsym(Sym *s);
|
||||||
void zerosig(char *sp);
|
void zerosig(char *sp);
|
||||||
void readundefs(char *f, int t);
|
void readundefs(char *f, int t);
|
||||||
int32 Bget4(Biobuf *f);
|
|
||||||
void loadlib(void);
|
void loadlib(void);
|
||||||
void errorexit(void);
|
void errorexit(void);
|
||||||
void mangle(char*);
|
void mangle(char*);
|
||||||
|
@ -700,7 +700,7 @@ scanobj(Biobuf *b, Arfile *ap, long size)
|
|||||||
// the ! comes immediately. Catch that so we can avoid
|
// the ! comes immediately. Catch that so we can avoid
|
||||||
// the call to scanpkg below, since scanpkg assumes that the
|
// the call to scanpkg below, since scanpkg assumes that the
|
||||||
// Go metadata is present.
|
// Go metadata is present.
|
||||||
if(Bgetc(b) == '!')
|
if(BGETC(b) == '!')
|
||||||
goobject = 0;
|
goobject = 0;
|
||||||
|
|
||||||
Bseek(b, offset1, 0);
|
Bseek(b, offset1, 0);
|
||||||
@ -807,13 +807,13 @@ scanpkg(Biobuf *b, long size)
|
|||||||
* scan until $$
|
* scan until $$
|
||||||
*/
|
*/
|
||||||
for (n=0; n<size; ) {
|
for (n=0; n<size; ) {
|
||||||
c = Bgetc(b);
|
c = BGETC(b);
|
||||||
if(c == Beof)
|
if(c == Beof)
|
||||||
break;
|
break;
|
||||||
n++;
|
n++;
|
||||||
if(c != '$')
|
if(c != '$')
|
||||||
continue;
|
continue;
|
||||||
c = Bgetc(b);
|
c = BGETC(b);
|
||||||
if(c == Beof)
|
if(c == Beof)
|
||||||
break;
|
break;
|
||||||
n++;
|
n++;
|
||||||
@ -828,7 +828,7 @@ scanpkg(Biobuf *b, long size)
|
|||||||
|
|
||||||
foundstart:
|
foundstart:
|
||||||
/* found $$; skip rest of line */
|
/* found $$; skip rest of line */
|
||||||
while((c = Bgetc(b)) != '\n')
|
while((c = BGETC(b)) != '\n')
|
||||||
if(c == Beof)
|
if(c == Beof)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
@ -1263,7 +1263,7 @@ rl(int fd)
|
|||||||
wrsym(&b, len, aend->sym);
|
wrsym(&b, len, aend->sym);
|
||||||
|
|
||||||
if(symdefsize&0x01)
|
if(symdefsize&0x01)
|
||||||
Bputc(&b, 0);
|
BPUTC(&b, 0);
|
||||||
|
|
||||||
if (gflag) {
|
if (gflag) {
|
||||||
len = pkgdefsize;
|
len = pkgdefsize;
|
||||||
@ -1283,7 +1283,7 @@ rl(int fd)
|
|||||||
if (Bwrite(&b, pkgdefdata, pkgdefsize) != pkgdefsize)
|
if (Bwrite(&b, pkgdefdata, pkgdefsize) != pkgdefsize)
|
||||||
wrerr();
|
wrerr();
|
||||||
if(len&0x01)
|
if(len&0x01)
|
||||||
Bputc(&b, 0);
|
BPUTC(&b, 0);
|
||||||
}
|
}
|
||||||
Bterm(&b);
|
Bterm(&b);
|
||||||
}
|
}
|
||||||
@ -1297,12 +1297,9 @@ wrsym(Biobuf *bp, long offset, Arsymref *as)
|
|||||||
int off;
|
int off;
|
||||||
|
|
||||||
while(as) {
|
while(as) {
|
||||||
Bputc(bp, as->type);
|
BPUTC(bp, as->type);
|
||||||
off = as->offset+offset;
|
off = as->offset+offset;
|
||||||
Bputc(bp, off);
|
BPUTLE4(bp, off);
|
||||||
Bputc(bp, off>>8);
|
|
||||||
Bputc(bp, off>>16);
|
|
||||||
Bputc(bp, off>>24);
|
|
||||||
if (Bwrite(bp, as->name, as->len+1) != as->len+1)
|
if (Bwrite(bp, as->name, as->len+1) != as->len+1)
|
||||||
wrerr();
|
wrerr();
|
||||||
as = as->next;
|
as = as->next;
|
||||||
@ -1454,7 +1451,7 @@ select(int *ap, long mode)
|
|||||||
n = *ap++;
|
n = *ap++;
|
||||||
while(--n>=0 && (mode&*ap++)==0)
|
while(--n>=0 && (mode&*ap++)==0)
|
||||||
ap++;
|
ap++;
|
||||||
Bputc(&bout, *ap);
|
BPUTC(&bout, *ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1506,7 +1503,7 @@ arread(Biobuf *b, Armember *bp) /* read an image into a member buffer */
|
|||||||
rderr();
|
rderr();
|
||||||
}
|
}
|
||||||
if(bp->size&1)
|
if(bp->size&1)
|
||||||
Bgetc(b);
|
BGETC(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1734,6 +1731,6 @@ arread_cutprefix(Biobuf *b, Armember *bp)
|
|||||||
strncpy(bp->hdr.fmag, ARFMAG, 2);
|
strncpy(bp->hdr.fmag, ARFMAG, 2);
|
||||||
Bseek(b, end, 0);
|
Bseek(b, end, 0);
|
||||||
if(Boffset(b)&1)
|
if(Boffset(b)&1)
|
||||||
Bgetc(b);
|
BGETC(b);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,26 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Bgetle2(Biobuf *bp)
|
||||||
|
{
|
||||||
|
int l, h;
|
||||||
|
|
||||||
|
l = Bgetc(bp);
|
||||||
|
h = Bgetc(bp);
|
||||||
|
return l|(h<<8);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Bgetle4(Biobuf *bp)
|
||||||
|
{
|
||||||
|
int l, h;
|
||||||
|
|
||||||
|
l = Bgetle2(bp);
|
||||||
|
h = Bgetle2(bp);
|
||||||
|
return l|(h<<16);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Bungetc(Biobuf *bp)
|
Bungetc(Biobuf *bp)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ Bgetdf(void *vp)
|
|||||||
int c;
|
int c;
|
||||||
struct bgetd *bg = vp;
|
struct bgetd *bg = vp;
|
||||||
|
|
||||||
c = Bgetc(bg->b);
|
c = BGETC(bg->b);
|
||||||
if(c == Beof)
|
if(c == Beof)
|
||||||
bg->eof = 1;
|
bg->eof = 1;
|
||||||
return c;
|
return c;
|
||||||
|
@ -35,7 +35,7 @@ Bgetrune(Biobuf *bp)
|
|||||||
Rune rune;
|
Rune rune;
|
||||||
char str[UTFmax];
|
char str[UTFmax];
|
||||||
|
|
||||||
c = Bgetc(bp);
|
c = BGETC(bp);
|
||||||
if(c < Runeself) { /* one char */
|
if(c < Runeself) { /* one char */
|
||||||
bp->runesize = 1;
|
bp->runesize = 1;
|
||||||
return c;
|
return c;
|
||||||
@ -43,7 +43,7 @@ Bgetrune(Biobuf *bp)
|
|||||||
str[0] = (char)c;
|
str[0] = (char)c;
|
||||||
|
|
||||||
for(i=1;;) {
|
for(i=1;;) {
|
||||||
c = Bgetc(bp);
|
c = BGETC(bp);
|
||||||
if(c < 0)
|
if(c < 0)
|
||||||
return c;
|
return c;
|
||||||
str[i++] = (char)c;
|
str[i++] = (char)c;
|
||||||
|
@ -44,3 +44,17 @@ Bputc(Biobuf *bp, int c)
|
|||||||
}
|
}
|
||||||
return Beof;
|
return Beof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Bputle2(Biobuf *bp, int c)
|
||||||
|
{
|
||||||
|
Bputc(bp, c);
|
||||||
|
return Bputc(bp, c>>8);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Bputle4(Biobuf *bp, int c)
|
||||||
|
{
|
||||||
|
Bputle2(bp, c);
|
||||||
|
return Bputle2(bp, c>>16);
|
||||||
|
}
|
||||||
|
@ -37,7 +37,7 @@ Bputrune(Biobuf *bp, long c)
|
|||||||
|
|
||||||
rune = (Rune)c;
|
rune = (Rune)c;
|
||||||
if(rune < Runeself) {
|
if(rune < Runeself) {
|
||||||
Bputc(bp, (int)rune);
|
BPUTC(bp, (int)rune);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
n = runetochar(str, &rune);
|
n = runetochar(str, &rune);
|
||||||
|
@ -63,7 +63,7 @@ _read5(Biobuf *bp, Prog *p)
|
|||||||
int as, n;
|
int as, n;
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
as = Bgetc(bp); /* as */
|
as = BGETC(bp); /* as */
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
p->kind = aNone;
|
p->kind = aNone;
|
||||||
@ -74,11 +74,11 @@ _read5(Biobuf *bp, Prog *p)
|
|||||||
p->sig = leswal(p->sig);
|
p->sig = leswal(p->sig);
|
||||||
}
|
}
|
||||||
p->kind = aName;
|
p->kind = aName;
|
||||||
p->type = type2char(Bgetc(bp)); /* type */
|
p->type = type2char(BGETC(bp)); /* type */
|
||||||
p->sym = Bgetc(bp); /* sym */
|
p->sym = BGETC(bp); /* sym */
|
||||||
n = 0;
|
n = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
as = Bgetc(bp);
|
as = BGETC(bp);
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
n++;
|
n++;
|
||||||
@ -112,11 +112,11 @@ addr(Biobuf *bp)
|
|||||||
Addr a;
|
Addr a;
|
||||||
long off;
|
long off;
|
||||||
|
|
||||||
a.type = Bgetc(bp); /* a.type */
|
a.type = BGETC(bp); /* a.type */
|
||||||
skip(bp,1); /* reg */
|
skip(bp,1); /* reg */
|
||||||
a.sym = Bgetc(bp); /* sym index */
|
a.sym = BGETC(bp); /* sym index */
|
||||||
a.name = Bgetc(bp); /* sym type */
|
a.name = BGETC(bp); /* sym type */
|
||||||
a.gotype = Bgetc(bp); /* go type */
|
a.gotype = BGETC(bp); /* go type */
|
||||||
switch(a.type){
|
switch(a.type){
|
||||||
default:
|
default:
|
||||||
case D_NONE:
|
case D_NONE:
|
||||||
@ -127,21 +127,15 @@ addr(Biobuf *bp)
|
|||||||
break;
|
break;
|
||||||
case D_REGREG:
|
case D_REGREG:
|
||||||
case D_REGREG2:
|
case D_REGREG2:
|
||||||
Bgetc(bp);
|
BGETC(bp);
|
||||||
break;
|
break;
|
||||||
case D_CONST2:
|
case D_CONST2:
|
||||||
Bgetc(bp);
|
BGETLE4(bp); // fall through
|
||||||
Bgetc(bp);
|
|
||||||
Bgetc(bp);
|
|
||||||
Bgetc(bp); // fall through
|
|
||||||
case D_OREG:
|
case D_OREG:
|
||||||
case D_CONST:
|
case D_CONST:
|
||||||
case D_BRANCH:
|
case D_BRANCH:
|
||||||
case D_SHIFT:
|
case D_SHIFT:
|
||||||
off = Bgetc(bp);
|
off = BGETLE4(bp);
|
||||||
off |= Bgetc(bp) << 8;
|
|
||||||
off |= Bgetc(bp) << 16;
|
|
||||||
off |= Bgetc(bp) << 24;
|
|
||||||
if(off < 0)
|
if(off < 0)
|
||||||
off = -off;
|
off = -off;
|
||||||
if(a.sym && (a.name==D_PARAM || a.name==D_AUTO))
|
if(a.sym && (a.name==D_PARAM || a.name==D_AUTO))
|
||||||
@ -173,5 +167,5 @@ static void
|
|||||||
skip(Biobuf *bp, int n)
|
skip(Biobuf *bp, int n)
|
||||||
{
|
{
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
Bgetc(bp);
|
BGETC(bp);
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,10 @@ _read6(Biobuf *bp, Prog* p)
|
|||||||
int as, n, c;
|
int as, n, c;
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
as = Bgetc(bp); /* as(low) */
|
as = BGETC(bp); /* as(low) */
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
c = Bgetc(bp); /* as(high) */
|
c = BGETC(bp); /* as(high) */
|
||||||
if(c < 0)
|
if(c < 0)
|
||||||
return 0;
|
return 0;
|
||||||
as |= ((c & 0xff) << 8);
|
as |= ((c & 0xff) << 8);
|
||||||
@ -80,11 +80,11 @@ _read6(Biobuf *bp, Prog* p)
|
|||||||
p->sig = leswal(p->sig);
|
p->sig = leswal(p->sig);
|
||||||
}
|
}
|
||||||
p->kind = aName;
|
p->kind = aName;
|
||||||
p->type = type2char(Bgetc(bp)); /* type */
|
p->type = type2char(BGETC(bp)); /* type */
|
||||||
p->sym = Bgetc(bp); /* sym */
|
p->sym = BGETC(bp); /* sym */
|
||||||
n = 0;
|
n = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
as = Bgetc(bp);
|
as = BGETC(bp);
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
n++;
|
n++;
|
||||||
@ -122,40 +122,34 @@ addr(Biobuf *bp)
|
|||||||
|
|
||||||
off = 0;
|
off = 0;
|
||||||
a.sym = -1;
|
a.sym = -1;
|
||||||
a.flags = Bgetc(bp); /* flags */
|
a.flags = BGETC(bp); /* flags */
|
||||||
a.gotype = 0;
|
a.gotype = 0;
|
||||||
if(a.flags & T_INDEX)
|
if(a.flags & T_INDEX)
|
||||||
skip(bp, 2);
|
skip(bp, 2);
|
||||||
if(a.flags & T_OFFSET){
|
if(a.flags & T_OFFSET){
|
||||||
l = Bgetc(bp);
|
l = BGETLE4(bp);
|
||||||
l |= Bgetc(bp) << 8;
|
|
||||||
l |= Bgetc(bp) << 16;
|
|
||||||
l |= Bgetc(bp) << 24;
|
|
||||||
off = l;
|
off = l;
|
||||||
if(a.flags & T_64){
|
if(a.flags & T_64){
|
||||||
l = Bgetc(bp);
|
l = BGETLE4(bp);
|
||||||
l |= Bgetc(bp) << 8;
|
|
||||||
l |= Bgetc(bp) << 16;
|
|
||||||
l |= Bgetc(bp) << 24;
|
|
||||||
off = ((vlong)l << 32) | (off & 0xFFFFFFFF);
|
off = ((vlong)l << 32) | (off & 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
if(off < 0)
|
if(off < 0)
|
||||||
off = -off;
|
off = -off;
|
||||||
}
|
}
|
||||||
if(a.flags & T_SYM)
|
if(a.flags & T_SYM)
|
||||||
a.sym = Bgetc(bp);
|
a.sym = BGETC(bp);
|
||||||
if(a.flags & T_FCONST)
|
if(a.flags & T_FCONST)
|
||||||
skip(bp, 8);
|
skip(bp, 8);
|
||||||
else
|
else
|
||||||
if(a.flags & T_SCONST)
|
if(a.flags & T_SCONST)
|
||||||
skip(bp, NSNAME);
|
skip(bp, NSNAME);
|
||||||
if(a.flags & T_TYPE) {
|
if(a.flags & T_TYPE) {
|
||||||
t = Bgetc(bp);
|
t = BGETC(bp);
|
||||||
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
|
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
|
||||||
_offset(a.sym, off);
|
_offset(a.sym, off);
|
||||||
}
|
}
|
||||||
if(a.flags & T_GOTYPE)
|
if(a.flags & T_GOTYPE)
|
||||||
a.gotype = Bgetc(bp);
|
a.gotype = BGETC(bp);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,5 +169,5 @@ static void
|
|||||||
skip(Biobuf *bp, int n)
|
skip(Biobuf *bp, int n)
|
||||||
{
|
{
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
Bgetc(bp);
|
BGETC(bp);
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,10 @@ _read8(Biobuf *bp, Prog* p)
|
|||||||
int as, n, c;
|
int as, n, c;
|
||||||
Addr a;
|
Addr a;
|
||||||
|
|
||||||
as = Bgetc(bp); /* as(low) */
|
as = BGETC(bp); /* as(low) */
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
c = Bgetc(bp); /* as(high) */
|
c = BGETC(bp); /* as(high) */
|
||||||
if(c < 0)
|
if(c < 0)
|
||||||
return 0;
|
return 0;
|
||||||
as |= ((c & 0xff) << 8);
|
as |= ((c & 0xff) << 8);
|
||||||
@ -80,11 +80,11 @@ _read8(Biobuf *bp, Prog* p)
|
|||||||
p->sig = leswal(p->sig);
|
p->sig = leswal(p->sig);
|
||||||
}
|
}
|
||||||
p->kind = aName;
|
p->kind = aName;
|
||||||
p->type = type2char(Bgetc(bp)); /* type */
|
p->type = type2char(BGETC(bp)); /* type */
|
||||||
p->sym = Bgetc(bp); /* sym */
|
p->sym = BGETC(bp); /* sym */
|
||||||
n = 0;
|
n = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
as = Bgetc(bp);
|
as = BGETC(bp);
|
||||||
if(as < 0)
|
if(as < 0)
|
||||||
return 0;
|
return 0;
|
||||||
n++;
|
n++;
|
||||||
@ -122,37 +122,31 @@ addr(Biobuf *bp)
|
|||||||
off = 0;
|
off = 0;
|
||||||
a.gotype = 0;
|
a.gotype = 0;
|
||||||
a.sym = -1;
|
a.sym = -1;
|
||||||
a.flags = Bgetc(bp); /* flags */
|
a.flags = BGETC(bp); /* flags */
|
||||||
if(a.flags & T_INDEX)
|
if(a.flags & T_INDEX)
|
||||||
skip(bp, 2);
|
skip(bp, 2);
|
||||||
if(a.flags & T_OFFSET){
|
if(a.flags & T_OFFSET){
|
||||||
off = Bgetc(bp);
|
off = BGETLE4(bp);
|
||||||
off |= Bgetc(bp) << 8;
|
|
||||||
off |= Bgetc(bp) << 16;
|
|
||||||
off |= Bgetc(bp) << 24;
|
|
||||||
if(off < 0)
|
if(off < 0)
|
||||||
off = -off;
|
off = -off;
|
||||||
}
|
}
|
||||||
if(a.flags & T_OFFSET2){
|
if(a.flags & T_OFFSET2){
|
||||||
Bgetc(bp);
|
BGETLE4(bp);
|
||||||
Bgetc(bp);
|
|
||||||
Bgetc(bp);
|
|
||||||
Bgetc(bp);
|
|
||||||
}
|
}
|
||||||
if(a.flags & T_SYM)
|
if(a.flags & T_SYM)
|
||||||
a.sym = Bgetc(bp);
|
a.sym = BGETC(bp);
|
||||||
if(a.flags & T_FCONST)
|
if(a.flags & T_FCONST)
|
||||||
skip(bp, 8);
|
skip(bp, 8);
|
||||||
else
|
else
|
||||||
if(a.flags & T_SCONST)
|
if(a.flags & T_SCONST)
|
||||||
skip(bp, NSNAME);
|
skip(bp, NSNAME);
|
||||||
if(a.flags & T_TYPE) {
|
if(a.flags & T_TYPE) {
|
||||||
t = Bgetc(bp);
|
t = BGETC(bp);
|
||||||
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
|
if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
|
||||||
_offset(a.sym, off);
|
_offset(a.sym, off);
|
||||||
}
|
}
|
||||||
if(a.flags & T_GOTYPE)
|
if(a.flags & T_GOTYPE)
|
||||||
a.gotype = Bgetc(bp);
|
a.gotype = BGETC(bp);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,5 +166,5 @@ static void
|
|||||||
skip(Biobuf *bp, int n)
|
skip(Biobuf *bp, int n)
|
||||||
{
|
{
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
Bgetc(bp);
|
BGETC(bp);
|
||||||
}
|
}
|
||||||
|
@ -132,16 +132,16 @@ objtype(Biobuf *bp, char **name)
|
|||||||
* Found one. Skip until "\n!\n"
|
* Found one. Skip until "\n!\n"
|
||||||
*/
|
*/
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if((c = Bgetc(bp)) == Beof)
|
if((c = BGETC(bp)) == Beof)
|
||||||
return -1;
|
return -1;
|
||||||
if(c != '\n')
|
if(c != '\n')
|
||||||
continue;
|
continue;
|
||||||
c = Bgetc(bp);
|
c = BGETC(bp);
|
||||||
if(c != '!'){
|
if(c != '!'){
|
||||||
Bungetc(bp);
|
Bungetc(bp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c = Bgetc(bp);
|
c = BGETC(bp);
|
||||||
if(c != '\n'){
|
if(c != '\n'){
|
||||||
Bungetc(bp);
|
Bungetc(bp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -371,13 +371,13 @@ decodename(Biobuf *bp, Sym *p)
|
|||||||
p->type &= ~0x80;
|
p->type &= ~0x80;
|
||||||
if(p->type == 'z' || p->type == 'Z') {
|
if(p->type == 'z' || p->type == 'Z') {
|
||||||
o = Bseek(bp, 0, 1);
|
o = Bseek(bp, 0, 1);
|
||||||
if(Bgetc(bp) < 0) {
|
if(BGETC(bp) < 0) {
|
||||||
werrstr("can't read symbol name");
|
werrstr("can't read symbol name");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for(;;) {
|
for(;;) {
|
||||||
c1 = Bgetc(bp);
|
c1 = BGETC(bp);
|
||||||
c2 = Bgetc(bp);
|
c2 = BGETC(bp);
|
||||||
if(c1 < 0 || c2 < 0) {
|
if(c1 < 0 || c2 < 0) {
|
||||||
werrstr("can't read symbol name");
|
werrstr("can't read symbol name");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user