diff --git a/include/pocketpy/frame.h b/include/pocketpy/frame.h index 77b01bb2..94c4d0c8 100644 --- a/include/pocketpy/frame.h +++ b/include/pocketpy/frame.h @@ -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(); } diff --git a/src/ceval.cpp b/src/ceval.cpp index 4b60d010..cec5d521 100644 --- a/src/ceval.cpp +++ b/src/ceval.cpp @@ -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