@@ -94,12 +94,6 @@ struct Frame {
Frame(PyVar* p0, const CodeObject_& co, PyVar _module)
: _ip(-1), _next_ip(0), _sp_base(p0), co(co.get()), _module(_module), _callable(nullptr), _locals(co.get(), p0) {}
- int next_bytecode() {
- _ip = _next_ip++;
- PK_DEBUG_ASSERT(_ip >= 0 && _ip < co->codes.size());
- return _ip;
- }
-
PyVar* actual_sp_base() const { return _locals.a; }
int stack_size(ValueStack* _s) const { return _s->_sp - actual_sp_base(); }
@@ -113,11 +113,14 @@ PyVar VM::__run_top_frame(){
__NEXT_FRAME:
const CodeObject* co = frame->co;
+ // TODO: when jit is enabled, co_codes may not be const
const Bytecode* co_codes = co->codes.data();
Bytecode byte;
-__NEXT_STEP:;
- byte = co_codes[frame->next_bytecode()];
+__NEXT_STEP:
+ frame->_ip = frame->_next_ip;
+ frame->_next_ip++;
+ byte = co_codes[frame->_ip];
CEVAL_STEP_CALLBACK()
#if PK_DEBUG_CEVAL_STEP