MCPcopy Create free account
hub / github.com/beefytech/Beef / Call

Method Call

IDEHelper/Compiler/CeMachine.cpp:5209–5680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5207}
5208
5209BfTypedValue CeContext::Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType)
5210{
5211 // DISABLED
5212 //return BfTypedValue();
5213
5214 //
5215 {
5216 StackHelper stackHelper;
5217 if (!stackHelper.CanStackExpand(256 * 1024))
5218 {
5219 BfTypedValue result;
5220 if (!stackHelper.Execute([&]()
5221 {
5222 result = Call(callSource, module, methodInstance, args, flags, expectingType);
5223 }))
5224 {
5225 module->Fail("Stack exhausted in CeContext::Call", callSource.mRefNode);
5226 }
5227 return result;
5228 }
5229 }
5230
5231 //auto ceModule = mCeMachine->mCeModule;
5232
5233
5234 AutoTimer autoTimer(mCeMachine->mRevisionExecuteTime);
5235
5236 SetAndRestoreValue<CeContext*> curPrevContext(mPrevContext, mCeMachine->mCurContext);
5237 SetAndRestoreValue<CeContext*> prevContext(mCeMachine->mCurContext, this);
5238 SetAndRestoreValue<CeEvalFlags> prevEvalFlags(mCurEvalFlags, flags);
5239 SetAndRestoreValue<CeCallSource*> prevCallSource(mCurCallSource, &callSource);
5240 SetAndRestoreValue<BfModule*> prevModule(mCurModule, module);
5241 SetAndRestoreValue<BfMethodInstance*> prevMethodInstance(mCurMethodInstance, methodInstance);
5242 SetAndRestoreValue<BfMethodInstance*> prevCallerMethodInstance(mCallerMethodInstance, module->mCurMethodInstance);
5243 SetAndRestoreValue<BfTypeInstance*> prevCallerTypeInstance(mCallerTypeInstance, module->mCurTypeInstance);
5244 SetAndRestoreValue<BfTypeDef*> prevCallerActiveTypeDef(mCallerActiveTypeDef, module->GetActiveTypeDef());
5245 SetAndRestoreValue<BfType*> prevExpectingType(mCurExpectingType, expectingType);
5246
5247 SetAndRestoreValue<bool> prevCtxResolvingVar(module->mContext->mResolvingVarField, false);
5248 SetAndRestoreValue<BfMethodInstance*> moduleCurMethodInstance(module->mCurMethodInstance, methodInstance);
5249 SetAndRestoreValue<BfTypeInstance*> moduleCurTypeInstance(module->mCurTypeInstance, methodInstance->GetOwner());
5250
5251 SetAndRestoreValue<int> prevCurExecuteId(mCurModule->mCompiler->mCurCEExecuteId, mCeMachine->mExecuteId);
5252
5253 // Reentrancy may occur as methods need defining
5254 //SetAndRestoreValue<BfMethodState*> prevMethodStateInConstEval(module->mCurMethodState, NULL);
5255
5256 if (mCeMachine->mAppendAllocInfo != NULL)
5257 {
5258 if (mCeMachine->mAppendAllocInfo->mAppendSizeValue)
5259 {
5260 bool isConst = mCeMachine->mAppendAllocInfo->mAppendSizeValue.IsConst();
5261 if (isConst)
5262 {
5263 auto constant = module->mBfIRBuilder->GetConstant(mCeMachine->mAppendAllocInfo->mAppendSizeValue);
5264 if (constant->mConstType == BfConstType_Undef)
5265 isConst = false;
5266 }

Callers 4

HandleCEAttributesMethod · 0.45
ExecuteCEOnCompileMethod · 0.45
DoCEEmitMethod · 0.45
CreateCallMethod · 0.45

Calls 15

FailFunction · 0.85
BfTypedValueClass · 0.85
BfIRValueClass · 0.85
CanStackExpandMethod · 0.80
GetActiveTypeDefMethod · 0.80
GetParamKindMethod · 0.80
CreateTypeDataRefMethod · 0.80
MethodToStringMethod · 0.80
PrepareFunctionMethod · 0.80
CreateConstAggZeroMethod · 0.80
MapTypeMethod · 0.80
AddDependencyMethod · 0.80

Tested by

no test coverage detected