From d5026ed9b092385ddc8f4f1dba8613005e246bd9 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sun, 26 Nov 2023 21:34:06 +0100 Subject: [PATCH] Fix join common branch sequence --- include/conio.h | 2 ++ oscar64/NativeCodeGenerator.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/conio.h b/include/conio.h index 62a51ad..90d4251 100644 --- a/include/conio.h +++ b/include/conio.h @@ -31,6 +31,8 @@ void dispmode80col(void); #define PETSCII_CLEAR 0x94 #define PETSCII_DEL 0x14 #define PETSCII_INSERT 0x94 +#define PETSCII_STOP 0x0c +#define PETSCII_RETURN 0x0d #define PETSCII_F1 0x85 #define PETSCII_F2 0x89 diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 4f2e47b..45b397e 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -22178,10 +22178,12 @@ bool NativeCodeBasicBlock::JoinCommonBranchCodeSequences(void) if (j < mFalseJump->mIns.Size()) { int n = 0; - while (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() && ((mTrueJump->mIns[i + n].mLive & LIVE_CPU_REG) || (mFalseJump->mIns[j + n].mLive & LIVE_CPU_REG))) + while (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() && + mTrueJump->mIns[i + n].IsSame(mFalseJump->mIns[j + n]) && + ((mTrueJump->mIns[i + n].mLive & LIVE_CPU_REG) || (mFalseJump->mIns[j + n].mLive & LIVE_CPU_REG))) n++; - if (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size()) + if (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() && mTrueJump->mIns[i + n].IsSame(mFalseJump->mIns[j + n])) { if (mTrueJump->MayBeMovedBeforeBlock(i, i + n + 1) && mFalseJump->MayBeMovedBeforeBlock(j, j + n + 1)) { @@ -43191,7 +43193,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) { mInterProc = proc; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "dungeon_init"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "format_expression"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks];