Fix global analyzer for global variable arrays of function pointers

This commit is contained in:
drmortalwombat 2022-07-12 13:08:34 +02:00
parent ae07b2cee6
commit 0bd2ab9e3c
6 changed files with 25 additions and 8 deletions

View File

@ -2998,6 +2998,13 @@ void ByteCodeBasicBlock::LoadEffectiveAddress(InterCodeProcedure* proc, const In
bins.mRelocate = true;
mIns.Push(bins);
}
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
{
ByteCodeInstruction bins(BC_LEA_LOCAL);
bins.mRegister = BC_REG_ACCU;
bins.mValue = ins->mSrc[1].mIntConst + proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
mIns.Push(bins);
}
ByteCodeInstruction ains(BC_BINOP_ADDR_16);
ains.mRegister = BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp];

View File

@ -350,6 +350,7 @@ Declaration * GlobalAnalyzer::Analyze(Expression* exp, Declaration* procDec)
if ((exp->mDecValue->mFlags & DTF_STATIC) || (exp->mDecValue->mFlags & DTF_GLOBAL))
{
procDec->mFlags &= ~DTF_FUNC_CONSTEXPR;
AnalyzeGlobalVariable(exp->mDecValue);
}
else
{

View File

@ -25727,6 +25727,15 @@ void NativeCodeBasicBlock::ShortcutTailRecursion()
mTrueJump->mNumEntries--;
mTrueJump = nullptr;
}
else if (!mFalseJump && !mTrueJump)
{
int ns = mIns.Size();
if (ns >= 2 && mIns[ns - 1].mType == ASMIT_RTS && mIns[ns - 2].IsSimpleJSR())
{
this->mCode.Remove(this->mCode.Size() - 1);
this->mCode[this->mCode.Size() - 3] = 0x4c;
}
}
if (mTrueJump) mTrueJump->ShortcutTailRecursion();
if (mFalseJump) mFalseJump->ShortcutTailRecursion();

View File

@ -74,7 +74,7 @@ int main2(int argc, const char** argv)
#else
strcpy(strProductName, "oscar64");
strcpy(strProductVersion, "1.7.143");
strcpy(strProductVersion, "1.7.144");
#ifdef __APPLE__
uint32_t length = sizeof(basePath);

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,143,0
PRODUCTVERSION 1,7,143,0
FILEVERSION 1,7,144,0
PRODUCTVERSION 1,7,144,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -43,12 +43,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "oscar64"
VALUE "FileDescription", "oscar64 compiler"
VALUE "FileVersion", "1.7.143.0"
VALUE "FileVersion", "1.7.144.0"
VALUE "InternalName", "oscar64.exe"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "oscar64.exe"
VALUE "ProductName", "oscar64"
VALUE "ProductVersion", "1.7.143.0"
VALUE "ProductVersion", "1.7.144.0"
END
END
BLOCK "VarFileInfo"

View File

@ -4153,15 +4153,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:oscar64"
"ProductCode" = "8:{18D1362C-EAD7-45F4-85FD-9D9963D9795D}"
"PackageCode" = "8:{561C0763-7D5B-4666-9DE0-2326AF7DA4CF}"
"ProductCode" = "8:{0129FDCE-E92B-490E-84CB-0C498F444F08}"
"PackageCode" = "8:{07C38985-9C2E-45E7-8F38-DC05F0573826}"
"UpgradeCode" = "8:{9AB61EFF-ACAC-4079-9950-8D96615CD4EF}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.7.143"
"ProductVersion" = "8:1.7.144"
"Manufacturer" = "8:oscar64"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"