Commit eb6f6836 authored by Russ Cox's avatar Russ Cox

8l: function at a time code layout

R=ken2
CC=golang-dev
https://golang.org/cl/2481042
parent e39bd1dd
......@@ -153,9 +153,7 @@ span(void)
// NOTE(rsc): If we get rid of the globals we should
// be able to parallelize these iterations.
for(cursym = textp; cursym != nil; cursym = cursym->next) {
if(!cursym->reachable)
continue;
// TODO: move into span1
for(p = cursym->text; p != P; p = p->link) {
n = 0;
if(p->to.type == D_BRANCH)
......@@ -189,8 +187,6 @@ span(void)
sect = segtext.sect;
sect->vaddr = c;
for(cursym = textp; cursym != nil; cursym = cursym->next) {
if(!cursym->reachable)
continue;
cursym->value = c;
for(p = cursym->text; p != P; p = p->link)
p->pc += c;
......
......@@ -332,11 +332,9 @@ phsh(Elf64_Phdr *ph, Elf64_Shdr *sh)
void
asmb(void)
{
Prog *p;
int32 v, magic;
int a, dynsym;
uint32 va, fo, w, symo, startva, machlink;
uchar *op1;
ulong expectpc;
ElfEhdr *eh;
ElfPhdr *ph, *pph;
......@@ -349,54 +347,9 @@ asmb(void)
seek(cout, HEADR, 0);
pc = INITTEXT;
for(cursym = textp; cursym != nil; cursym = cursym->next) {
for(p = cursym->text; p != P; p = p->link) {
curp = p;
if(HEADTYPE == 8) {
// native client
expectpc = p->pc;
p->pc = pc;
asmins(p);
if(p->pc != expectpc) {
Bflush(&bso);
diag("phase error %ux sb %ux in %s", p->pc, expectpc, TNAME);
}
while(pc < p->pc) {
cput(0x90); // nop
pc++;
}
}
if(p->pc != pc) {
Bflush(&bso);
if(!debug['a'])
print("%P\n", curp);
diag("phase error %ux sb %ux in %s", p->pc, pc, TNAME);
pc = p->pc;
}
if(HEADTYPE != 8) {
asmins(p);
if(pc != p->pc) {
Bflush(&bso);
diag("asmins changed pc %ux sb %ux in %s", p->pc, pc, TNAME);
}
}
if(cbc < sizeof(and))
cflush();
a = (andptr - and);
if(debug['a']) {
Bprint(&bso, pcstr, pc);
for(op1 = and; op1 < andptr; op1++)
Bprint(&bso, "%.2ux", *op1 & 0xff);
Bprint(&bso, "\t%P\n", curp);
}
memmove(cbp, and, a);
cbp += a;
pc += a;
cbc -= a;
}
}
codeblk(pc, segtext.sect->len);
pc += segtext.sect->len;
if(HEADTYPE == 8) {
int32 etext;
......@@ -406,8 +359,8 @@ asmb(void)
pc++;
}
pc = segrodata.vaddr;
cflush();
}
cflush();
/* output read-only data in text segment */
sect = segtext.sect->next;
......
......@@ -94,8 +94,8 @@ struct Prog
Adr from;
Adr to;
Prog* forwd;
Prog* comefrom;
Prog* link;
Prog* dlink;
Prog* pcond; /* work on this */
int32 pc;
int32 spadj;
......
This diff is collapsed.
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