added new op.genarray.z for zeroing arrays

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40128
This commit is contained in:
David Anderson 2006-10-17 03:44:37 +00:00
parent e3dccb8ae4
commit 53be062c6b
4 changed files with 9 additions and 4 deletions

View File

@ -590,7 +590,7 @@ SC_FUNC void moveto1(void);
SC_FUNC void pushreg(regid reg); SC_FUNC void pushreg(regid reg);
SC_FUNC void pushval(cell val); SC_FUNC void pushval(cell val);
SC_FUNC void popreg(regid reg); SC_FUNC void popreg(regid reg);
SC_FUNC void genarray(int dims); SC_FUNC void genarray(int dims, int _autozero);
SC_FUNC void swap1(void); SC_FUNC void swap1(void);
SC_FUNC void ffswitch(int label); SC_FUNC void ffswitch(int label);
SC_FUNC void ffcase(cell value,char *labelname,int newtable); SC_FUNC void ffcase(cell value,char *labelname,int newtable);

View File

@ -1961,7 +1961,7 @@ static int declloc(int fstatic)
needtoken(')'); needtoken(')');
numdim++; numdim++;
} while (matchtoken('(')); } while (matchtoken('('));
genarray(numdim); genarray(numdim, autozero);
} }
if (getstates(name)) if (getstates(name))
error(88,name); /* local variables may not have states */ error(88,name); /* local variables may not have states */

View File

@ -675,9 +675,13 @@ SC_FUNC void popreg(regid reg)
/* /*
* Generate an array * Generate an array
*/ */
SC_FUNC void genarray(int dims) SC_FUNC void genarray(int dims, int _autozero)
{ {
stgwrite("\tgenarray "); if (_autozero) {
stgwrite("\tgenarray.z ");
} else {
stgwrite("\tgenarray ");
}
outval(dims, TRUE); outval(dims, TRUE);
code_idx+=opcodes(1)+opargs(1); code_idx+=opcodes(1)+opargs(1);
} }

View File

@ -490,6 +490,7 @@ static OPCODEC opcodelist[] = {
/*{124, "file", sIN_CSEG, do_file }, */ /*{124, "file", sIN_CSEG, do_file }, */
{119, "fill", sIN_CSEG, parm1 }, {119, "fill", sIN_CSEG, parm1 },
{162, "genarray", sIN_CSEG, parm1 }, {162, "genarray", sIN_CSEG, parm1 },
{163, "genarray.z", sIN_CSEG, parm1 },
{100, "geq", sIN_CSEG, parm0 }, {100, "geq", sIN_CSEG, parm0 },
{ 99, "grtr", sIN_CSEG, parm0 }, { 99, "grtr", sIN_CSEG, parm0 },
{120, "halt", sIN_CSEG, parm1 }, {120, "halt", sIN_CSEG, parm1 },