fixed dynamic arrays not generating stack correctly
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40124
This commit is contained in:
parent
b7180795ec
commit
a19823e4c6
@ -620,6 +620,8 @@ typedef enum {
|
|||||||
OP_SYSREQ_ND,
|
OP_SYSREQ_ND,
|
||||||
/* ----- */
|
/* ----- */
|
||||||
OP_HEAP_I,
|
OP_HEAP_I,
|
||||||
|
OP_PUSH_H_C,
|
||||||
|
OP_GENARRAY,
|
||||||
OP_NUM_OPCODES
|
OP_NUM_OPCODES
|
||||||
} OPCODE;
|
} OPCODE;
|
||||||
|
|
||||||
|
@ -1942,7 +1942,6 @@ static int declloc(int fstatic)
|
|||||||
} while (matchtoken('['));
|
} while (matchtoken('['));
|
||||||
} else if (matchtoken('(')) {
|
} else if (matchtoken('(')) {
|
||||||
int dim_ident;
|
int dim_ident;
|
||||||
int dim_tag;
|
|
||||||
symbol *dim_sym;
|
symbol *dim_sym;
|
||||||
do {
|
do {
|
||||||
ident=iREFARRAY;
|
ident=iREFARRAY;
|
||||||
@ -1950,8 +1949,8 @@ static int declloc(int fstatic)
|
|||||||
error(53);
|
error(53);
|
||||||
return iREFARRAY;
|
return iREFARRAY;
|
||||||
} /* if */
|
} /* if */
|
||||||
dim_ident = doexpr(TRUE,FALSE,FALSE,FALSE,&dim_tag,&dim_sym,0);
|
dim_ident = doexpr(TRUE,FALSE,FALSE,FALSE,&idxtag[numdim],&dim_sym,0);
|
||||||
dim[numdim++] = 1;
|
dim[numdim] = 0;
|
||||||
if (dim_ident == iVARIABLE || dim_ident == iEXPRESSION) {
|
if (dim_ident == iVARIABLE || dim_ident == iEXPRESSION) {
|
||||||
pushreg(sPRI);
|
pushreg(sPRI);
|
||||||
} else if (dim_ident == iCONSTEXPR) {
|
} else if (dim_ident == iCONSTEXPR) {
|
||||||
@ -1959,9 +1958,8 @@ static int declloc(int fstatic)
|
|||||||
} else {
|
} else {
|
||||||
assert(0); //:TODO: make this an error
|
assert(0); //:TODO: make this an error
|
||||||
}
|
}
|
||||||
if (!matchtag(tag, dim_tag, FALSE))
|
|
||||||
error(213);
|
|
||||||
needtoken(')');
|
needtoken(')');
|
||||||
|
numdim++;
|
||||||
} while (matchtoken('('));
|
} while (matchtoken('('));
|
||||||
genarray(numdim);
|
genarray(numdim);
|
||||||
}
|
}
|
||||||
@ -2009,6 +2007,7 @@ static int declloc(int fstatic)
|
|||||||
//markexpr(sLDECL,name,-declared*sizeof(cell)); /* mark for better optimization */
|
//markexpr(sLDECL,name,-declared*sizeof(cell)); /* mark for better optimization */
|
||||||
/* genarray() pushes the address onto the stack, so we don't need to call modstk() here! */
|
/* genarray() pushes the address onto the stack, so we don't need to call modstk() here! */
|
||||||
markheap(MEMUSE_DYNAMIC, 0);
|
markheap(MEMUSE_DYNAMIC, 0);
|
||||||
|
markstack(MEMUSE_STATIC, 1);
|
||||||
assert(curfunc != NULL && ((curfunc->usage & uNATIVE) == 0));
|
assert(curfunc != NULL && ((curfunc->usage & uNATIVE) == 0));
|
||||||
if (curfunc->x.stacksize<declared+1)
|
if (curfunc->x.stacksize<declared+1)
|
||||||
curfunc->x.stacksize=declared+1; /* +1 for PROC opcode */
|
curfunc->x.stacksize=declared+1; /* +1 for PROC opcode */
|
||||||
|
Loading…
Reference in New Issue
Block a user