Skip to content

Commit

Permalink
Fix join common branch sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
drmortalwombat committed Nov 26, 2023
1 parent 57537cd commit d5026ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/conio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions oscar64/NativeCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit d5026ed

Please sign in to comment.