| 10687 | } |
| 10688 | |
| 10689 | CeContext* CeMachine::AllocContext() |
| 10690 | { |
| 10691 | CeContext* ceContext = NULL; |
| 10692 | if (!mContextList.IsEmpty()) |
| 10693 | { |
| 10694 | ceContext = mContextList.back(); |
| 10695 | mContextList.pop_back(); |
| 10696 | } |
| 10697 | else |
| 10698 | { |
| 10699 | ceContext = new CeContext(); |
| 10700 | ceContext->mCeMachine = this; |
| 10701 | ceContext->mMemory.Reserve(BF_CE_INITIAL_MEMORY); |
| 10702 | memset(ceContext->mMemory.mVals, 0, BF_CE_INITIAL_MEMORY); |
| 10703 | } |
| 10704 | |
| 10705 | ceContext->mCurEmitContext = mCurEmitContext; |
| 10706 | mCurEmitContext = NULL; |
| 10707 | mExecuteId++; |
| 10708 | ceContext->mStackSize = BF_CE_DEFAULT_STACK_SIZE; |
| 10709 | ceContext->mMemory.ResizeRaw(ceContext->mStackSize); |
| 10710 | ceContext->mExecuteId = mExecuteId; |
| 10711 | ceContext->mCurHandleId = 0; |
| 10712 | return ceContext; |
| 10713 | } |
| 10714 | |
| 10715 | void CeMachine::ReleaseContext(CeContext* ceContext) |
| 10716 | { |