Commit 5f239787 authored by John van Groningen's avatar John van Groningen

remove some unnecessary update_a and pop_a instructions when updating to an ARRAY node

parent 909b0b60
......@@ -914,16 +914,17 @@ static void CodeRule (ImpRuleP rule)
case TupleState:
BuildTuple (asize,bsize,asize,bsize,function_state_p[-1].state_arity,
function_state_p[-1].state_tuple_arguments,asize, bsize, 0, ReleaseAndFill,False);
GenPopA (asize);
break;
case RecordState:
BuildRecord (function_state_p[-1].state_record_symbol,asize, bsize, asize, bsize,
asize, bsize, 0, ReleaseAndFill, False);
GenPopA (asize);
break;
case ArrayState:
GenFillArray (0, 1, ReleaseAndFill);
GenFillArrayAndPop (1, ReleaseAndFill);
break;
}
GenPopA (asize);
} else {
switch (function_state_p[-1].state_type){
case TupleState:
......@@ -938,12 +939,7 @@ static void CodeRule (ImpRuleP rule)
GenBuildArray (0);
break;
}
#if UPDATE_POP
GenUpdatePopA (0, asize);
#else
GenUpdateA (0, asize);
GenPopA (asize);
#endif
}
GenPopB (bsize);
......
......@@ -1103,18 +1103,19 @@ static void GenLazyFieldSelectorEntry (SymbDef field_def,StateS recstate,int tot
BuildTuple (asize,bsize,asize,bsize,
offfieldstate.state_arity,offfieldstate.state_tuple_arguments,
asize,bsize,0,ReleaseAndFill,False);
GenPopA (asize);
break;
case ArrayState:
GenFillArray (0,1,ReleaseAndFill);
GenFillArrayAndPop (1,ReleaseAndFill);
break;
#ifdef ADD_ARGUMENTS_TO_HIGHER_ORDER_FUNCTIONS
case RecordState:
BuildRecord (offfieldstate.state_record_symbol,asize,bsize,asize,bsize,
asize,bsize,0,ReleaseAndFill,False);
GenPopA (asize);
break;
#endif
}
GenPopA (asize);
GenPopB (bsize);
GenRtn (1,0,OnAState);
}
......@@ -1520,18 +1521,19 @@ Bool NodeEntry (StateS *const function_state_p,int arity,Label ealab,SymbDef roo
case TupleState:
BuildTuple (asize,bsize,asize,bsize,function_state_p[-1].state_arity,
function_state_p[-1].state_tuple_arguments,asize, bsize, 0, ReleaseAndFill,False);
GenPopA (asize);
break;
case RecordState:
BuildRecord (function_state_p[-1].state_record_symbol,asize,bsize,asize,bsize,
asize,bsize,0,ReleaseAndFill,False);
GenPopA (asize);
break;
case ArrayState:
GenFillArray (0, 1, ReleaseAndFill);
GenFillArrayAndPop (1, ReleaseAndFill);
break;
}
GenPopA (asize);
GenPopB (bsize);
GenPopB (bsize);
GenRtn (1,0,OnAState);
#if SHARE_UPDATE_CODE
}
......@@ -1690,18 +1692,19 @@ Bool NodeEntryUnboxed (StateS *const function_state_p,NodeP call_node_p,int args
case TupleState:
BuildTuple (asize,bsize,asize,bsize,function_state_p[-1].state_arity,
function_state_p[-1].state_tuple_arguments,asize, bsize, 0, ReleaseAndFill,False);
GenPopA (asize);
break;
case RecordState:
BuildRecord (function_state_p[-1].state_record_symbol,asize,bsize,asize,bsize,
asize,bsize,0,ReleaseAndFill,False);
GenPopA (asize);
break;
case ArrayState:
GenFillArray (0, 1, ReleaseAndFill);
GenFillArrayAndPop (1, ReleaseAndFill);
break;
}
GenPopA (asize);
GenPopB (bsize);
GenPopB (bsize);
GenRtn (1,0,OnAState);
# if SHARE_UPDATE_CODE
}
......
......@@ -271,15 +271,21 @@ void RedirectResultAndReturn (int asp,int bsp,int source_a_index,int source_b_in
BuildTuple (source_a_index,source_b_index,asp,bsp,
offstate.state_arity, offstate.state_tuple_arguments,
offasize, offbsize, 0, ReleaseAndFill,False);
GenPopA (asp);
break;
case RecordState:
BuildRecord (offstate.state_record_symbol,source_a_index,source_b_index, asp, bsp,
offasize, offbsize, 0, ReleaseAndFill,False);
GenPopA (asp);
break;
case ArrayState:
GenFillArray (asp-source_a_index,asp,ReleaseAndFill);
case ArrayState:
if (asp==source_a_index && asp==1)
GenFillArrayAndPop (asp,ReleaseAndFill);
else {
GenFillArray (asp-source_a_index,asp,ReleaseAndFill);
GenPopA (asp);
}
}
GenPopA (asp);
GenPopB (bsp);
}
} else {
......
......@@ -2351,6 +2351,11 @@ void GenFillFromA (int src, int dst, FillKind fkind)
TreatWaitListAfterFill (dst, fkind);
}
void GenFillArrayAndPop (int rootoffset, FillKind fkind)
{
GenFillh (&BasicDescriptors [ArrayObj], 1, rootoffset, fkind);
}
void GenFillArray (int argoffset, int rootoffset, FillKind fkind)
{
GenPushA (argoffset);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment