Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(665)

Unified Diff: src/cmd/5g/ggen.c

Issue 1848056: code review 1848056: gc: index bounds tests and fixes (Closed)
Patch Set: code review 1848056: gc: index bounds tests and fixes Created 14 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/5g/cgen.c ('k') | src/cmd/5g/gsubr.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/5g/ggen.c
===================================================================
--- a/src/cmd/5g/ggen.c
+++ b/src/cmd/5g/ggen.c
@@ -682,6 +682,29 @@
static Prog* throwpc;
+// We're only going to bother inlining if we can
+// convert all the arguments to 32 bits safely. Can we?
+static int
+fix64(NodeList *nn, int n)
+{
+ NodeList *l;
+ Node *r;
+ int i;
+
+ l = nn;
+ for(i=0; i<n; i++) {
+ r = l->n->right;
+ if(is64(r->type) && !smallintconst(r)) {
+ if(r->op == OCONV)
+ r = r->left;
+ if(is64(r->type))
+ return 0;
+ }
+ l = l->next;
+ }
+ return 1;
+}
+
void
getargs(NodeList *nn, Node *reg, int n)
{
@@ -813,6 +836,8 @@
slicearray:
if(!sleasy(res))
goto no;
+ if(!fix64(n->list, 5))
+ goto no;
getargs(n->list, nodes, 5);
// if(hb[3] > nel[1]) goto throw
@@ -904,6 +929,8 @@
return 1;
sliceslice:
+ if(!fix64(n->list, narg))
+ goto no;
ntemp.op = OXXX;
if(!sleasy(n->list->n->right)) {
Node *n0;
« no previous file with comments | « src/cmd/5g/cgen.c ('k') | src/cmd/5g/gsubr.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b