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
4e141145
Commit
4e141145
authored
Jul 16, 2013
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/5c, cmd/6c, cmd/8c: record arg size for every call
R=ken2 CC=golang-dev
https://golang.org/cl/11364043
parent
9ddfb643
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
74 additions
and
7 deletions
+74
-7
src/cmd/5c/cgen.c
src/cmd/5c/cgen.c
+3
-1
src/cmd/5c/gc.h
src/cmd/5c/gc.h
+1
-0
src/cmd/5c/sgen.c
src/cmd/5c/sgen.c
+6
-1
src/cmd/5c/txt.c
src/cmd/5c/txt.c
+9
-0
src/cmd/6c/cgen.c
src/cmd/6c/cgen.c
+3
-0
src/cmd/6c/gc.h
src/cmd/6c/gc.h
+1
-0
src/cmd/6c/sgen.c
src/cmd/6c/sgen.c
+10
-3
src/cmd/6c/txt.c
src/cmd/6c/txt.c
+9
-0
src/cmd/8c/cgen.c
src/cmd/8c/cgen.c
+3
-0
src/cmd/8c/gc.h
src/cmd/8c/gc.h
+1
-0
src/cmd/8c/sgen.c
src/cmd/8c/sgen.c
+7
-2
src/cmd/8c/txt.c
src/cmd/8c/txt.c
+9
-0
src/cmd/cc/cc.h
src/cmd/cc/cc.h
+1
-0
src/cmd/cc/pgen.c
src/cmd/cc/pgen.c
+11
-0
No files found.
src/cmd/5c/cgen.c
View file @
4e141145
...
...
@@ -28,8 +28,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "gc.h"
#include "../../pkg/runtime/funcdata.h"
void
_cgen
(
Node
*
n
,
Node
*
nn
,
int
inrel
)
...
...
@@ -366,12 +366,14 @@ _cgen(Node *n, Node *nn, int inrel)
if
(
REGARG
>=
0
)
o
=
reg
[
REGARG
];
gargs
(
r
,
&
nod
,
&
nod1
);
gpcdata
(
PCDATA_ArgSize
,
curarg
);
if
(
l
->
addable
<
INDEXED
)
{
reglcgen
(
&
nod
,
l
,
Z
);
gopcode
(
OFUNC
,
Z
,
Z
,
&
nod
);
regfree
(
&
nod
);
}
else
gopcode
(
OFUNC
,
Z
,
Z
,
l
);
gpcdata
(
PCDATA_ArgSize
,
-
1
);
if
(
REGARG
>=
0
)
if
(
o
!=
reg
[
REGARG
])
reg
[
REGARG
]
--
;
...
...
src/cmd/5c/gc.h
View file @
4e141145
...
...
@@ -298,6 +298,7 @@ int sconst(Node*);
int
sval
(
int32
);
void
gpseudo
(
int
,
Sym
*
,
Node
*
);
void
gprefetch
(
Node
*
);
void
gpcdata
(
int
,
int
);
/*
* swt.c
...
...
src/cmd/5c/sgen.c
View file @
4e141145
...
...
@@ -37,8 +37,13 @@ gtext(Sym *s, int32 stkoff)
int32
a
;
a
=
0
;
if
(
!
(
textflag
&
NOSPLIT
)
)
if
(
!
(
textflag
&
NOSPLIT
)
||
!
hasdotdotdot
())
{
a
=
argsize
();
// Change argsize 0 to 1 to be mark that
// the argument size is present.
if
(
a
==
0
)
a
=
1
;
}
else
if
(
stkoff
>=
128
)
yyerror
(
"stack frame too large for NOSPLIT function"
);
...
...
src/cmd/5c/txt.c
View file @
4e141145
...
...
@@ -1197,6 +1197,15 @@ gpseudo(int a, Sym *s, Node *n)
pc
--
;
}
void
gpcdata
(
int
index
,
int
value
)
{
Node
n1
;
n1
=
*
nodconst
(
index
);
gins
(
APCDATA
,
&
n1
,
nodconst
(
value
));
}
void
gprefetch
(
Node
*
n
)
{
...
...
src/cmd/6c/cgen.c
View file @
4e141145
...
...
@@ -29,6 +29,7 @@
// THE SOFTWARE.
#include "gc.h"
#include "../../pkg/runtime/funcdata.h"
/* ,x/^(print|prtree)\(/i/\/\/ */
int
castup
(
Type
*
,
Type
*
);
...
...
@@ -944,6 +945,7 @@ cgen(Node *n, Node *nn)
return
;
}
gargs
(
r
,
&
nod
,
&
nod1
);
gpcdata
(
PCDATA_ArgSize
,
curarg
);
if
(
l
->
addable
<
INDEXED
)
{
reglcgen
(
&
nod
,
l
,
nn
);
nod
.
op
=
OREGISTER
;
...
...
@@ -951,6 +953,7 @@ cgen(Node *n, Node *nn)
regfree
(
&
nod
);
}
else
gopcode
(
OFUNC
,
n
->
type
,
Z
,
l
);
gpcdata
(
PCDATA_ArgSize
,
-
1
);
if
(
REGARG
>=
0
&&
reg
[
REGARG
])
reg
[
REGARG
]
--
;
if
(
nn
!=
Z
)
{
...
...
src/cmd/6c/gc.h
View file @
4e141145
...
...
@@ -293,6 +293,7 @@ void patch(Prog*, int32);
int
sconst
(
Node
*
);
void
gpseudo
(
int
,
Sym
*
,
Node
*
);
void
gprefetch
(
Node
*
);
void
gpcdata
(
int
,
int
);
/*
* swt.c
...
...
src/cmd/6c/sgen.c
View file @
4e141145
...
...
@@ -29,15 +29,22 @@
// THE SOFTWARE.
#include "gc.h"
#include "../../pkg/runtime/funcdata.h"
Prog
*
gtext
(
Sym
*
s
,
int32
stkoff
)
{
vlong
v
;
v
=
0
;
if
(
!
(
textflag
&
NOSPLIT
))
v
|=
argsize
()
<<
32
;
if
(
!
(
textflag
&
NOSPLIT
)
||
!
hasdotdotdot
())
{
v
=
argsize
();
// Change argsize 0 to 1 to be mark that
// the argument size is present.
if
(
v
==
0
)
v
=
1
;
v
<<=
32
;
}
v
|=
stkoff
&
0xffffffff
;
if
((
textflag
&
NOSPLIT
)
&&
stkoff
>=
128
)
yyerror
(
"stack frame too large for NOSPLIT function"
);
...
...
src/cmd/6c/txt.c
View file @
4e141145
...
...
@@ -1518,6 +1518,15 @@ gpseudo(int a, Sym *s, Node *n)
pc
--
;
}
void
gpcdata
(
int
index
,
int
value
)
{
Node
n1
;
n1
=
*
nodconst
(
index
);
gins
(
APCDATA
,
&
n1
,
nodconst
(
value
));
}
void
gprefetch
(
Node
*
n
)
{
...
...
src/cmd/8c/cgen.c
View file @
4e141145
...
...
@@ -29,6 +29,7 @@
// THE SOFTWARE.
#include "gc.h"
#include "../../pkg/runtime/funcdata.h"
/* ,x/^(print|prtree)\(/i/\/\/ */
...
...
@@ -937,6 +938,7 @@ cgen(Node *n, Node *nn)
return
;
}
gargs
(
r
,
&
nod
,
&
nod1
);
gpcdata
(
PCDATA_ArgSize
,
curarg
);
if
(
l
->
addable
<
INDEXED
)
{
reglcgen
(
&
nod
,
l
,
nn
);
nod
.
op
=
OREGISTER
;
...
...
@@ -944,6 +946,7 @@ cgen(Node *n, Node *nn)
regfree
(
&
nod
);
}
else
gopcode
(
OFUNC
,
n
->
type
,
Z
,
l
);
gpcdata
(
PCDATA_ArgSize
,
-
1
);
if
(
REGARG
>=
0
&&
reg
[
REGARG
])
reg
[
REGARG
]
--
;
if
(
nn
!=
Z
)
{
...
...
src/cmd/8c/gc.h
View file @
4e141145
...
...
@@ -298,6 +298,7 @@ void patch(Prog*, int32);
int
sconst
(
Node
*
);
void
gpseudo
(
int
,
Sym
*
,
Node
*
);
void
gprefetch
(
Node
*
);
void
gpcdata
(
int
,
int
);
/*
* swt.c
...
...
src/cmd/8c/sgen.c
View file @
4e141145
...
...
@@ -34,10 +34,15 @@ Prog*
gtext
(
Sym
*
s
,
int32
stkoff
)
{
int32
a
;
a
=
0
;
if
(
!
(
textflag
&
NOSPLIT
)
)
if
(
!
(
textflag
&
NOSPLIT
)
||
!
hasdotdotdot
())
{
a
=
argsize
();
// Change argsize 0 to 1 to be mark that
// the argument size is present.
if
(
a
==
0
)
a
=
1
;
}
else
if
(
stkoff
>=
128
)
yyerror
(
"stack frame too large for NOSPLIT function"
);
...
...
src/cmd/8c/txt.c
View file @
4e141145
...
...
@@ -1397,6 +1397,15 @@ gpseudo(int a, Sym *s, Node *n)
pc
--
;
}
void
gpcdata
(
int
index
,
int
value
)
{
Node
n1
;
n1
=
*
nodconst
(
index
);
gins
(
APCDATA
,
&
n1
,
nodconst
(
value
));
}
void
gprefetch
(
Node
*
n
)
{
...
...
src/cmd/cc/cc.h
View file @
4e141145
...
...
@@ -777,6 +777,7 @@ void xcom(Node*);
int32
exreg
(
Type
*
);
int32
align
(
int32
,
Type
*
,
int
,
int32
*
);
int32
maxround
(
int32
,
int32
);
int
hasdotdotdot
(
void
);
extern
schar
ewidth
[];
...
...
src/cmd/cc/pgen.c
View file @
4e141145
...
...
@@ -30,6 +30,17 @@
#include "gc.h"
int
hasdotdotdot
(
void
)
{
Type
*
t
;
for
(
t
=
thisfn
->
down
;
t
!=
T
;
t
=
t
->
down
)
if
(
t
->
etype
==
TDOT
)
return
1
;
return
0
;
}
vlong
argsize
(
void
)
{
...
...
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