mirror of
https://github.com/golang/go
synced 2024-11-14 08:20:21 -07:00
sliceslice bug
R=rsc OCL=34050 CL=34050
This commit is contained in:
parent
47c568880d
commit
3983171b08
@ -1243,7 +1243,6 @@ sleasy(Node *n)
|
|||||||
return 0;
|
return 0;
|
||||||
if(!n->addable)
|
if(!n->addable)
|
||||||
return 0;
|
return 0;
|
||||||
return 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,42 +1348,42 @@ slicearray:
|
|||||||
|
|
||||||
sliceslice:
|
sliceslice:
|
||||||
getargs(n->list, nodes, 4);
|
getargs(n->list, nodes, 4);
|
||||||
if(!sleasy(&nodes[0])) {
|
if(!sleasy(nodes+0)) {
|
||||||
for(i=0; i<4; i++) {
|
for(i=0; i<4; i++) {
|
||||||
if(nodes[i].op == OREGISTER)
|
if((nodes+i)->op == OREGISTER)
|
||||||
regfree(&nodes[i]);
|
regfree(nodes+i);
|
||||||
}
|
}
|
||||||
goto no;
|
goto no;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(hb[2] > old.cap[0]) goto throw;
|
// if(hb[2] > old.cap[0]) goto throw;
|
||||||
n2 = nodes[0];
|
n2 = *(nodes+0);
|
||||||
n2.xoffset += Array_cap;
|
n2.xoffset += Array_cap;
|
||||||
cmpandthrow(nodes+2, &n2);
|
cmpandthrow(nodes+2, &n2);
|
||||||
|
|
||||||
// if(lb[1] > hb[2]) goto throw;
|
// if(lb[1] > hb[2]) goto throw;
|
||||||
cmpandthrow(&nodes[1], &nodes[2]);
|
cmpandthrow(nodes+1, nodes+2);
|
||||||
|
|
||||||
// ret.len = hb[2]-lb[1]; (destroys hb[2])
|
// ret.len = hb[2]-lb[1]; (destroys hb[2])
|
||||||
n2 = *res;
|
n2 = *res;
|
||||||
n2.xoffset += Array_nel;
|
n2.xoffset += Array_nel;
|
||||||
|
|
||||||
if(smallintconst(&nodes[2]) && smallintconst(&nodes[1])) {
|
if(smallintconst(nodes+2) && smallintconst(nodes+1)) {
|
||||||
v = mpgetfix((nodes+2)->val.u.xval) -
|
v = mpgetfix((nodes+2)->val.u.xval) -
|
||||||
mpgetfix(nodes[2].val.u.xval);
|
mpgetfix((nodes+1)->val.u.xval);
|
||||||
nodconst(&n1, types[TUINT32], v);
|
nodconst(&n1, types[TUINT32], v);
|
||||||
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
||||||
} else {
|
} else {
|
||||||
regalloc(&n1, types[TUINT32], nodes+2);
|
regalloc(&n1, types[TUINT32], nodes+2);
|
||||||
gmove(nodes+2, &n1);
|
gmove(nodes+2, &n1);
|
||||||
if(!smallintconst(&nodes[1]) || mpgetfix(nodes[1].val.u.xval) != 0)
|
if(!smallintconst(nodes+1) || mpgetfix((nodes+1)->val.u.xval) != 0)
|
||||||
gins(optoas(OSUB, types[TUINT32]), &nodes[1], &n1);
|
gins(optoas(OSUB, types[TUINT32]), nodes+1, &n1);
|
||||||
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
||||||
regfree(&n1);
|
regfree(&n1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ret.cap = old.cap[0]-lb[1]; (uses hb[2])
|
// ret.cap = old.cap[0]-lb[1]; (uses hb[2])
|
||||||
n2 = nodes[0];
|
n2 = *(nodes+0);
|
||||||
n2.xoffset += Array_cap;
|
n2.xoffset += Array_cap;
|
||||||
|
|
||||||
regalloc(&n1, types[TUINT32], nodes+2);
|
regalloc(&n1, types[TUINT32], nodes+2);
|
||||||
@ -1397,8 +1396,8 @@ sliceslice:
|
|||||||
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
gins(optoas(OAS, types[TUINT32]), &n1, &n2);
|
||||||
regfree(&n1);
|
regfree(&n1);
|
||||||
|
|
||||||
// ret.array = old.array[0]+lb[1]*width[3]; (uses lb)
|
// ret.array = old.array[0]+lb[1]*width[3]; (uses lb[1])
|
||||||
n2 = nodes[0];
|
n2 = *(nodes+0);
|
||||||
n2.xoffset += Array_array;
|
n2.xoffset += Array_array;
|
||||||
|
|
||||||
regalloc(&n1, types[tptr], nodes+1);
|
regalloc(&n1, types[tptr], nodes+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user