changed this a bit to be nicer

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4070
This commit is contained in:
David Anderson 2006-09-14 07:02:02 +00:00
parent c0f7e0b579
commit f53fe346ae
3 changed files with 16 additions and 15 deletions

View File

@ -1165,7 +1165,7 @@ void dynarray_from_heaplist(heapuse_list_t *heap)
} }
free(heap); free(heap);
if (total) if (total)
setheap_save(total); setheap_save(-total*sizeof(cell));
} }
static int hier13(value *lval) static int hier13(value *lval)
@ -1193,11 +1193,11 @@ static int hier13(value *lval)
if (lval->ident==iCONSTEXPR) /* load constant here */ if (lval->ident==iCONSTEXPR) /* load constant here */
ldconst(lval->constval,sPRI); ldconst(lval->constval,sPRI);
sc_allowtags=(short)POPSTK_I(); /* restore */ sc_allowtags=(short)POPSTK_I(); /* restore */
jumplabel(flab2);
setlabel(flab1);
heap=popsaveheaplist(); heap=popsaveheaplist();
dynarray_from_heaplist(heap); dynarray_from_heaplist(heap);
pushheaplist(); pushheaplist();
jumplabel(flab2);
setlabel(flab1);
needtoken(':'); needtoken(':');
if (hier13(&lval2)) if (hier13(&lval2))
rvalue(&lval2); rvalue(&lval2);
@ -1215,9 +1215,9 @@ static int hier13(value *lval)
/* ??? if both are arrays, should check dimensions */ /* ??? if both are arrays, should check dimensions */
if (!matchtag(lval->tag,lval2.tag,FALSE)) if (!matchtag(lval->tag,lval2.tag,FALSE))
error(213); /* tagname mismatch ('true' and 'false' expressions) */ error(213); /* tagname mismatch ('true' and 'false' expressions) */
setlabel(flab2);
heap=popsaveheaplist(); heap=popsaveheaplist();
dynarray_from_heaplist(heap); dynarray_from_heaplist(heap);
setlabel(flab2);
if (array1 && array2) { if (array1 && array2) {
markheap(HEAPUSE_DYNAMIC, 0); markheap(HEAPUSE_DYNAMIC, 0);
} }

View File

@ -846,22 +846,21 @@ SC_FUNC void modheap(int delta)
SC_FUNC void modheap_i() SC_FUNC void modheap_i()
{ {
stgwrite("\theap.i\n"); pushreg(sPRI);
code_idx+=opcodes(1); pushreg(sALT);
stgwrite("\tpop.h.pri\n");
stgwrite("\theap.pri\n");
code_idx+=opcodes(2);
popreg(sALT);
popreg(sPRI);
} }
SC_FUNC void setheap_save(cell value) SC_FUNC void setheap_save(cell value)
{ {
pushreg(sPRI); assert(value);
pushreg(sALT); stgwrite("\tpush.h.c ");
stgwrite("\tconst.pri ");
outval(value, TRUE); outval(value, TRUE);
code_idx+=opcodes(1)+opargs(1); code_idx+=opcodes(1)+opargs(1);
stgwrite("\theap ");
outval(sizeof(cell), TRUE);
stgwrite("\tstor.pri\n");
popreg(sALT);
popreg(sPRI);
} }
SC_FUNC void setheap_pri(void) SC_FUNC void setheap_pri(void)

View File

@ -493,7 +493,7 @@ static OPCODEC opcodelist[] = {
{ 99, "grtr", sIN_CSEG, parm0 }, { 99, "grtr", sIN_CSEG, parm0 },
{120, "halt", sIN_CSEG, parm1 }, {120, "halt", sIN_CSEG, parm1 },
{ 45, "heap", sIN_CSEG, parm1 }, { 45, "heap", sIN_CSEG, parm1 },
{160, "heap.i", sIN_CSEG, parm0 }, {160, "heap.pri", sIN_CSEG, parm0 },
{ 27, "idxaddr", sIN_CSEG, parm0 }, { 27, "idxaddr", sIN_CSEG, parm0 },
{ 28, "idxaddr.b", sIN_CSEG, parm1 }, { 28, "idxaddr.b", sIN_CSEG, parm1 },
{109, "inc", sIN_CSEG, parm1 }, {109, "inc", sIN_CSEG, parm1 },
@ -544,12 +544,14 @@ static OPCODEC opcodelist[] = {
{ 84, "not", sIN_CSEG, parm0 }, { 84, "not", sIN_CSEG, parm0 },
{ 82, "or", sIN_CSEG, parm0 }, { 82, "or", sIN_CSEG, parm0 },
{ 43, "pop.alt", sIN_CSEG, parm0 }, { 43, "pop.alt", sIN_CSEG, parm0 },
{162, "pop.h.pri", sIN_CSEG, parm0 },
{ 42, "pop.pri", sIN_CSEG, parm0 }, { 42, "pop.pri", sIN_CSEG, parm0 },
{ 46, "proc", sIN_CSEG, parm0 }, { 46, "proc", sIN_CSEG, parm0 },
{ 40, "push", sIN_CSEG, parm1 }, { 40, "push", sIN_CSEG, parm1 },
{133, "push.adr", sIN_CSEG, parm1 }, /* version 4 */ {133, "push.adr", sIN_CSEG, parm1 }, /* version 4 */
{ 37, "push.alt", sIN_CSEG, parm0 }, { 37, "push.alt", sIN_CSEG, parm0 },
{ 39, "push.c", sIN_CSEG, parm1 }, { 39, "push.c", sIN_CSEG, parm1 },
{161, "push.h.c", sIN_CSEG, parm1 },
{ 36, "push.pri", sIN_CSEG, parm0 }, { 36, "push.pri", sIN_CSEG, parm0 },
{ 38, "push.r", sIN_CSEG, parm1 }, /* obsolete (never generated) */ { 38, "push.r", sIN_CSEG, parm1 }, /* obsolete (never generated) */
{ 41, "push.s", sIN_CSEG, parm1 }, { 41, "push.s", sIN_CSEG, parm1 },