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
96cbdd62
Commit
96cbdd62
authored
Aug 23, 2010
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better job on 2007043
better registerization R=rsc CC=golang-dev
https://golang.org/cl/1955049
parent
534dbc73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
11 deletions
+45
-11
cgen.c
src/cmd/6g/cgen.c
+45
-11
No files found.
src/cmd/6g/cgen.c
View file @
96cbdd62
...
...
@@ -1109,6 +1109,22 @@ sgen(Node *n, Node *ns, int32 w)
restx
(
&
cx
,
&
oldcx
);
}
static
int
cadable
(
Node
*
n
)
{
if
(
!
n
->
addable
)
{
// dont know how it happens,
// but it does
return
0
;
}
switch
(
n
->
op
)
{
case
ONAME
:
return
1
;
}
return
0
;
}
/*
* copy a structure component by component
* return 1 if can do, 0 if cant.
...
...
@@ -1118,20 +1134,36 @@ int
componentgen
(
Node
*
nr
,
Node
*
nl
)
{
Node
nodl
,
nodr
;
int
free
;
int
free
l
,
freer
;
free
=
0
;
if
(
!
nl
->
addable
||
nl
->
op
!=
ONAME
)
freel
=
0
;
freer
=
0
;
switch
(
nl
->
type
->
etype
)
{
default:
goto
no
;
case
TARRAY
:
if
(
!
isslice
(
nl
->
type
))
goto
no
;
case
TSTRING
:
case
TINTER
:
break
;
}
nodl
=
*
nl
;
if
(
nr
!=
N
)
{
if
(
!
nr
->
addable
||
nr
->
op
!=
ONAME
)
if
(
!
cadable
(
nl
)
)
{
if
(
nr
==
N
||
!
cadable
(
nr
)
)
goto
no
;
igen
(
nl
,
&
nodl
,
N
);
freel
=
1
;
}
if
(
nr
!=
N
)
{
nodr
=
*
nr
;
if
(
nr
->
op
!=
ONAME
&&
nr
->
op
!=
OINDREG
)
{
if
(
!
cadable
(
nr
)
)
{
igen
(
nr
,
&
nodr
,
N
);
free
=
1
;
free
r
=
1
;
}
}
...
...
@@ -1173,7 +1205,6 @@ componentgen(Node *nr, Node *nl)
goto
yes
;
case
TSTRING
:
nodl
.
xoffset
+=
Array_array
;
nodl
.
type
=
ptrto
(
types
[
TUINT8
]);
...
...
@@ -1197,7 +1228,6 @@ componentgen(Node *nr, Node *nl)
goto
yes
;
case
TINTER
:
nodl
.
xoffset
+=
Array_array
;
nodl
.
type
=
ptrto
(
types
[
TUINT8
]);
...
...
@@ -1225,12 +1255,16 @@ componentgen(Node *nr, Node *nl)
}
no:
if
(
free
)
if
(
free
r
)
regfree
(
&
nodr
);
if
(
freel
)
regfree
(
&
nodl
);
return
0
;
yes:
if
(
free
)
if
(
free
r
)
regfree
(
&
nodr
);
if
(
freel
)
regfree
(
&
nodl
);
return
1
;
}
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