mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed CeMachine::GetFunction with __INLINE methods
This commit is contained in:
parent
887cbc3fa3
commit
fe2244fb4b
3 changed files with 39 additions and 3 deletions
|
@ -12002,6 +12002,12 @@ BfIRValue BfModule::ConstantToCurrent(BfConstant* constant, BfIRConstHolder* con
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto wantTypeInst = wantType->ToTypeInstance();
|
auto wantTypeInst = wantType->ToTypeInstance();
|
||||||
|
if (wantTypeInst == NULL)
|
||||||
|
{
|
||||||
|
InternalError("BfModule::ConstantToCurrent typeInst error");
|
||||||
|
return BfIRValue();
|
||||||
|
}
|
||||||
|
|
||||||
if (wantTypeInst->mBaseType != NULL)
|
if (wantTypeInst->mBaseType != NULL)
|
||||||
{
|
{
|
||||||
auto baseVal = ConstantToCurrent(constHolder->GetConstant(constArray->mValues[0]), constHolder, wantTypeInst->mBaseType);
|
auto baseVal = ConstantToCurrent(constHolder->GetConstant(constArray->mValues[0]), constHolder, wantTypeInst->mBaseType);
|
||||||
|
@ -12024,6 +12030,13 @@ BfIRValue BfModule::ConstantToCurrent(BfConstant* constant, BfIRConstHolder* con
|
||||||
{
|
{
|
||||||
if (fieldInstance.mDataIdx < 0)
|
if (fieldInstance.mDataIdx < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (fieldInstance.mDataIdx >= constArray->mValues.mSize)
|
||||||
|
{
|
||||||
|
InternalError("BfModule::ConstantToCurrent union error");
|
||||||
|
return BfIRValue();
|
||||||
|
}
|
||||||
|
|
||||||
auto val = constArray->mValues[fieldInstance.mDataIdx];
|
auto val = constArray->mValues[fieldInstance.mDataIdx];
|
||||||
BfIRValue memberVal = ConstantToCurrent(constHolder->GetConstant(val), constHolder, fieldInstance.mResolvedType);
|
BfIRValue memberVal = ConstantToCurrent(constHolder->GetConstant(val), constHolder, fieldInstance.mResolvedType);
|
||||||
if (fieldInstance.mDataIdx == newVals.mSize)
|
if (fieldInstance.mDataIdx == newVals.mSize)
|
||||||
|
|
|
@ -6268,7 +6268,7 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
|
||||||
if (!typeInstance->IsInterface())
|
if (!typeInstance->IsInterface())
|
||||||
{
|
{
|
||||||
auto interfaceTypeDef = checkInterface->mTypeDef;
|
auto interfaceTypeDef = checkInterface->mTypeDef;
|
||||||
BF_ASSERT(interfaceTypeDef->mMethods.size() == checkInterface->mMethodInstanceGroups.size());
|
BF_ASSERT((interfaceTypeDef->mMethods.size() == checkInterface->mMethodInstanceGroups.size()) || (checkInterface->IsDeleting()));
|
||||||
|
|
||||||
// Reserve empty entries
|
// Reserve empty entries
|
||||||
for (int methodIdx = 0; methodIdx < (int)interfaceTypeDef->mMethods.size(); methodIdx++)
|
for (int methodIdx = 0; methodIdx < (int)interfaceTypeDef->mMethods.size(); methodIdx++)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "../Backend/BeIRCodeGen.h"
|
#include "../Backend/BeIRCodeGen.h"
|
||||||
#include "BeefySysLib/platform/PlatformHelper.h"
|
#include "BeefySysLib/platform/PlatformHelper.h"
|
||||||
#include "../DebugManager.h"
|
#include "../DebugManager.h"
|
||||||
|
#include "BeefySysLib/util/StackHelper.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -5051,6 +5052,24 @@ BfTypedValue CeContext::Call(CeCallSource callSource, BfModule* module, BfMethod
|
||||||
// DISABLED
|
// DISABLED
|
||||||
//return BfTypedValue();
|
//return BfTypedValue();
|
||||||
|
|
||||||
|
//
|
||||||
|
{
|
||||||
|
StackHelper stackHelper;
|
||||||
|
if (!stackHelper.CanStackExpand(256 * 1024))
|
||||||
|
{
|
||||||
|
BfTypedValue result;
|
||||||
|
if (!stackHelper.Execute([&]()
|
||||||
|
{
|
||||||
|
result = Call(callSource, module, methodInstance, args, flags, expectingType);
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
module->Fail("Stack exhausted in CeContext::Call", callSource.mRefNode);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
AutoTimer autoTimer(mCeMachine->mRevisionExecuteTime);
|
AutoTimer autoTimer(mCeMachine->mRevisionExecuteTime);
|
||||||
|
|
||||||
SetAndRestoreValue<CeContext*> curPrevContext(mPrevContext, mCeMachine->mCurContext);
|
SetAndRestoreValue<CeContext*> curPrevContext(mPrevContext, mCeMachine->mCurContext);
|
||||||
|
@ -9990,11 +10009,15 @@ CeFunction* CeMachine::GetFunction(BfMethodInstance* methodInstance, BfIRValue f
|
||||||
|
|
||||||
if (auto function = BeValueDynCast<BeFunction>(funcVal))
|
if (auto function = BeValueDynCast<BeFunction>(funcVal))
|
||||||
{
|
{
|
||||||
|
String funcName = function->mName;
|
||||||
|
if (funcName.EndsWith("__INLINE"))
|
||||||
|
funcName.RemoveFromEnd(8);
|
||||||
|
|
||||||
CeFunctionInfo** namedFunctionInfoPtr = NULL;
|
CeFunctionInfo** namedFunctionInfoPtr = NULL;
|
||||||
if (mNamedFunctionMap.TryAdd(function->mName, NULL, &namedFunctionInfoPtr))
|
if (mNamedFunctionMap.TryAdd(funcName, NULL, &namedFunctionInfoPtr))
|
||||||
{
|
{
|
||||||
ceFunctionInfo = new CeFunctionInfo();
|
ceFunctionInfo = new CeFunctionInfo();
|
||||||
ceFunctionInfo->mName = function->mName;
|
ceFunctionInfo->mName = funcName;
|
||||||
*namedFunctionInfoPtr = ceFunctionInfo;
|
*namedFunctionInfoPtr = ceFunctionInfo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue