forked from Mirrors/openclonk
Optimize do; while(!...) from two bytecodes to one
This revealed that the code for setting Par.i was wrong before, but didn't matter because the jump target for all CONDN was set afterwards. But the jumptarget for COND was set directly, and must be adjusted to account for the bytecode that gets optimized away.liquid_container
parent
168ac8bb40
commit
532b47ed27
|
@ -983,11 +983,11 @@ int C4AulParse::AddBCC(C4AulBCCType eType, intptr_t X)
|
|||
return Fn->GetCodePos() - 1;
|
||||
}
|
||||
|
||||
// Reduce Not + CONDN to COND
|
||||
if(eType == AB_CONDN && pCPos1->bccType == AB_Not)
|
||||
// Reduce Not + CONDN to COND, Not + COND to CONDN
|
||||
if((eType == AB_CONDN || eType == AB_COND) && pCPos1->bccType == AB_Not)
|
||||
{
|
||||
pCPos1->bccType = AB_COND;
|
||||
pCPos1->Par.i = X;
|
||||
pCPos1->bccType = eType == AB_CONDN ? AB_COND : AB_CONDN;
|
||||
pCPos1->Par.i = X + 1;
|
||||
return Fn->GetCodePos() - 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue