VarAction2: Avoid turning skip on zero/LSB set sequences into jumps

pull/428/head
Jonathan G Rennison 2 years ago
parent 0bec49fa56
commit 916441d943

@ -2084,6 +2084,8 @@ static void OptimiseVarAction2DeterministicSpriteGroupInsertJumps(DeterministicS
uint32 special_stores[16];
uint16 special_stores_mask = 0;
int j = i - 1;
int skip_count = 0;
const DeterministicSpriteGroupAdjustFlags skip_mask = adjust.adjust_flags & (DSGAF_SKIP_ON_ZERO | DSGAF_SKIP_ON_LSB_SET);
while (j >= 0) {
DeterministicSpriteGroupAdjust &prev = group->adjusts[j];
@ -2124,9 +2126,12 @@ static void OptimiseVarAction2DeterministicSpriteGroupInsertJumps(DeterministicS
ok_stores.set(prev.parameter & 0xFF, true);
}
/* Avoid creating jumps for skip on zero/LSB set sequences */
if (prev.adjust_flags & skip_mask) skip_count++;
j--;
}
if (j < i - 1) {
if (j < i - 1 && (i - j) > (skip_count + 2)) {
auto mark_end_block = [&](uint index, uint inc) {
if (group->adjusts[index].variable == 0x7E) {
/* Procedure call, can't mark this as an end block directly, so insert a NOOP and use that */

Loading…
Cancel
Save