mirror of
https://github.com/golang/go
synced 2024-11-20 06:54:42 -07:00
cmd/gc: prepare for 64-bit ints
This CL makes the compiler understand that the type of the len or cap of a map, slice, or string is 'int', not 'int32'. It does not change the meaning of int, but it should make the eventual change of the meaning of int in 6g a bit smoother. Update #2188. R=ken, dave, remyoudompheng CC=golang-dev https://golang.org/cl/6542059
This commit is contained in:
parent
0bf46d0cf3
commit
650160e36a
@ -27,6 +27,7 @@ void
|
||||
betypeinit(void)
|
||||
{
|
||||
widthptr = 4;
|
||||
widthint = 4;
|
||||
|
||||
zprog.link = P;
|
||||
zprog.as = AGOK;
|
||||
|
@ -309,7 +309,7 @@ cgen(Node *n, Node *res)
|
||||
|
||||
case OLEN:
|
||||
if(istype(nl->type, TMAP) || istype(nl->type, TCHAN)) {
|
||||
// map and chan have len in the first 32-bit word.
|
||||
// map and chan have len in the first int-sized word.
|
||||
// a zero pointer means zero length
|
||||
regalloc(&n1, types[tptr], res);
|
||||
cgen(nl, &n1);
|
||||
@ -320,7 +320,7 @@ cgen(Node *n, Node *res)
|
||||
|
||||
n2 = n1;
|
||||
n2.op = OINDREG;
|
||||
n2.type = types[TINT32];
|
||||
n2.type = types[simtype[TINT]];
|
||||
gmove(&n2, &n1);
|
||||
|
||||
patch(p1, pc);
|
||||
@ -333,7 +333,7 @@ cgen(Node *n, Node *res)
|
||||
// both slice and string have len one pointer into the struct.
|
||||
// a zero pointer means zero length
|
||||
igen(nl, &n1, res);
|
||||
n1.type = types[TUINT32];
|
||||
n1.type = types[simtype[TUINT]];
|
||||
n1.xoffset += Array_nel;
|
||||
gmove(&n1, res);
|
||||
regfree(&n1);
|
||||
@ -344,7 +344,7 @@ cgen(Node *n, Node *res)
|
||||
|
||||
case OCAP:
|
||||
if(istype(nl->type, TCHAN)) {
|
||||
// chan has cap in the second 32-bit word.
|
||||
// chan has cap in the second int-sized word.
|
||||
// a zero pointer means zero length
|
||||
regalloc(&n1, types[tptr], res);
|
||||
cgen(nl, &n1);
|
||||
@ -355,8 +355,8 @@ cgen(Node *n, Node *res)
|
||||
|
||||
n2 = n1;
|
||||
n2.op = OINDREG;
|
||||
n2.xoffset = 4;
|
||||
n2.type = types[TINT32];
|
||||
n2.xoffset = widthint;
|
||||
n2.type = types[simtype[TINT]];
|
||||
gmove(&n2, &n1);
|
||||
|
||||
patch(p1, pc);
|
||||
@ -367,7 +367,7 @@ cgen(Node *n, Node *res)
|
||||
}
|
||||
if(isslice(nl->type)) {
|
||||
igen(nl, &n1, res);
|
||||
n1.type = types[TUINT32];
|
||||
n1.type = types[simtype[TUINT]];
|
||||
n1.xoffset += Array_cap;
|
||||
gmove(&n1, res);
|
||||
regfree(&n1);
|
||||
@ -596,7 +596,7 @@ agen(Node *n, Node *res)
|
||||
nlen.type = types[tptr];
|
||||
nlen.xoffset += Array_array;
|
||||
gmove(&nlen, &n3);
|
||||
nlen.type = types[TUINT32];
|
||||
nlen.type = types[simtype[TUINT]];
|
||||
nlen.xoffset += Array_nel-Array_array;
|
||||
}
|
||||
}
|
||||
@ -621,7 +621,7 @@ agen(Node *n, Node *res)
|
||||
nlen.type = types[tptr];
|
||||
nlen.xoffset += Array_array;
|
||||
gmove(&nlen, &n3);
|
||||
nlen.type = types[TUINT32];
|
||||
nlen.type = types[simtype[TUINT]];
|
||||
nlen.xoffset += Array_nel-Array_array;
|
||||
}
|
||||
}
|
||||
@ -656,9 +656,9 @@ agen(Node *n, Node *res)
|
||||
v = mpgetfix(nr->val.u.xval);
|
||||
if(isslice(nl->type) || nl->type->etype == TSTRING) {
|
||||
if(!debug['B'] && !n->bounded) {
|
||||
nodconst(&n2, types[TUINT32], v);
|
||||
gins(optoas(OCMP, types[TUINT32]), &nlen, &n2);
|
||||
p1 = gbranch(optoas(OGT, types[TUINT32]), T, +1);
|
||||
nodconst(&n2, types[simtype[TUINT]], v);
|
||||
gins(optoas(OCMP, types[simtype[TUINT]]), &nlen, &n2);
|
||||
p1 = gbranch(optoas(OGT, types[simtype[TUINT]]), T, +1);
|
||||
ginscall(panicindex, -1);
|
||||
patch(p1, pc);
|
||||
}
|
||||
@ -683,7 +683,7 @@ agen(Node *n, Node *res)
|
||||
|
||||
if(!debug['B'] && !n->bounded) {
|
||||
// check bounds
|
||||
t = types[TUINT32];
|
||||
t = types[simtype[TUINT]];
|
||||
if(is64(nr->type))
|
||||
t = types[TUINT64];
|
||||
if(isconst(nl, CTSTR)) {
|
||||
@ -1350,7 +1350,7 @@ componentgen(Node *nr, Node *nl)
|
||||
gmove(&nodr, &nodl);
|
||||
|
||||
nodl.xoffset += Array_nel-Array_array;
|
||||
nodl.type = types[TUINT32];
|
||||
nodl.type = types[simtype[TUINT]];
|
||||
|
||||
if(nr != N) {
|
||||
nodr.xoffset += Array_nel-Array_array;
|
||||
@ -1360,7 +1360,7 @@ componentgen(Node *nr, Node *nl)
|
||||
gmove(&nodr, &nodl);
|
||||
|
||||
nodl.xoffset += Array_cap-Array_nel;
|
||||
nodl.type = types[TUINT32];
|
||||
nodl.type = types[simtype[TUINT]];
|
||||
|
||||
if(nr != N) {
|
||||
nodr.xoffset += Array_cap-Array_nel;
|
||||
@ -1383,7 +1383,7 @@ componentgen(Node *nr, Node *nl)
|
||||
gmove(&nodr, &nodl);
|
||||
|
||||
nodl.xoffset += Array_nel-Array_array;
|
||||
nodl.type = types[TUINT32];
|
||||
nodl.type = types[simtype[TUINT]];
|
||||
|
||||
if(nr != N) {
|
||||
nodr.xoffset += Array_nel-Array_array;
|
||||
|
@ -27,6 +27,7 @@ void
|
||||
betypeinit(void)
|
||||
{
|
||||
widthptr = 8;
|
||||
widthint = 4;
|
||||
|
||||
zprog.link = P;
|
||||
zprog.as = AGOK;
|
||||
|
@ -21,7 +21,7 @@ struct Addr
|
||||
Sym* gotype;
|
||||
Sym* sym;
|
||||
Node* node;
|
||||
int width;
|
||||
int64 width;
|
||||
uchar type;
|
||||
uchar index;
|
||||
uchar etype;
|
||||
|
@ -312,8 +312,8 @@ datastring(char *s, int len, Addr *a)
|
||||
a->type = D_EXTERN;
|
||||
a->sym = sym;
|
||||
a->node = sym->def;
|
||||
a->offset = widthptr+4; // skip header
|
||||
a->etype = TINT32;
|
||||
a->offset = widthptr+widthint; // skip header
|
||||
a->etype = simtype[TINT];
|
||||
}
|
||||
|
||||
/*
|
||||
@ -386,10 +386,10 @@ gdatastring(Node *nam, Strlit *sval)
|
||||
p->to.type = D_ADDR;
|
||||
//print("%P\n", p);
|
||||
|
||||
nodconst(&nod1, types[TINT32], sval->len);
|
||||
nodconst(&nod1, types[TINT], sval->len);
|
||||
p = gins(ADATA, nam, &nod1);
|
||||
p->from.scale = types[TINT32]->width;
|
||||
p->from.offset += types[tptr]->width;
|
||||
p->from.scale = widthint;
|
||||
p->from.offset += widthptr;
|
||||
}
|
||||
|
||||
int
|
||||
@ -408,7 +408,7 @@ dstringptr(Sym *s, int off, char *str)
|
||||
datastring(str, strlen(str)+1, &p->to);
|
||||
p->to.index = p->to.type;
|
||||
p->to.type = D_ADDR;
|
||||
p->to.etype = TINT32;
|
||||
p->to.etype = simtype[TINT];
|
||||
off += widthptr;
|
||||
|
||||
return off;
|
||||
@ -432,7 +432,7 @@ dgostrlitptr(Sym *s, int off, Strlit *lit)
|
||||
datagostring(lit, &p->to);
|
||||
p->to.index = p->to.type;
|
||||
p->to.type = D_ADDR;
|
||||
p->to.etype = TINT32;
|
||||
p->to.etype = simtype[TINT];
|
||||
off += widthptr;
|
||||
|
||||
return off;
|
||||
|
@ -1247,9 +1247,9 @@ naddr(Node *n, Addr *a, int canemitcode)
|
||||
naddr(n->left, a, canemitcode);
|
||||
if(a->type == D_CONST && a->offset == 0)
|
||||
break; // len(nil)
|
||||
a->etype = TUINT32;
|
||||
a->etype = simtype[TUINT];
|
||||
a->offset += Array_nel;
|
||||
a->width = 4;
|
||||
a->width = widthint;
|
||||
if(a->offset >= unmappedzero && a->offset-Array_nel < unmappedzero)
|
||||
checkoffset(a, canemitcode);
|
||||
break;
|
||||
@ -1259,9 +1259,9 @@ naddr(Node *n, Addr *a, int canemitcode)
|
||||
naddr(n->left, a, canemitcode);
|
||||
if(a->type == D_CONST && a->offset == 0)
|
||||
break; // cap(nil)
|
||||
a->etype = TUINT32;
|
||||
a->etype = simtype[TUINT];
|
||||
a->offset += Array_cap;
|
||||
a->width = 4;
|
||||
a->width = widthint;
|
||||
if(a->offset >= unmappedzero && a->offset-Array_cap < unmappedzero)
|
||||
checkoffset(a, canemitcode);
|
||||
break;
|
||||
@ -2086,12 +2086,12 @@ oindex:
|
||||
if(!debug['B'] && !n->bounded) {
|
||||
// check bounds
|
||||
n4.op = OXXX;
|
||||
t = types[TUINT32];
|
||||
t = types[simtype[TUINT]];
|
||||
if(o & ODynam) {
|
||||
if(o & OAddable) {
|
||||
n2 = *l;
|
||||
n2.xoffset += Array_nel;
|
||||
n2.type = types[TUINT32];
|
||||
n2.type = types[simtype[TUINT]];
|
||||
if(is64(r->type)) {
|
||||
t = types[TUINT64];
|
||||
regalloc(&n4, t, N);
|
||||
@ -2102,7 +2102,7 @@ oindex:
|
||||
n2 = *reg;
|
||||
n2.xoffset = Array_nel;
|
||||
n2.op = OINDREG;
|
||||
n2.type = types[TUINT32];
|
||||
n2.type = types[simtype[TUINT]];
|
||||
if(is64(r->type)) {
|
||||
t = types[TUINT64];
|
||||
regalloc(&n4, t, N);
|
||||
@ -2180,8 +2180,8 @@ oindex_const:
|
||||
n1.type = types[tptr];
|
||||
n1.xoffset = Array_nel;
|
||||
nodconst(&n2, types[TUINT64], v);
|
||||
gins(optoas(OCMP, types[TUINT32]), &n1, &n2);
|
||||
p1 = gbranch(optoas(OGT, types[TUINT32]), T, +1);
|
||||
gins(optoas(OCMP, types[simtype[TUINT]]), &n1, &n2);
|
||||
p1 = gbranch(optoas(OGT, types[simtype[TUINT]]), T, +1);
|
||||
ginscall(panicindex, -1);
|
||||
patch(p1, pc);
|
||||
}
|
||||
@ -2223,9 +2223,9 @@ oindex_const_sudo:
|
||||
if(!debug['B'] && !n->bounded) {
|
||||
a->offset += Array_nel;
|
||||
nodconst(&n2, types[TUINT64], v);
|
||||
p1 = gins(optoas(OCMP, types[TUINT32]), N, &n2);
|
||||
p1 = gins(optoas(OCMP, types[simtype[TUINT]]), N, &n2);
|
||||
p1->from = *a;
|
||||
p1 = gbranch(optoas(OGT, types[TUINT32]), T, +1);
|
||||
p1 = gbranch(optoas(OGT, types[simtype[TUINT]]), T, +1);
|
||||
ginscall(panicindex, -1);
|
||||
patch(p1, pc);
|
||||
a->offset -= Array_nel;
|
||||
|
@ -945,7 +945,8 @@ Bits
|
||||
mkvar(Reg *r, Adr *a)
|
||||
{
|
||||
Var *v;
|
||||
int i, t, n, et, z, w, flag;
|
||||
int i, t, n, et, z, flag;
|
||||
int64 w;
|
||||
uint32 regu;
|
||||
int32 o;
|
||||
Bits bit;
|
||||
@ -998,7 +999,7 @@ mkvar(Reg *r, Adr *a)
|
||||
o = a->offset;
|
||||
w = a->width;
|
||||
if(w < 0)
|
||||
fatal("bad width %d for %D", w, a);
|
||||
fatal("bad width %lld for %D", w, a);
|
||||
|
||||
flag = 0;
|
||||
for(i=0; i<nvar; i++) {
|
||||
|
@ -27,6 +27,7 @@ void
|
||||
betypeinit(void)
|
||||
{
|
||||
widthptr = 4;
|
||||
widthint = 4;
|
||||
|
||||
zprog.link = P;
|
||||
zprog.as = AGOK;
|
||||
|
@ -615,12 +615,12 @@ typeinit(void)
|
||||
}
|
||||
|
||||
Array_array = rnd(0, widthptr);
|
||||
Array_nel = rnd(Array_array+widthptr, types[TUINT32]->width);
|
||||
Array_cap = rnd(Array_nel+types[TUINT32]->width, types[TUINT32]->width);
|
||||
sizeof_Array = rnd(Array_cap+types[TUINT32]->width, widthptr);
|
||||
Array_nel = rnd(Array_array+widthptr, widthint);
|
||||
Array_cap = rnd(Array_nel+widthint, widthint);
|
||||
sizeof_Array = rnd(Array_cap+widthint, widthptr);
|
||||
|
||||
// string is same as slice wo the cap
|
||||
sizeof_String = rnd(Array_nel+types[TUINT32]->width, widthptr);
|
||||
sizeof_String = rnd(Array_nel+widthint, widthptr);
|
||||
|
||||
dowidth(types[TSTRING]);
|
||||
dowidth(idealstring);
|
||||
|
@ -763,7 +763,7 @@ cgen_eface(Node *n, Node *res)
|
||||
* generate:
|
||||
* res = s[lo, hi];
|
||||
* n->left is s
|
||||
* n->list is (cap(s)-lo(TUINT32), hi-lo(TUINT32)[, lo*width(TUINTPTR)])
|
||||
* n->list is (cap(s)-lo(TUINT), hi-lo(TUINT)[, lo*width(TUINTPTR)])
|
||||
* caller (cgen) guarantees res is an addable ONAME.
|
||||
*/
|
||||
void
|
||||
@ -780,14 +780,14 @@ cgen_slice(Node *n, Node *res)
|
||||
// dst.len = hi [ - lo ]
|
||||
dst = *res;
|
||||
dst.xoffset += Array_nel;
|
||||
dst.type = types[TUINT32];
|
||||
dst.type = types[simtype[TUINT]];
|
||||
cgen(len, &dst);
|
||||
|
||||
if(n->op != OSLICESTR) {
|
||||
// dst.cap = cap [ - lo ]
|
||||
dst = *res;
|
||||
dst.xoffset += Array_cap;
|
||||
dst.type = types[TUINT32];
|
||||
dst.type = types[simtype[TUINT]];
|
||||
cgen(cap, &dst);
|
||||
}
|
||||
|
||||
|
@ -905,6 +905,7 @@ EXTERN int hasdefer; // flag that curfn has defer statetment
|
||||
EXTERN Node* curfn;
|
||||
|
||||
EXTERN int widthptr;
|
||||
EXTERN int widthint;
|
||||
|
||||
EXTERN Node* typesw;
|
||||
EXTERN Node* nblank;
|
||||
|
@ -302,8 +302,8 @@ stringsym(char *s, int len)
|
||||
off = 0;
|
||||
|
||||
// string header
|
||||
off = dsymptr(sym, off, sym, widthptr+4);
|
||||
off = duint32(sym, off, len);
|
||||
off = dsymptr(sym, off, sym, widthptr+widthint);
|
||||
off = duintxx(sym, off, len, widthint);
|
||||
|
||||
// string data
|
||||
for(n=0; n<len; n+=m) {
|
||||
|
@ -378,9 +378,9 @@ dextratype(Sym *sym, int off, Type *t, int ptroff)
|
||||
}
|
||||
|
||||
// slice header
|
||||
ot = dsymptr(s, ot, s, ot + widthptr + 2*4);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = dsymptr(s, ot, s, ot + widthptr + 2*widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
|
||||
// methods
|
||||
for(a=m; a; a=a->link) {
|
||||
@ -780,13 +780,13 @@ ok:
|
||||
|
||||
// two slice headers: in and out.
|
||||
ot = rnd(ot, widthptr);
|
||||
ot = dsymptr(s, ot, s, ot+2*(widthptr+2*4));
|
||||
ot = dsymptr(s, ot, s, ot+2*(widthptr+2*widthint));
|
||||
n = t->thistuple + t->intuple;
|
||||
ot = duint32(s, ot, n);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = dsymptr(s, ot, s, ot+1*(widthptr+2*4)+n*widthptr);
|
||||
ot = duint32(s, ot, t->outtuple);
|
||||
ot = duint32(s, ot, t->outtuple);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
ot = dsymptr(s, ot, s, ot+1*(widthptr+2*widthint)+n*widthptr);
|
||||
ot = duintxx(s, ot, t->outtuple, widthint);
|
||||
ot = duintxx(s, ot, t->outtuple, widthint);
|
||||
|
||||
// slice data
|
||||
for(t1=getthisx(t)->type; t1; t1=t1->down, n++)
|
||||
@ -808,9 +808,9 @@ ok:
|
||||
// ../../pkg/runtime/type.go:/InterfaceType
|
||||
ot = dcommontype(s, ot, t);
|
||||
xt = ot - 2*widthptr;
|
||||
ot = dsymptr(s, ot, s, ot+widthptr+2*4);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = dsymptr(s, ot, s, ot+widthptr+2*widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
for(a=m; a; a=a->link) {
|
||||
// ../../pkg/runtime/type.go:/imethod
|
||||
ot = dgostringptr(s, ot, a->name);
|
||||
@ -853,9 +853,9 @@ ok:
|
||||
}
|
||||
ot = dcommontype(s, ot, t);
|
||||
xt = ot - 2*widthptr;
|
||||
ot = dsymptr(s, ot, s, ot+widthptr+2*4);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = duint32(s, ot, n);
|
||||
ot = dsymptr(s, ot, s, ot+widthptr+2*widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
ot = duintxx(s, ot, n, widthint);
|
||||
for(t1=t->type; t1!=T; t1=t1->down) {
|
||||
// ../../pkg/runtime/type.go:/structField
|
||||
if(t1->sym && !t1->embedded) {
|
||||
|
@ -46,8 +46,6 @@ func appendstr(typ *byte, x []byte, y string) []byte
|
||||
|
||||
func cmpstring(string, string) int
|
||||
func eqstring(string, string) bool
|
||||
func slicestring(string, int, int) string
|
||||
func slicestring1(string, int) string
|
||||
func intstring(int64) string
|
||||
func slicebytetostring([]byte) string
|
||||
func slicerunetostring([]rune) string
|
||||
@ -55,7 +53,7 @@ func stringtoslicebyte(string) []byte
|
||||
func stringtoslicerune(string) []rune
|
||||
func stringiter(string, int) int
|
||||
func stringiter2(string, int) (retk int, retv rune)
|
||||
func copy(to any, fr any, wid uint32) int
|
||||
func copy(to any, fr any, wid uintptr) int
|
||||
func slicestringcopy(to any, fr any) int
|
||||
|
||||
// interface conversions
|
||||
@ -109,7 +107,7 @@ func selectnbsend(chanType *byte, hchan chan<- any, elem any) bool
|
||||
func selectnbrecv(chanType *byte, elem *any, hchan <-chan any) bool
|
||||
func selectnbrecv2(chanType *byte, elem *any, received *bool, hchan <-chan any) bool
|
||||
|
||||
func newselect(size int) (sel *byte)
|
||||
func newselect(size int32) (sel *byte)
|
||||
func selectsend(sel *byte, hchan chan<- any, elem *any) (selected bool)
|
||||
func selectrecv(sel *byte, hchan <-chan any, elem *any) (selected bool)
|
||||
func selectrecv2(sel *byte, hchan <-chan any, elem *any, received *bool) (selected bool)
|
||||
|
@ -300,9 +300,9 @@ staticcopy(Node *l, Node *r, NodeList **out)
|
||||
n1.xoffset = l->xoffset + Array_array;
|
||||
gdata(&n1, nod(OADDR, a, N), widthptr);
|
||||
n1.xoffset = l->xoffset + Array_nel;
|
||||
gdata(&n1, r->right, 4);
|
||||
gdata(&n1, r->right, widthint);
|
||||
n1.xoffset = l->xoffset + Array_cap;
|
||||
gdata(&n1, r->right, 4);
|
||||
gdata(&n1, r->right, widthint);
|
||||
return 1;
|
||||
}
|
||||
// fall through
|
||||
@ -403,9 +403,9 @@ staticassign(Node *l, Node *r, NodeList **out)
|
||||
n1.xoffset = l->xoffset + Array_array;
|
||||
gdata(&n1, nod(OADDR, a, N), widthptr);
|
||||
n1.xoffset = l->xoffset + Array_nel;
|
||||
gdata(&n1, r->right, 4);
|
||||
gdata(&n1, r->right, widthint);
|
||||
n1.xoffset = l->xoffset + Array_cap;
|
||||
gdata(&n1, r->right, 4);
|
||||
gdata(&n1, r->right, widthint);
|
||||
// Fall through to init underlying array.
|
||||
l = a;
|
||||
}
|
||||
@ -1232,11 +1232,11 @@ slice:
|
||||
gdata(&nam, nl, types[tptr]->width);
|
||||
|
||||
nam.xoffset += Array_nel-Array_array;
|
||||
nodconst(&nod1, types[TINT32], nr->type->bound);
|
||||
gdata(&nam, &nod1, types[TINT32]->width);
|
||||
nodconst(&nod1, types[TINT], nr->type->bound);
|
||||
gdata(&nam, &nod1, widthint);
|
||||
|
||||
nam.xoffset += Array_cap-Array_nel;
|
||||
gdata(&nam, &nod1, types[TINT32]->width);
|
||||
gdata(&nam, &nod1, widthint);
|
||||
|
||||
goto yes;
|
||||
|
||||
|
@ -2496,7 +2496,7 @@ sliceany(Node* n, NodeList **init)
|
||||
chk1 = N;
|
||||
chk2 = N;
|
||||
|
||||
bt = types[TUINT32];
|
||||
bt = types[simtype[TUINT]];
|
||||
if(hb != N && hb->type->width > 4)
|
||||
bt = types[TUINT64];
|
||||
if(lb != N && lb->type->width > 4)
|
||||
@ -2546,18 +2546,18 @@ sliceany(Node* n, NodeList **init)
|
||||
n->right = N;
|
||||
n->list = nil;
|
||||
if(lb == N)
|
||||
bound = conv(bound, types[TUINT32]);
|
||||
bound = conv(bound, types[simtype[TUINT]]);
|
||||
else
|
||||
bound = nod(OSUB, conv(bound, types[TUINT32]), conv(lb, types[TUINT32]));
|
||||
bound = nod(OSUB, conv(bound, types[simtype[TUINT]]), conv(lb, types[simtype[TUINT]]));
|
||||
typecheck(&bound, Erv);
|
||||
walkexpr(&bound, init);
|
||||
n->list = list(n->list, bound);
|
||||
|
||||
// len = hi [ - lo]
|
||||
if(lb == N)
|
||||
hb = conv(hb, types[TUINT32]);
|
||||
hb = conv(hb, types[simtype[TUINT]]);
|
||||
else
|
||||
hb = nod(OSUB, conv(hb, types[TUINT32]), conv(lb, types[TUINT32]));
|
||||
hb = nod(OSUB, conv(hb, types[simtype[TUINT]]), conv(lb, types[simtype[TUINT]]));
|
||||
typecheck(&hb, Erv);
|
||||
walkexpr(&hb, init);
|
||||
n->list = list(n->list, hb);
|
||||
|
Loading…
Reference in New Issue
Block a user