Fix noinline, improve cartridge use of bank 0

This commit is contained in:
drmortalwombat 2023-11-29 20:53:04 +01:00
parent cf28c1a618
commit 003306f961
6 changed files with 14 additions and 2 deletions

View File

@ -219,8 +219,10 @@ w0:
sta $ff3f sta $ff3f
#endif #endif
#if !defined(OSCAR_TARGET_CRT8) && !defined(OSCAR_TARGET_CRT16)
tsx tsx
stx spentry stx spentry
#endif
#endif #endif

View File

@ -17798,7 +17798,7 @@ InterCodeProcedure::InterCodeProcedure(InterCodeModule * mod, const Location & l
mNativeProcedure(false), mLeafProcedure(false), mCallsFunctionPointer(false), mCalledFunctions(nullptr), mFastCallProcedure(false), mNativeProcedure(false), mLeafProcedure(false), mCallsFunctionPointer(false), mCalledFunctions(nullptr), mFastCallProcedure(false),
mInterrupt(false), mHardwareInterrupt(false), mCompiled(false), mInterruptCalled(false), mDynamicStack(false), mAssembled(false), mInterrupt(false), mHardwareInterrupt(false), mCompiled(false), mInterruptCalled(false), mDynamicStack(false), mAssembled(false),
mSaveTempsLinkerObject(nullptr), mValueReturn(false), mFramePointer(false), mSaveTempsLinkerObject(nullptr), mValueReturn(false), mFramePointer(false),
mCheckUnreachable(true), mReturnType(IT_NONE), mCheapInline(false), mCheckUnreachable(true), mReturnType(IT_NONE), mCheapInline(false), mNoInline(false),
mDeclaration(nullptr), mGlobalsChecked(false), mDispatchedCall(false), mDeclaration(nullptr), mGlobalsChecked(false), mDispatchedCall(false),
mNumRestricted(1) mNumRestricted(1)
{ {
@ -19707,7 +19707,7 @@ void InterCodeProcedure::Close(void)
mLinkerObject->mFlags |= LOBJF_STATIC_STACK; mLinkerObject->mFlags |= LOBJF_STATIC_STACK;
} }
if (!mEntryBlock->mTrueJump) if (!mNoInline && !mEntryBlock->mTrueJump)
{ {
int nconst = 0, nvariables = 0, nparams = 0, ncalls = 0, nret = 0, nother = 0, nops = 0; int nconst = 0, nvariables = 0, nparams = 0, ncalls = 0, nret = 0, nother = 0, nops = 0;
for (int i = 0; i < mEntryBlock->mInstructions.Size(); i++) for (int i = 0; i < mEntryBlock->mInstructions.Size(); i++)

View File

@ -638,6 +638,7 @@ public:
bool mCheckUnreachable; bool mCheckUnreachable;
GrowingInterCodeProcedurePtrArray mCalledFunctions; GrowingInterCodeProcedurePtrArray mCalledFunctions;
bool mCheapInline; bool mCheapInline;
bool mNoInline;
InterCodeModule * mModule; InterCodeModule * mModule;
int mID; int mID;

View File

@ -5174,6 +5174,9 @@ InterCodeProcedure* InterCodeGenerator::TranslateProcedure(InterCodeModule * mod
if (dec->mFlags & DTF_DYNSTACK) if (dec->mFlags & DTF_DYNSTACK)
proc->mDynamicStack = true; proc->mDynamicStack = true;
if (dec->mFlags & DTF_PREVENT_INLINE)
proc->mNoInline = true;
if (dec->mBase->mFlags & DTF_FASTCALL) if (dec->mBase->mFlags & DTF_FASTCALL)
{ {
proc->mFastCallProcedure = true; proc->mFastCallProcedure = true;

View File

@ -1117,6 +1117,9 @@ bool Linker::WriteCrtFile(const char* filename, uint16 id)
memset(bootmem, 0, 0x4000); memset(bootmem, 0, 0x4000);
if (mCartridgeBankUsed[0])
memcpy(bootmem, mCartridge[0] + 0x8000, 0x4000);
LinkerRegion* mainRegion = FindRegion(Ident::Unique("main")); LinkerRegion* mainRegion = FindRegion(Ident::Unique("main"));
LinkerRegion* startupRegion = FindRegion(Ident::Unique("startup")); LinkerRegion* startupRegion = FindRegion(Ident::Unique("startup"));

View File

@ -4698,6 +4698,8 @@ Declaration* Parser::ParseDeclaration(Declaration * pdec, bool variable, bool ex
{ {
if (ndec->mBase->mType == DT_TYPE_FUNCTION) if (ndec->mBase->mType == DT_TYPE_FUNCTION)
{ {
ndec->mSection = mCodeSection;
if ((ndec->mFlags & DTF_DEFINED) && !(ndec->mFlags & DTF_REQUEST_INLINE)) if ((ndec->mFlags & DTF_DEFINED) && !(ndec->mFlags & DTF_REQUEST_INLINE))
{ {
mErrors->Error(mScanner->mLocation, EERR_DUPLICATE_DEFINITION, "Duplicate function definition", ndec->mQualIdent); mErrors->Error(mScanner->mLocation, EERR_DUPLICATE_DEFINITION, "Duplicate function definition", ndec->mQualIdent);
@ -10046,6 +10048,7 @@ void Parser::ParseTemplateDeclarationBody(Declaration * tdec, Declaration * pthi
mTemplateScope = tdec->mScope; mTemplateScope = tdec->mScope;
ConsumeTokenIf(TK_INLINE); ConsumeTokenIf(TK_INLINE);
ConsumeTokenIf(TK_NOINLINE);
ConsumeTokenIf(TK_CONSTEXPR); ConsumeTokenIf(TK_CONSTEXPR);
Declaration* bdec = ParseBaseTypeDeclaration(0, true); Declaration* bdec = ParseBaseTypeDeclaration(0, true);