Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
f25843e6
Commit
f25843e6
authored
Oct 04, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 026
R=r OCL=16494 CL=16494
parent
c8b9970e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
148 deletions
+35
-148
src/cmd/6g/gen.c
src/cmd/6g/gen.c
+0
-117
src/cmd/6g/gg.h
src/cmd/6g/gg.h
+0
-3
src/cmd/6g/gsubr.c
src/cmd/6g/gsubr.c
+0
-14
src/cmd/6g/obj.c
src/cmd/6g/obj.c
+7
-4
src/cmd/gc/go.h
src/cmd/gc/go.h
+6
-4
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+18
-2
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+4
-4
No files found.
src/cmd/6g/gen.c
View file @
f25843e6
...
...
@@ -358,123 +358,6 @@ ret:
lineno
=
lno
;
}
void
agen_inter
(
Node
*
n
,
Node
*
res
)
{
Node
nodo
,
nodr
,
nodt
;
Node
*
var
;
Sym
*
s
;
char
*
e
;
int32
o
,
lno
;
lno
=
setlineno
(
n
);
// stack offset
memset
(
&
nodo
,
0
,
sizeof
(
nodo
));
nodo
.
op
=
OINDREG
;
nodo
.
val
.
u
.
reg
=
D_SP
;
nodo
.
addable
=
1
;
nodo
.
type
=
types
[
tptr
];
// pointer register
regalloc
(
&
nodr
,
types
[
tptr
],
res
);
switch
(
n
->
op
)
{
default:
fatal
(
"agen_inter %O
\n
"
,
n
->
op
);
// case OS2I:
// ifaces2i(*sigi, *sigs, i.map, i.s)
// i.s is input
// (i.map, i.s) is output
cgen
(
n
->
left
,
&
nodr
);
nodo
.
xoffset
=
3
*
widthptr
;
cgen_as
(
&
nodo
,
&
nodr
,
0
);
nodtypesig
(
&
nodt
,
n
->
type
);
agen
(
&
nodt
,
&
nodr
);
nodo
.
xoffset
=
0
*
widthptr
;
cgen_as
(
&
nodo
,
&
nodr
,
0
);
nodtypesig
(
&
nodt
,
n
->
left
->
type
);
agen
(
&
nodt
,
&
nodr
);
nodo
.
xoffset
=
1
*
widthptr
;
cgen_as
(
&
nodo
,
&
nodr
,
0
);
e
=
"ifaces2i"
;
if
(
maxarg
<
4
*
widthptr
)
maxarg
=
4
*
widthptr
;
o
=
2
*
widthptr
;
break
;
// case OI2I:
// ifacei2i(*sigi, i.map, i.s)
// (i.map, i.s) is input
// (i.map, i.s) is output
nodo
.
xoffset
=
1
*
widthptr
;
if
(
!
n
->
left
->
addable
)
{
var
=
nod
(
OXXX
,
N
,
N
);
tempname
(
var
,
n
->
left
->
type
);
cgen
(
n
->
left
,
var
);
cgen
(
var
,
&
nodo
);
}
else
{
cgen
(
n
->
left
,
&
nodo
);
}
nodtypesig
(
&
nodt
,
n
->
type
);
agen
(
&
nodt
,
&
nodr
);
nodo
.
xoffset
=
0
*
widthptr
;
cgen_as
(
&
nodo
,
&
nodr
,
0
);
e
=
"ifacei2i"
;
if
(
maxarg
<
3
*
widthptr
)
maxarg
=
3
*
widthptr
;
o
=
1
*
widthptr
;
break
;
// case OI2S:
// ifacei2s(*sigs, i.map, i.s)
// (i.map, i.s) is input
// i.s is output
nodo
.
xoffset
=
1
*
widthptr
;
if
(
!
n
->
left
->
addable
)
{
var
=
nod
(
OXXX
,
N
,
N
);
tempname
(
var
,
n
->
left
->
type
);
cgen
(
n
->
left
,
var
);
cgen
(
var
,
&
nodo
);
}
else
{
cgen
(
n
->
left
,
&
nodo
);
}
nodtypesig
(
&
nodt
,
n
->
type
);
agen
(
&
nodt
,
&
nodr
);
nodo
.
xoffset
=
0
*
widthptr
;
cgen_as
(
&
nodo
,
&
nodr
,
0
);
e
=
"ifacei2s"
;
if
(
maxarg
<
3
*
widthptr
)
maxarg
=
3
*
widthptr
;
o
=
2
*
widthptr
;
break
;
}
s
=
pkglookup
(
e
,
"sys"
);
if
(
s
->
oname
==
N
)
{
s
->
oname
=
newname
(
s
);
s
->
oname
->
class
=
PEXTERN
;
}
gins
(
ACALL
,
N
,
s
->
oname
);
nodo
.
xoffset
=
o
;
gins
(
ALEAQ
,
&
nodo
,
res
);
regfree
(
&
nodr
);
lineno
=
lno
;
}
void
swgen
(
Node
*
n
)
{
...
...
src/cmd/6g/gg.h
View file @
f25843e6
...
...
@@ -129,7 +129,6 @@ void swgen(Node*);
void
selgen
(
Node
*
);
Node
*
lookdot
(
Node
*
,
Node
*
,
int
);
void
inarggen
(
void
);
void
agen_inter
(
Node
*
,
Node
*
);
void
cgen_as
(
Node
*
,
Node
*
,
int
);
void
cgen_asop
(
Node
*
);
void
cgen_ret
(
Node
*
);
...
...
@@ -192,8 +191,6 @@ Node* nodarg(Type*, int);
void
nodreg
(
Node
*
,
Type
*
,
int
);
void
nodindreg
(
Node
*
,
Type
*
,
int
);
void
nodconst
(
Node
*
,
Type
*
,
vlong
);
Sym
*
signame
(
Type
*
);
void
nodtypesig
(
Node
*
,
Type
*
);
void
gconreg
(
int
,
vlong
,
int
);
void
buildtxt
(
void
);
void
stringpool
(
Node
*
);
...
...
src/cmd/6g/gsubr.c
View file @
f25843e6
...
...
@@ -294,20 +294,6 @@ nodconst(Node *n, Type *t, vlong v)
}
}
void
nodtypesig
(
Node
*
n
,
Type
*
t
)
{
memset
(
n
,
0
,
sizeof
(
*
n
));
n
->
op
=
ONAME
;
n
->
type
=
types
[
TUINT8
];
n
->
etype
=
TUINT8
;
n
->
xoffset
=
0
;
n
->
sym
=
signame
(
t
);
n
->
class
=
PEXTERN
;
n
->
addable
=
1
;
n
->
ullman
=
0
;
}
void
gconreg
(
int
as
,
vlong
c
,
int
reg
)
{
...
...
src/cmd/6g/obj.c
View file @
f25843e6
...
...
@@ -476,7 +476,7 @@ dumpsignatures(void)
if
(
t
==
T
)
continue
;
s
=
signame
(
t
);
s
=
signame
(
t
,
0
);
if
(
s
==
S
)
continue
;
...
...
@@ -485,6 +485,7 @@ dumpsignatures(void)
x
->
dsym
=
d
->
dsym
;
x
->
dtype
=
d
->
dtype
;
x
->
forw
=
signatlist
;
x
->
block
=
0
;
signatlist
=
x
;
//print("SIG = %lS %lS %lT\n", d->dsym, s, t);
}
...
...
@@ -531,11 +532,14 @@ dumpsignatures(void)
continue
;
t
=
d
->
dtype
;
at
.
sym
=
signame
(
t
);
at
.
sym
=
signame
(
t
,
d
->
block
);
if
(
at
.
sym
==
S
)
continue
;
if
(
!
at
.
sym
->
local
)
// make unique
if
(
at
.
sym
->
local
!=
1
)
continue
;
at
.
sym
->
local
=
2
;
//print("SIGNAME = %lS\n", at.sym);
...
...
@@ -551,7 +555,6 @@ dumpsignatures(void)
if
(
strcmp
(
s
->
opackage
,
package
)
!=
0
)
continue
;
a
=
nil
;
o
=
0
;
...
...
src/cmd/gc/go.h
View file @
f25843e6
...
...
@@ -200,8 +200,8 @@ struct Node
struct
Sym
{
ushort
tblock
;
ushort
vblock
;
ushort
tblock
;
// blocknumber for type
ushort
vblock
;
// blocknumber for variable
uchar
undef
;
// a diagnostic has been generated
uchar
export
;
// marked as export
...
...
@@ -227,10 +227,12 @@ typedef struct Dcl Dcl;
struct
Dcl
{
uchar
op
;
ushort
block
;
int32
lineno
;
Sym
*
dsym
;
// for printing only
Node
*
dnode
;
// oname
Type
*
dtype
;
// otype
int32
lineno
;
Dcl
*
forw
;
Dcl
*
back
;
// sentinel has pointer to last
...
...
@@ -575,7 +577,7 @@ int isptrarray(Type*);
int
isptrdarray
(
Type
*
);
int
isinter
(
Type
*
);
Type
*
ismethod
(
Type
*
);
Sym
*
signame
(
Type
*
);
Sym
*
signame
(
Type
*
,
int
);
int
bytearraysz
(
Type
*
);
int
eqtype
(
Type
*
,
Type
*
,
int
);
void
argtype
(
Node
*
,
Type
*
);
...
...
src/cmd/gc/subr.c
View file @
f25843e6
...
...
@@ -1453,10 +1453,11 @@ out:
}
Sym
*
signame
(
Type
*
t
)
signame
(
Type
*
t
,
int
block
)
{
Sym
*
s
,
*
ss
;
char
*
e
;
Dcl
*
x
;
char
buf
[
NSYMB
];
if
(
t
==
T
)
...
...
@@ -1478,7 +1479,22 @@ signame(Type *t)
if
(
t
->
etype
==
TINTER
)
e
=
"sigi"
;
snprint
(
buf
,
sizeof
(
buf
),
"%s_%s"
,
e
,
s
->
name
);
if
(
block
==
0
)
block
=
s
->
tblock
;
if
(
block
>
1
)
{
snprint
(
buf
,
sizeof
(
buf
),
"%s_%d%s"
,
e
,
block
,
s
->
name
);
// record internal type for signature generation
x
=
mal
(
sizeof
(
*
x
));
x
->
op
=
OTYPE
;
x
->
dsym
=
s
;
x
->
dtype
=
s
->
otype
;
x
->
forw
=
signatlist
;
x
->
block
=
block
;
signatlist
=
x
;
}
else
snprint
(
buf
,
sizeof
(
buf
),
"%s_%s"
,
e
,
s
->
name
);
ss
=
pkglookup
(
buf
,
s
->
opackage
);
if
(
ss
->
oname
==
N
)
{
ss
->
oname
=
newname
(
ss
);
...
...
src/cmd/gc/walk.c
View file @
f25843e6
...
...
@@ -2491,7 +2491,7 @@ ifaceop(Type *tl, Node *n, int op)
a
=
n
;
// interface
r
=
a
;
s
=
signame
(
tl
);
// sigi
s
=
signame
(
tl
,
0
);
// sigi
if
(
s
==
S
)
fatal
(
"ifaceop: signame I2T"
);
a
=
s
->
oname
;
...
...
@@ -2510,14 +2510,14 @@ ifaceop(Type *tl, Node *n, int op)
a
=
n
;
// elem
r
=
a
;
s
=
signame
(
tr
);
// sigt
s
=
signame
(
tr
,
0
);
// sigt
if
(
s
==
S
)
fatal
(
"ifaceop: signame-1 T2I: %lT"
,
tr
);
a
=
s
->
oname
;
a
=
nod
(
OADDR
,
a
,
N
);
r
=
list
(
a
,
r
);
s
=
signame
(
tl
);
// sigi
s
=
signame
(
tl
,
0
);
// sigi
if
(
s
==
S
)
{
fatal
(
"ifaceop: signame-2 T2I: %lT"
,
tl
);
}
...
...
@@ -2537,7 +2537,7 @@ ifaceop(Type *tl, Node *n, int op)
a
=
n
;
// interface
r
=
a
;
s
=
signame
(
tl
);
// sigi
s
=
signame
(
tl
,
0
);
// sigi
if
(
s
==
S
)
fatal
(
"ifaceop: signame I2I"
);
a
=
s
->
oname
;
...
...
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