mirror of
https://github.com/golang/go
synced 2024-11-18 16:24:42 -07:00
6g tweaks
* byteastring is no longer used * do not generate ODCL, OAS for globals (wasn't generating any code but might save one or two init functions) * do not call self from Init function R=ken OCL=28309 CL=28309
This commit is contained in:
parent
b8dd218e2e
commit
f821e3c7c3
@ -18,7 +18,6 @@ char *sysimport =
|
|||||||
"func sys.slicestring (? string, ? int, ? int) (? string)\n"
|
"func sys.slicestring (? string, ? int, ? int) (? string)\n"
|
||||||
"func sys.indexstring (? string, ? int) (? uint8)\n"
|
"func sys.indexstring (? string, ? int) (? uint8)\n"
|
||||||
"func sys.intstring (? int64) (? string)\n"
|
"func sys.intstring (? int64) (? string)\n"
|
||||||
"func sys.byteastring (? *uint8, ? int) (? string)\n"
|
|
||||||
"func sys.arraystring (? []uint8) (? string)\n"
|
"func sys.arraystring (? []uint8) (? string)\n"
|
||||||
"func sys.stringiter (? string, ? int) (? int)\n"
|
"func sys.stringiter (? string, ? int) (? int)\n"
|
||||||
"func sys.stringiter2 (? string, ? int) (retk int, retv int)\n"
|
"func sys.stringiter2 (? string, ? int) (retk int, retv int)\n"
|
||||||
|
@ -38,7 +38,8 @@ dodclvar(Node *n, Type *t)
|
|||||||
|
|
||||||
addvar(n, t, dclcontext);
|
addvar(n, t, dclcontext);
|
||||||
autoexport(n->sym);
|
autoexport(n->sym);
|
||||||
addtop = list(addtop, nod(ODCL, n, N));
|
if(funcdepth > 0)
|
||||||
|
addtop = list(addtop, nod(ODCL, n, N));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1299,7 +1300,7 @@ fninit(Node *n)
|
|||||||
Node *done;
|
Node *done;
|
||||||
Node *a, *fn, *r;
|
Node *a, *fn, *r;
|
||||||
uint32 h;
|
uint32 h;
|
||||||
Sym *s;
|
Sym *s, *initsym;
|
||||||
|
|
||||||
if(strcmp(package, "PACKAGE") == 0) {
|
if(strcmp(package, "PACKAGE") == 0) {
|
||||||
// sys.go or unsafe.go during compiler build
|
// sys.go or unsafe.go during compiler build
|
||||||
@ -1329,7 +1330,8 @@ fninit(Node *n)
|
|||||||
snprint(namebuf, sizeof(namebuf), "init");
|
snprint(namebuf, sizeof(namebuf), "init");
|
||||||
|
|
||||||
fn = nod(ODCLFUNC, N, N);
|
fn = nod(ODCLFUNC, N, N);
|
||||||
fn->nname = newname(lookup(namebuf));
|
initsym = lookup(namebuf);
|
||||||
|
fn->nname = newname(initsym);
|
||||||
fn->type = functype(N, N, N);
|
fn->type = functype(N, N, N);
|
||||||
funchdr(fn);
|
funchdr(fn);
|
||||||
|
|
||||||
@ -1350,6 +1352,8 @@ fninit(Node *n)
|
|||||||
continue;
|
continue;
|
||||||
if(s->oname == N)
|
if(s->oname == N)
|
||||||
continue;
|
continue;
|
||||||
|
if(s == initsym)
|
||||||
|
continue;
|
||||||
|
|
||||||
// could check that it is fn of no args/returns
|
// could check that it is fn of no args/returns
|
||||||
a = nod(OCALL, s->oname, N);
|
a = nod(OCALL, s->oname, N);
|
||||||
|
@ -299,8 +299,12 @@ Avardcl:
|
|||||||
$$ = rev($1);
|
$$ = rev($1);
|
||||||
dodclvar($$, $2);
|
dodclvar($$, $2);
|
||||||
|
|
||||||
$$ = nod(OAS, $$, N);
|
if(funcdepth == 0) {
|
||||||
addtotop($$);
|
$$ = N;
|
||||||
|
} else {
|
||||||
|
$$ = nod(OAS, $$, N);
|
||||||
|
addtotop($$);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bvardcl:
|
Bvardcl:
|
||||||
@ -309,8 +313,12 @@ Bvardcl:
|
|||||||
$$ = rev($1);
|
$$ = rev($1);
|
||||||
dodclvar($$, $2);
|
dodclvar($$, $2);
|
||||||
|
|
||||||
$$ = nod(OAS, $$, N);
|
if(funcdepth == 0) {
|
||||||
addtotop($$);
|
$$ = N;
|
||||||
|
} else {
|
||||||
|
$$ = nod(OAS, $$, N);
|
||||||
|
addtotop($$);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| new_name_list_r type '=' expr_list
|
| new_name_list_r type '=' expr_list
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,6 @@ func cmpstring(string, string) int;
|
|||||||
func slicestring(string, int, int) string;
|
func slicestring(string, int, int) string;
|
||||||
func indexstring(string, int) byte;
|
func indexstring(string, int) byte;
|
||||||
func intstring(int64) string;
|
func intstring(int64) string;
|
||||||
func byteastring(*byte, int) string;
|
|
||||||
func arraystring([]byte) string;
|
func arraystring([]byte) string;
|
||||||
func stringiter(string, int) int;
|
func stringiter(string, int) int;
|
||||||
func stringiter2(string, int) (retk int, retv int);
|
func stringiter2(string, int) (retk int, retv int);
|
||||||
|
@ -173,14 +173,6 @@ sys·intstring(int64 v, String s)
|
|||||||
FLUSH(&s);
|
FLUSH(&s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sys·byteastring(byte *a, int32 l, String s)
|
|
||||||
{
|
|
||||||
s = gostringsize(l);
|
|
||||||
mcpy(s.str, a, l);
|
|
||||||
FLUSH(&s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sys·arraystring(Array b, String s)
|
sys·arraystring(Array b, String s)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user