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
8e3fe10e
Commit
8e3fe10e
authored
Nov 24, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. retract general field names
2. array bounds bug 3. ... optimization bug R=r OCL=19927 CL=19927
parent
2a874603
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
9 deletions
+33
-9
src/cmd/6g/cgen.c
src/cmd/6g/cgen.c
+30
-3
src/cmd/6g/reg.c
src/cmd/6g/reg.c
+2
-2
src/cmd/gc/go.y
src/cmd/gc/go.y
+1
-4
No files found.
src/cmd/6g/cgen.c
View file @
8e3fe10e
...
...
@@ -406,17 +406,44 @@ agen(Node *n, Node *res)
if
(
w
==
0
)
fatal
(
"index is zero width"
);
// constant index
if
(
whatis
(
nr
)
==
Wlitint
)
{
v
=
mpgetfix
(
nr
->
val
.
u
.
xval
);
if
(
isptrdarray
(
nl
->
type
))
{
if
(
!
debug
[
'B'
])
{
n1
=
n3
;
n1
.
op
=
OINDREG
;
n1
.
type
=
types
[
tptr
];
n1
.
xoffset
=
offsetof
(
Array
,
nel
);
nodconst
(
&
n2
,
types
[
TUINT64
],
v
);
gins
(
optoas
(
OCMP
,
types
[
TUINT32
]),
&
n1
,
&
n2
);
p1
=
gbranch
(
optoas
(
OGT
,
types
[
TUINT32
]),
T
);
gins
(
ACALL
,
N
,
throwindex
);
patch
(
p1
,
pc
);
}
n1
=
n3
;
n1
.
op
=
OINDREG
;
n1
.
type
=
types
[
tptr
];
n1
.
xoffset
=
offsetof
(
Array
,
array
);
gmove
(
&
n1
,
&
n3
);
}
else
if
(
!
debug
[
'B'
])
{
if
(
v
<
0
)
yyerror
(
"out of bounds on array"
);
else
if
(
isptrarray
(
nl
->
type
))
{
if
(
v
>=
nl
->
type
->
type
->
bound
)
yyerror
(
"out of bounds on array"
);
}
else
if
(
v
>=
nl
->
type
->
bound
)
yyerror
(
"out of bounds on array"
);
}
v
=
mpgetfix
(
nr
->
val
.
u
.
xval
);
nodconst
(
&
n2
,
types
[
tptr
],
v
*
w
);
gins
(
optoas
(
OADD
,
types
[
tptr
]),
&
n2
,
&
n3
);
gmove
(
&
n3
,
res
);
regfree
(
&
n3
);
break
;
...
...
@@ -443,8 +470,8 @@ agen(Node *n, Node *res)
if
(
isptrarray
(
nl
->
type
))
nodconst
(
&
n1
,
types
[
TUINT64
],
nl
->
type
->
type
->
bound
);
}
gins
(
optoas
(
OCMP
,
types
[
TUINT
64
]),
&
n2
,
&
n1
);
p1
=
gbranch
(
optoas
(
OLT
,
types
[
TUINT
64
]),
T
);
gins
(
optoas
(
OCMP
,
types
[
TUINT
32
]),
&
n2
,
&
n1
);
p1
=
gbranch
(
optoas
(
OLT
,
types
[
TUINT
32
]),
T
);
gins
(
ACALL
,
N
,
throwindex
);
patch
(
p1
,
pc
);
}
...
...
src/cmd/6g/reg.c
View file @
8e3fe10e
...
...
@@ -767,8 +767,8 @@ mkvar(Reg *r, Adr *a)
s
=
a
->
sym
;
if
(
s
==
S
)
goto
none
;
// if(
s->name[0] == '.')
//
goto none;
if
(
s
->
name
[
0
]
==
'!'
||
s
->
name
[
0
]
==
'.'
)
goto
none
;
et
=
a
->
etype
;
o
=
a
->
offset
;
v
=
var
;
...
...
src/cmd/gc/go.y
View file @
8e3fe10e
...
...
@@ -993,9 +993,6 @@ sym1:
*/
sym2
:
sym1
|
LTYPE
|
LFUNC
|
LVAR
/*
*
keywords
that
can
be
variables
...
...
@@ -2014,7 +2011,7 @@ hidden_importsym:
* to check whether the rest of the grammar is free of
* reduce/reduce conflicts, comment this section out by
* removing the slash on the next line.
*
*
/
lpack:
LATYPE
{
...
...
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