| 5935 | }; |
| 5936 | |
| 5937 | bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType, BfType*& castReturnType) |
| 5938 | { |
| 5939 | auto ceModule = mCeMachine->mCeModule; |
| 5940 | SetAndRestoreValue<bool> ignoreWrites(ceModule->mBfIRBuilder->mIgnoreWrites, false); |
| 5941 | CeFunction* ceFunction = startFunction; |
| 5942 | returnType = startFunction->mMethodInstance->mReturnType; |
| 5943 | uint8* memStart = &mMemory[0]; |
| 5944 | int memSize = mMemory.mSize; |
| 5945 | uint8* instPtr = (ceFunction->mCode.IsEmpty()) ? NULL : &ceFunction->mCode[0]; |
| 5946 | uint8* stackPtr = startStackPtr; |
| 5947 | uint8* framePtr = startFramePtr; |
| 5948 | bool needsFunctionIds = ceModule->mSystem->mPtrSize != 8; |
| 5949 | int32 ptrSize = ceModule->mSystem->mPtrSize; |
| 5950 | bool isDebugging = mCeMachine->mDebugger != NULL; |
| 5951 | |
| 5952 | volatile bool* specialCheckPtr = &mCeMachine->mSpecialCheck; |
| 5953 | volatile bool* fastFinishPtr = &mCeMachine->mCompiler->mFastFinish; |
| 5954 | volatile bool* cancelingPtr = &mCeMachine->mCompiler->mCanceling; |
| 5955 | |
| 5956 | auto _GetCurFrame = [&]() |
| 5957 | { |
| 5958 | CeFrame ceFrame; |
| 5959 | ceFrame.mFunction = ceFunction; |
| 5960 | ceFrame.mReturnType = returnType; |
| 5961 | ceFrame.mFrameAddr = framePtr - memStart; |
| 5962 | ceFrame.mStackAddr = stackPtr - memStart; |
| 5963 | ceFrame.mInstPtr = instPtr; |
| 5964 | return ceFrame; |
| 5965 | }; |
| 5966 | |
| 5967 | auto _FixVariables = [&]() |
| 5968 | { |
| 5969 | memSize = mMemory.mSize; |
| 5970 | intptr memOffset = &mMemory[0] - memStart; |
| 5971 | if (memOffset == 0) |
| 5972 | return; |
| 5973 | memStart += memOffset; |
| 5974 | stackPtr += memOffset; |
| 5975 | framePtr += memOffset; |
| 5976 | }; |
| 5977 | |
| 5978 | auto _DbgPause = [&]() |
| 5979 | { |
| 5980 | int itr = 0; |
| 5981 | while (mCeMachine->mDebugger != NULL) |
| 5982 | { |
| 5983 | if (mCeMachine->mDbgPaused) |
| 5984 | { |
| 5985 | // This indicates a missed breakpoint, we should try to avoid this |
| 5986 | // Re-entrancy can cause this, from populating a type during cedebugger autocomplete |
| 5987 | OutputDebugStrF("CeMachine DbgPause reentry\n"); |
| 5988 | return; |
| 5989 | } |
| 5990 | |
| 5991 | CePendingExpr* prevPendingExpr = NULL; |
| 5992 | |
| 5993 | /// |
| 5994 | { |
no test coverage detected