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
175c4015
Commit
175c4015
authored
Mar 15, 2013
by
Jan Ziak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/gc: unroll small array types
R=golang-dev, rsc CC=golang-dev, nigeltao
https://golang.org/cl/7812044
parent
5146a93e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
src/cmd/gc/reflect.c
src/cmd/gc/reflect.c
+17
-3
No files found.
src/cmd/gc/reflect.c
View file @
175c4015
...
...
@@ -1025,11 +1025,24 @@ dalgsym(Type *t)
return
s
;
}
static
int
gcinline
(
Type
*
t
)
{
switch
(
t
->
etype
)
{
case
TARRAY
:
if
(
t
->
bound
==
1
)
return
1
;
if
(
t
->
width
<=
4
*
widthptr
)
return
1
;
break
;
}
return
0
;
}
static
int
dgcsym1
(
Sym
*
s
,
int
ot
,
Type
*
t
,
vlong
*
off
,
int
stack_size
)
{
Type
*
t1
;
vlong
o
,
off2
,
fieldoffset
;
vlong
o
,
off2
,
fieldoffset
,
i
;
if
(
t
->
align
>
0
&&
(
*
off
%
t
->
align
)
!=
0
)
fatal
(
"dgcsym1: invalid initial alignment, %T"
,
t
);
...
...
@@ -1132,8 +1145,9 @@ dgcsym1(Sym *s, int ot, Type *t, vlong *off, int stack_size)
}
else
{
if
(
t
->
bound
<
1
||
!
haspointers
(
t
->
type
))
{
*
off
+=
t
->
width
;
}
else
if
(
t
->
bound
==
1
)
{
ot
=
dgcsym1
(
s
,
ot
,
t
->
type
,
off
,
stack_size
);
// recursive call of dgcsym1
}
else
if
(
gcinline
(
t
))
{
for
(
i
=
0
;
i
<
t
->
bound
;
i
++
)
ot
=
dgcsym1
(
s
,
ot
,
t
->
type
,
off
,
stack_size
);
// recursive call of dgcsym1
}
else
{
if
(
stack_size
<
GC_STACK_CAPACITY
)
{
ot
=
duintptr
(
s
,
ot
,
GC_ARRAY_START
);
// a stack push during GC
...
...
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