| 5207 | } |
| 5208 | |
| 5209 | BfTypedValue 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 | } |
no test coverage detected