1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Fixed invalid autocomplete comptime generation

This commit is contained in:
Brian Fiete 2021-12-20 12:03:09 -05:00
parent 397257eba2
commit f53877dc63
2 changed files with 26 additions and 9 deletions

View file

@ -8470,7 +8470,7 @@ void BfModule::InitTypeInst(BfTypedValue typedValue, BfScopeData* scopeData, boo
mBfIRBuilder->PopulateType(typedValue.mType); mBfIRBuilder->PopulateType(typedValue.mType);
auto vObjectAddr = mBfIRBuilder->CreateInBoundsGEP(typedValue.mValue, 0, 0); auto vObjectAddr = mBfIRBuilder->CreateInBoundsGEP(typedValue.mValue, 0, 0);
bool isAutocomplete = mCompiler->IsAutocomplete(); bool isAutocomplete = mCompiler->IsAutocomplete();
BfIRValue vDataRef; BfIRValue vDataRef;
if (!isAutocomplete) if (!isAutocomplete)
{ {
@ -18478,6 +18478,11 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
{ {
BP_ZONE_F("BfModule::ProcessMethod %s", BP_DYN_STR(methodInstance->mMethodDef->mName.c_str())); BP_ZONE_F("BfModule::ProcessMethod %s", BP_DYN_STR(methodInstance->mMethodDef->mName.c_str()));
if (mIsComptimeModule)
{
BF_ASSERT(!mCompiler->IsAutocomplete());
}
if (mAwaitingInitFinish) if (mAwaitingInitFinish)
FinishInit(); FinishInit();

View file

@ -5,6 +5,7 @@
#include "BfParser.h" #include "BfParser.h"
#include "BfReducer.h" #include "BfReducer.h"
#include "BfExprEvaluator.h" #include "BfExprEvaluator.h"
#include "BfResolvePass.h"
#include "../Backend/BeIRCodeGen.h" #include "../Backend/BeIRCodeGen.h"
#include "BeefySysLib/platform/PlatformHelper.h" #include "BeefySysLib/platform/PlatformHelper.h"
@ -1332,15 +1333,21 @@ void CeBuilder::Build()
mCeMachine->mCeModule->mStaticFieldRefs.Clear(); mCeMachine->mCeModule->mStaticFieldRefs.Clear();
int startFunctionCount = (int)beModule->mFunctions.size(); int startFunctionCount = (int)beModule->mFunctions.size();
ProcessMethod(methodInstance, &dupMethodInstance); ///
{
BfAutoComplete* prevAutoComplete = NULL;
if (mCeMachine->mCeModule->mCompiler->mResolvePassData != NULL)
{
prevAutoComplete = mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete;
mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete = NULL;
}
ProcessMethod(methodInstance, &dupMethodInstance);
if (mCeMachine->mCeModule->mCompiler->mResolvePassData != NULL)
mCeMachine->mCeModule->mCompiler->mResolvePassData->mAutoComplete = prevAutoComplete;
}
if (mCeFunction->mInitializeState == CeFunction::InitializeState_Initialized) if (mCeFunction->mInitializeState == CeFunction::InitializeState_Initialized)
return; return;
if (methodInstance->mMethodDef->mName == "DecodeToUTF8")
{
NOP;
}
if (!dupMethodInstance.mIRFunction) if (!dupMethodInstance.mIRFunction)
{ {
mCeFunction->mFailed = true; mCeFunction->mFailed = true;
@ -4653,12 +4660,12 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
if (ceModule->mSystem->mPtrSize == 4) if (ceModule->mSystem->mPtrSize == 4)
{ {
int32 intVal = *(int32*)((uint8*)stackPtr + 0); int32 intVal = *(int32*)((uint8*)stackPtr + 0);
OutputDebugStrF("Debug Val: %d\n", intVal); OutputDebugStrF("Debug Val: %d %X\n", intVal, intVal);
} }
else else
{ {
int64 intVal = *(int64*)((uint8*)stackPtr + 0); int64 intVal = *(int64*)((uint8*)stackPtr + 0);
OutputDebugStrF("Debug Val: %lld\n", intVal); OutputDebugStrF("Debug Val: %lld %llX\n", intVal, intVal);
} }
} }
else if (checkFunction->mFunctionKind == CeFunctionKind_GetReflectType) else if (checkFunction->mFunctionKind == CeFunctionKind_GetReflectType)
@ -5379,6 +5386,11 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
++instIdx; ++instIdx;
if (ceFunction->mMethodInstance->mMethodDef->mName == "ReadAll")
{
NOP;
}
if (instIdx >= /*0xBC0*/0xBA0) if (instIdx >= /*0xBC0*/0xBA0)
{ {
NOP; NOP;