Improve dealing way of program counter in interpreter

* Use direct address instead of using offset of program when calling interpreter
* We don't need to restore the pointer of program counter in ExecutionState

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2022-06-09 10:25:12 +09:00 committed by Hyukwoo Park
commit 2678a383ec
5 changed files with 35 additions and 54 deletions

View file

@ -63,6 +63,7 @@ protected:
ByteCodeBlock* blk = codeBlock->byteCodeBlock();
Context* ctx = codeBlock->context();
const size_t registerSize = blk->m_requiredOperandRegisterNumber;
const size_t programStart = reinterpret_cast<const size_t>(blk->m_code.data());
#if !defined(NDEBUG)
const size_t stackStorageSize = codeBlock->totalStackAllocatedVariableSize();
@ -97,11 +98,11 @@ protected:
}
if (shouldClearStack) {
const Value returnValue = ByteCodeInterpreter::interpret(&newState, blk, 0, registerFile);
const Value returnValue = ByteCodeInterpreter::interpret(&newState, blk, programStart, registerFile);
clearStack<512>();
return returnValue;
} else {
return ByteCodeInterpreter::interpret(&newState, blk, 0, registerFile);
return ByteCodeInterpreter::interpret(&newState, blk, programStart, registerFile);
}
}
@ -167,7 +168,7 @@ protected:
record.setNewTarget(newTarget);
const Value returnValue = ByteCodeInterpreter::interpret(&newState, blk, 0, registerFile);
const Value returnValue = ByteCodeInterpreter::interpret(&newState, blk, reinterpret_cast<const size_t>(blk->m_code.data()), registerFile);
if (shouldClearStack) {
clearStack<512>();
}