Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
52b0f77b
Commit
52b0f77b
authored
May 16, 2009
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
static initialization
structure set up - no change yet R=r OCL=28966 CL=28966
parent
8ee7688a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
3 deletions
+17
-3
cgen.c
src/cmd/6g/cgen.c
+5
-1
gen.c
src/cmd/6g/gen.c
+6
-0
gg.h
src/cmd/6g/gg.h
+1
-0
obj.c
src/cmd/6g/obj.c
+2
-1
dcl.c
src/cmd/gc/dcl.c
+2
-0
go.h
src/cmd/gc/go.h
+1
-1
No files found.
src/cmd/6g/cgen.c
View file @
52b0f77b
...
...
@@ -23,11 +23,15 @@ cgen(Node *n, Node *res)
dump
(
"cgen-res"
,
res
);
}
if
(
n
==
N
||
n
->
type
==
T
)
return
;
goto
ret
;
if
(
res
==
N
||
res
->
type
==
T
)
fatal
(
"cgen: res nil"
);
// static initializations
if
(
gen_as_init
(
n
,
res
))
goto
ret
;
if
(
n
->
ullman
>=
UINF
)
{
if
(
n
->
op
==
OINDREG
)
fatal
(
"cgen: this is going to misscompile"
);
...
...
src/cmd/6g/gen.c
View file @
52b0f77b
...
...
@@ -697,3 +697,9 @@ clearfat(Node *nl)
c
--
;
}
}
int
gen_as_init
(
Node
*
nr
,
Node
*
nl
)
{
return
0
;
}
src/cmd/6g/gg.h
View file @
52b0f77b
...
...
@@ -77,6 +77,7 @@ void genconv(Type*, Type*);
void
allocparams
(
void
);
void
checklabels
();
void
ginscall
(
Node
*
,
int
);
int
gen_as_init
(
Node
*
,
Node
*
);
/*
* cgen
...
...
src/cmd/6g/obj.c
View file @
52b0f77b
...
...
@@ -185,7 +185,8 @@ dumpfuncs(void)
for
(
pl
=
plist
;
pl
!=
nil
;
pl
=
pl
->
link
)
{
for
(
p
=
pl
->
firstpc
;
p
!=
P
;
p
=
p
->
link
)
{
p
->
loc
=
pcloc
;
pcloc
++
;
if
(
p
->
as
!=
ADATA
&&
p
->
as
!=
AGLOBL
)
pcloc
++
;
}
}
...
...
src/cmd/gc/dcl.c
View file @
52b0f77b
...
...
@@ -1411,7 +1411,9 @@ fninit(Node *n)
//dump("r", fn->nbody);
popdcl
();
initflag
=
1
;
// flag for loader static initialization
compile
(
fn
);
initflag
=
0
;
}
...
...
src/cmd/gc/go.h
View file @
52b0f77b
...
...
@@ -228,7 +228,6 @@ struct Node
int32
vargen
;
// unique name for OTYPE/ONAME
int32
lineno
;
vlong
xoffset
;
int32
ostk
;
};
#define N ((Node*)0)
...
...
@@ -569,6 +568,7 @@ EXTERN Dcl* typelist;
EXTERN
int
dclcontext
;
// PEXTERN/PAUTO
EXTERN
int
importflag
;
EXTERN
int
inimportsys
;
EXTERN
int
initflag
;
// compiling the init fn
EXTERN
uint32
iota
;
EXTERN
Node
*
lastconst
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment