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
43f29e64
Commit
43f29e64
authored
Aug 13, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mechanism for putting go types into 6.out symbol table.
no types yet. R=ken OCL=33142 CL=33146
parent
f63b0d6b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
95 additions
and
71 deletions
+95
-71
gg.h
src/cmd/6g/gg.h
+2
-4
gobj.c
src/cmd/6g/gobj.c
+74
-57
gsubr.c
src/cmd/6g/gsubr.c
+3
-0
6.out.h
src/cmd/6l/6.out.h
+1
-0
l.h
src/cmd/6l/l.h
+1
-0
obj.c
src/cmd/6l/obj.c
+3
-1
span.c
src/cmd/6l/span.c
+7
-7
lex.c
src/cmd/gc/lex.c
+1
-2
6obj.c
src/libmach_amd64/6obj.c
+3
-0
No files found.
src/cmd/6g/gg.h
View file @
43f29e64
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
#include <u.h>
#include <u.h>
#include <libc.h>
#include <libc.h>
...
@@ -22,6 +21,7 @@ struct Addr
...
@@ -22,6 +21,7 @@ struct Addr
Prog
*
branch
;
Prog
*
branch
;
char
sval
[
NSNAME
];
char
sval
[
NSNAME
];
Sym
*
gotype
;
Sym
*
sym
;
Sym
*
sym
;
int
width
;
int
width
;
uchar
type
;
uchar
type
;
...
@@ -107,8 +107,6 @@ int conv2pt(Type*);
...
@@ -107,8 +107,6 @@ int conv2pt(Type*);
vlong
convvtox
(
vlong
,
int
);
vlong
convvtox
(
vlong
,
int
);
void
fnparam
(
Type
*
,
int
,
int
);
void
fnparam
(
Type
*
,
int
,
int
);
Prog
*
gop
(
int
,
Node
*
,
Node
*
,
Node
*
);
Prog
*
gop
(
int
,
Node
*
,
Node
*
,
Node
*
);
void
setconst
(
Addr
*
,
vlong
);
void
setaddr
(
Addr
*
,
Node
*
);
int
optoas
(
int
,
Type
*
);
int
optoas
(
int
,
Type
*
);
void
ginit
(
void
);
void
ginit
(
void
);
void
gclean
(
void
);
void
gclean
(
void
);
...
@@ -141,5 +139,5 @@ int Rconv(Fmt*);
...
@@ -141,5 +139,5 @@ int Rconv(Fmt*);
int
Yconv
(
Fmt
*
);
int
Yconv
(
Fmt
*
);
void
listinit
(
void
);
void
listinit
(
void
);
void
zaddr
(
Biobuf
*
,
Addr
*
,
int
);
void
zaddr
(
Biobuf
*
,
Addr
*
,
int
,
int
);
src/cmd/6g/gobj.c
View file @
43f29e64
...
@@ -71,17 +71,17 @@ zhist(Biobuf *b, int line, vlong offset)
...
@@ -71,17 +71,17 @@ zhist(Biobuf *b, int line, vlong offset)
Bputc
(
b
,
line
>>
8
);
Bputc
(
b
,
line
>>
8
);
Bputc
(
b
,
line
>>
16
);
Bputc
(
b
,
line
>>
16
);
Bputc
(
b
,
line
>>
24
);
Bputc
(
b
,
line
>>
24
);
zaddr
(
b
,
&
zprog
.
from
,
0
);
zaddr
(
b
,
&
zprog
.
from
,
0
,
0
);
a
=
zprog
.
to
;
a
=
zprog
.
to
;
if
(
offset
!=
0
)
{
if
(
offset
!=
0
)
{
a
.
offset
=
offset
;
a
.
offset
=
offset
;
a
.
type
=
D_CONST
;
a
.
type
=
D_CONST
;
}
}
zaddr
(
b
,
&
a
,
0
);
zaddr
(
b
,
&
a
,
0
,
0
);
}
}
void
void
zaddr
(
Biobuf
*
b
,
Addr
*
a
,
int
s
)
zaddr
(
Biobuf
*
b
,
Addr
*
a
,
int
s
,
int
gotype
)
{
{
int32
l
;
int32
l
;
uint64
e
;
uint64
e
;
...
@@ -93,6 +93,8 @@ zaddr(Biobuf *b, Addr *a, int s)
...
@@ -93,6 +93,8 @@ zaddr(Biobuf *b, Addr *a, int s)
t
|=
T_INDEX
;
t
|=
T_INDEX
;
if
(
s
!=
0
)
if
(
s
!=
0
)
t
|=
T_SYM
;
t
|=
T_SYM
;
if
(
gotype
!=
0
)
t
|=
T_GOTYPE
;
switch
(
a
->
type
)
{
switch
(
a
->
type
)
{
...
@@ -165,22 +167,70 @@ zaddr(Biobuf *b, Addr *a, int s)
...
@@ -165,22 +167,70 @@ zaddr(Biobuf *b, Addr *a, int s)
}
}
if
(
t
&
T_TYPE
)
if
(
t
&
T_TYPE
)
Bputc
(
b
,
a
->
type
);
Bputc
(
b
,
a
->
type
);
if
(
t
&
T_GOTYPE
)
Bputc
(
b
,
gotype
);
}
static
struct
{
struct
{
Sym
*
sym
;
short
type
;
}
h
[
NSYM
];
int
sym
;
}
z
;
static
void
zsymreset
(
void
)
{
for
(
z
.
sym
=
0
;
z
.
sym
<
NSYM
;
z
.
sym
++
)
{
z
.
h
[
z
.
sym
].
sym
=
S
;
z
.
h
[
z
.
sym
].
type
=
0
;
}
z
.
sym
=
1
;
}
static
int
zsym
(
Sym
*
s
,
int
t
,
int
*
new
)
{
int
i
;
*
new
=
0
;
if
(
s
==
S
)
return
0
;
i
=
s
->
sym
;
if
(
i
<
0
||
i
>=
NSYM
)
i
=
0
;
if
(
z
.
h
[
i
].
type
==
t
&&
z
.
h
[
i
].
sym
==
s
)
return
i
;
i
=
z
.
sym
;
s
->
sym
=
i
;
zname
(
bout
,
s
,
t
);
z
.
h
[
i
].
sym
=
s
;
z
.
h
[
i
].
type
=
t
;
if
(
++
z
.
sym
>=
NSYM
)
z
.
sym
=
1
;
*
new
=
1
;
return
i
;
}
static
int
zsymaddr
(
Addr
*
a
,
int
*
new
)
{
int
t
;
t
=
a
->
type
;
if
(
t
==
D_ADDR
)
t
=
a
->
index
;
return
zsym
(
a
->
sym
,
t
,
new
);
}
}
void
void
dumpfuncs
(
void
)
dumpfuncs
(
void
)
{
{
Plist
*
pl
;
Plist
*
pl
;
int
sf
,
st
,
t
,
sym
;
int
sf
,
st
,
gf
,
gt
,
new
;
struct
{
Sym
*
sym
;
short
type
;
}
h
[
NSYM
];
Sym
*
s
;
Sym
*
s
;
Prog
*
p
;
Prog
*
p
;
for
(
sym
=
0
;
sym
<
NSYM
;
sym
++
)
{
zsymreset
();
h
[
sym
].
sym
=
S
;
h
[
sym
].
type
=
0
;
}
sym
=
1
;
// fix up pc
// fix up pc
pcloc
=
0
;
pcloc
=
0
;
...
@@ -205,61 +255,28 @@ dumpfuncs(void)
...
@@ -205,61 +255,28 @@ dumpfuncs(void)
}
}
for
(
p
=
pl
->
firstpc
;
p
!=
P
;
p
=
p
->
link
)
{
for
(
p
=
pl
->
firstpc
;
p
!=
P
;
p
=
p
->
link
)
{
jackpot:
for
(;;)
{
sf
=
0
;
sf
=
zsymaddr
(
&
p
->
from
,
&
new
);
s
=
p
->
from
.
sym
;
gf
=
zsym
(
p
->
from
.
gotype
,
D_EXTERN
,
&
new
);
while
(
s
!=
S
)
{
if
(
new
&&
sf
==
gf
)
sf
=
s
->
sym
;
continue
;
if
(
sf
<
0
||
sf
>=
NSYM
)
st
=
zsymaddr
(
&
p
->
to
,
&
new
);
sf
=
0
;
if
(
new
&&
(
st
==
sf
||
st
==
gf
))
t
=
p
->
from
.
type
;
continue
;
if
(
t
==
D_ADDR
)
gt
=
zsym
(
p
->
to
.
gotype
,
D_EXTERN
,
&
new
);
t
=
p
->
from
.
index
;
if
(
new
&&
(
gt
==
sf
||
gt
==
gf
||
gt
==
st
))
if
(
h
[
sf
].
type
==
t
)
continue
;
if
(
h
[
sf
].
sym
==
s
)
break
;
s
->
sym
=
sym
;
zname
(
bout
,
s
,
t
);
h
[
sym
].
sym
=
s
;
h
[
sym
].
type
=
t
;
sf
=
sym
;
sym
++
;
if
(
sym
>=
NSYM
)
sym
=
1
;
break
;
}
st
=
0
;
s
=
p
->
to
.
sym
;
while
(
s
!=
S
)
{
st
=
s
->
sym
;
if
(
st
<
0
||
st
>=
NSYM
)
st
=
0
;
t
=
p
->
to
.
type
;
if
(
t
==
D_ADDR
)
t
=
p
->
to
.
index
;
if
(
h
[
st
].
type
==
t
)
if
(
h
[
st
].
sym
==
s
)
break
;
s
->
sym
=
sym
;
zname
(
bout
,
s
,
t
);
h
[
sym
].
sym
=
s
;
h
[
sym
].
type
=
t
;
st
=
sym
;
sym
++
;
if
(
sym
>=
NSYM
)
sym
=
1
;
if
(
st
==
sf
)
goto
jackpot
;
break
;
break
;
}
}
Bputc
(
bout
,
p
->
as
);
Bputc
(
bout
,
p
->
as
);
Bputc
(
bout
,
p
->
as
>>
8
);
Bputc
(
bout
,
p
->
as
>>
8
);
Bputc
(
bout
,
p
->
lineno
);
Bputc
(
bout
,
p
->
lineno
);
Bputc
(
bout
,
p
->
lineno
>>
8
);
Bputc
(
bout
,
p
->
lineno
>>
8
);
Bputc
(
bout
,
p
->
lineno
>>
16
);
Bputc
(
bout
,
p
->
lineno
>>
16
);
Bputc
(
bout
,
p
->
lineno
>>
24
);
Bputc
(
bout
,
p
->
lineno
>>
24
);
zaddr
(
bout
,
&
p
->
from
,
sf
);
zaddr
(
bout
,
&
p
->
from
,
sf
,
gf
);
zaddr
(
bout
,
&
p
->
to
,
st
);
zaddr
(
bout
,
&
p
->
to
,
st
,
gt
);
}
}
}
}
}
}
...
...
src/cmd/6g/gsubr.c
View file @
43f29e64
...
@@ -882,6 +882,8 @@ naddr(Node *n, Addr *a)
...
@@ -882,6 +882,8 @@ naddr(Node *n, Addr *a)
a
->
scale
=
0
;
a
->
scale
=
0
;
a
->
index
=
D_NONE
;
a
->
index
=
D_NONE
;
a
->
type
=
D_NONE
;
a
->
type
=
D_NONE
;
a
->
gotype
=
S
;
if
(
n
==
N
)
if
(
n
==
N
)
return
;
return
;
...
@@ -937,6 +939,7 @@ naddr(Node *n, Addr *a)
...
@@ -937,6 +939,7 @@ naddr(Node *n, Addr *a)
if
(
n
->
type
!=
T
)
{
if
(
n
->
type
!=
T
)
{
a
->
etype
=
simtype
[
n
->
type
->
etype
];
a
->
etype
=
simtype
[
n
->
type
->
etype
];
a
->
width
=
n
->
type
->
width
;
a
->
width
=
n
->
type
->
width
;
// a->gotype = typename(n->type)->left->sym;
}
}
a
->
offset
=
n
->
xoffset
;
a
->
offset
=
n
->
xoffset
;
a
->
sym
=
n
->
sym
;
a
->
sym
=
n
->
sym
;
...
...
src/cmd/6l/6.out.h
View file @
43f29e64
...
@@ -831,6 +831,7 @@ enum
...
@@ -831,6 +831,7 @@ enum
T_SYM
=
1
<<
4
,
T_SYM
=
1
<<
4
,
T_SCONST
=
1
<<
5
,
T_SCONST
=
1
<<
5
,
T_64
=
1
<<
6
,
T_64
=
1
<<
6
,
T_GOTYPE
=
1
<<
7
,
REGARG
=
-
1
,
REGARG
=
-
1
,
REGRET
=
D_AX
,
REGRET
=
D_AX
,
...
...
src/cmd/6l/l.h
View file @
43f29e64
...
@@ -71,6 +71,7 @@ struct Adr
...
@@ -71,6 +71,7 @@ struct Adr
short
type
;
short
type
;
char
index
;
char
index
;
char
scale
;
char
scale
;
Sym
*
gotype
;
};
};
#define offset u0.u0offset
#define offset u0.u0offset
...
...
src/cmd/6l/obj.c
View file @
43f29e64
...
@@ -607,6 +607,8 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
...
@@ -607,6 +607,8 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
}
}
if
(
t
&
T_TYPE
)
if
(
t
&
T_TYPE
)
a
->
type
=
Bgetc
(
f
);
a
->
type
=
Bgetc
(
f
);
if
(
t
&
T_GOTYPE
)
a
->
gotype
=
h
[
Bgetc
(
f
)];
s
=
a
->
sym
;
s
=
a
->
sym
;
if
(
s
==
S
)
if
(
s
==
S
)
return
;
return
;
...
@@ -635,7 +637,7 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
...
@@ -635,7 +637,7 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
void
void
addlib
(
char
*
src
,
char
*
obj
)
addlib
(
char
*
src
,
char
*
obj
)
{
{
char
name
[
1024
],
pname
[
1024
],
comp
[
256
],
*
p
,
*
q
;
char
name
[
1024
],
pname
[
1024
],
comp
[
256
],
*
p
;
int
i
,
search
;
int
i
,
search
;
if
(
histfrogp
<=
0
)
if
(
histfrogp
<=
0
)
...
...
src/cmd/6l/span.c
View file @
43f29e64
...
@@ -213,7 +213,7 @@ asmsym(void)
...
@@ -213,7 +213,7 @@ asmsym(void)
s
=
lookup
(
"etext"
,
0
);
s
=
lookup
(
"etext"
,
0
);
if
(
s
->
type
==
STEXT
)
if
(
s
->
type
==
STEXT
)
putsymb
(
s
->
name
,
'T'
,
s
->
value
,
s
->
version
,
nil
);
putsymb
(
s
->
name
,
'T'
,
s
->
value
,
s
->
version
,
0
);
for
(
h
=
0
;
h
<
NHASH
;
h
++
)
for
(
h
=
0
;
h
<
NHASH
;
h
++
)
for
(
s
=
hash
[
h
];
s
!=
S
;
s
=
s
->
link
)
for
(
s
=
hash
[
h
];
s
!=
S
;
s
=
s
->
link
)
...
@@ -231,7 +231,7 @@ asmsym(void)
...
@@ -231,7 +231,7 @@ asmsym(void)
continue
;
continue
;
case
SFILE
:
case
SFILE
:
putsymb
(
s
->
name
,
'f'
,
s
->
value
,
s
->
version
,
nil
);
putsymb
(
s
->
name
,
'f'
,
s
->
value
,
s
->
version
,
0
);
continue
;
continue
;
}
}
...
@@ -241,25 +241,25 @@ asmsym(void)
...
@@ -241,25 +241,25 @@ asmsym(void)
/* filenames first */
/* filenames first */
for
(
a
=
p
->
to
.
autom
;
a
;
a
=
a
->
link
)
for
(
a
=
p
->
to
.
autom
;
a
;
a
=
a
->
link
)
if
(
a
->
type
==
D_FILE
)
if
(
a
->
type
==
D_FILE
)
putsymb
(
a
->
asym
->
name
,
'z'
,
a
->
aoffset
,
0
,
nil
);
putsymb
(
a
->
asym
->
name
,
'z'
,
a
->
aoffset
,
0
,
0
);
else
else
if
(
a
->
type
==
D_FILE1
)
if
(
a
->
type
==
D_FILE1
)
putsymb
(
a
->
asym
->
name
,
'Z'
,
a
->
aoffset
,
0
,
nil
);
putsymb
(
a
->
asym
->
name
,
'Z'
,
a
->
aoffset
,
0
,
0
);
if
(
s
->
type
!=
STEXT
)
if
(
s
->
type
!=
STEXT
)
continue
;
continue
;
putsymb
(
s
->
name
,
'T'
,
s
->
value
,
s
->
version
,
gotypefor
(
s
->
name
));
putsymb
(
s
->
name
,
'T'
,
s
->
value
,
s
->
version
,
gotypefor
(
s
->
name
));
/* frame, auto and param after */
/* frame, auto and param after */
putsymb
(
".frame"
,
'm'
,
p
->
to
.
offset
+
8
,
0
,
nil
);
putsymb
(
".frame"
,
'm'
,
p
->
to
.
offset
+
8
,
0
,
0
);
/* TODO(rsc): Add types for D_AUTO and D_PARAM */
/* TODO(rsc): Add types for D_AUTO and D_PARAM */
for
(
a
=
p
->
to
.
autom
;
a
;
a
=
a
->
link
)
for
(
a
=
p
->
to
.
autom
;
a
;
a
=
a
->
link
)
if
(
a
->
type
==
D_AUTO
)
if
(
a
->
type
==
D_AUTO
)
putsymb
(
a
->
asym
->
name
,
'a'
,
-
a
->
aoffset
,
0
,
nil
);
putsymb
(
a
->
asym
->
name
,
'a'
,
-
a
->
aoffset
,
0
,
gotypefor
(
nil
)
);
else
else
if
(
a
->
type
==
D_PARAM
)
if
(
a
->
type
==
D_PARAM
)
putsymb
(
a
->
asym
->
name
,
'p'
,
a
->
aoffset
,
0
,
nil
);
putsymb
(
a
->
asym
->
name
,
'p'
,
a
->
aoffset
,
0
,
gotypefor
(
nil
)
);
}
}
if
(
debug
[
'v'
]
||
debug
[
'n'
])
if
(
debug
[
'v'
]
||
debug
[
'n'
])
Bprint
(
&
bso
,
"symsize = %lud
\n
"
,
symsize
);
Bprint
(
&
bso
,
"symsize = %lud
\n
"
,
symsize
);
...
...
src/cmd/gc/lex.c
View file @
43f29e64
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
#define EXTERN
#define EXTERN
#include "go.h"
#include "go.h"
#include "y.tab.h"
#include "y.tab.h"
...
@@ -85,7 +84,7 @@ main(int argc, char *argv[])
...
@@ -85,7 +84,7 @@ main(int argc, char *argv[])
curio
.
infile
=
infile
;
curio
.
infile
=
infile
;
curio
.
bin
=
Bopen
(
infile
,
OREAD
);
curio
.
bin
=
Bopen
(
infile
,
OREAD
);
if
(
curio
.
bin
==
nil
)
if
(
curio
.
bin
==
nil
)
fatal
(
"open%s: %r"
,
infile
);
fatal
(
"open
%s: %r"
,
infile
);
curio
.
peekc
=
0
;
curio
.
peekc
=
0
;
curio
.
peekc1
=
0
;
curio
.
peekc1
=
0
;
...
...
src/libmach_amd64/6obj.c
View file @
43f29e64
...
@@ -41,6 +41,7 @@ struct Addr
...
@@ -41,6 +41,7 @@ struct Addr
{
{
char
sym
;
char
sym
;
char
flags
;
char
flags
;
char
gotype
;
};
};
static
Addr
addr
(
Biobuf
*
);
static
Addr
addr
(
Biobuf
*
);
static
char
type2char
(
int
);
static
char
type2char
(
int
);
...
@@ -152,6 +153,8 @@ addr(Biobuf *bp)
...
@@ -152,6 +153,8 @@ addr(Biobuf *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
)
a
.
gotype
=
Bgetc
(
bp
);
return
a
;
return
a
;
}
}
...
...
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