Method object refactor

This commit is contained in:
IlyaShurupov 2024-03-25 13:57:31 +03:00
parent add66e6cac
commit 7332e72bb2
25 changed files with 420 additions and 529 deletions

View file

@ -10,11 +10,11 @@ using namespace obj;
void CallStack::enter(const CallStack::CallFrame& frame) {
if (mStack.size()) {
auto& last_frame = mStack.last();
last_frame.mIp = last_frame.mMethod->mScript->mBytecode.mInstructionIdx;
last_frame.mIp = last_frame.mMethod->mBytecodeLink->mBytecode.mInstructionIdx;
}
frame.mMethod->mScript->mBytecode.mArgumentsLoaded = 0;
frame.mMethod->mScript->mBytecode.mInstructionIdx = 0;
frame.mMethod->mBytecodeLink->mBytecode.mArgumentsLoaded = 0;
frame.mMethod->mBytecodeLink->mBytecode.mInstructionIdx = 0;
objects_api::increaseReferenceCount(frame.mMethod);
mStack.append(frame);
}
@ -26,10 +26,10 @@ void CallStack::leave() {
if (mStack.size()) {
auto& last_frame = mStack.last();
last_frame.mMethod->mScript->mBytecode.mInstructionIdx = last_frame.mIp;
last_frame.mMethod->mBytecodeLink->mBytecode.mInstructionIdx = last_frame.mIp;
}
}
ByteCode* CallStack::getBytecode() { return &mStack.last().mMethod->mScript->mBytecode; }
ByteCode* CallStack::getBytecode() { return &mStack.last().mMethod->mBytecodeLink->mBytecode; }
halni CallStack::len() const { return mStack.size(); }