This commit is contained in:
blueloveTH 2024-05-18 22:31:44 +08:00
parent 39dd1a8e21
commit 49379b177a
2 changed files with 4 additions and 3 deletions

View File

@ -94,10 +94,10 @@ struct Frame {
Frame(PyVar* p0, const CodeObject_& co, PyVar _module) 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) {} : _ip(-1), _next_ip(0), _sp_base(p0), co(co.get()), _module(_module), _callable(nullptr), _locals(co.get(), p0) {}
Bytecode next_bytecode() { int next_bytecode() {
_ip = _next_ip++; _ip = _next_ip++;
PK_DEBUG_ASSERT(_ip >= 0 && _ip < co->codes.size()); PK_DEBUG_ASSERT(_ip >= 0 && _ip < co->codes.size());
return co->codes[_ip]; return _ip;
} }
PyVar* actual_sp_base() const { return _locals.a; } PyVar* actual_sp_base() const { return _locals.a; }

View File

@ -111,10 +111,11 @@ PyVar VM::__run_top_frame(){
__NEXT_FRAME: __NEXT_FRAME:
const CodeObject* co = frame->co; const CodeObject* co = frame->co;
const Bytecode* co_codes = co->codes.data();
Bytecode byte; Bytecode byte;
__NEXT_STEP:; __NEXT_STEP:;
byte = frame->next_bytecode(); byte = co_codes[frame->next_bytecode()];
CEVAL_STEP_CALLBACK(); CEVAL_STEP_CALLBACK();
#if PK_DEBUG_CEVAL_STEP #if PK_DEBUG_CEVAL_STEP