From 698566a8a7a700f28ecef388c6b996aaf5a3468e Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 24 May 2024 22:09:08 +0800 Subject: [PATCH] remove co_codes --- src/ceval.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ceval.cpp b/src/ceval.cpp index df032f38..0a167874 100644 --- a/src/ceval.cpp +++ b/src/ceval.cpp @@ -96,7 +96,7 @@ bool VM::py_ge(PyVar _0, PyVar _1){ #define DISPATCH() { frame->_ip++; goto __NEXT_STEP; } #define DISPATCH_JUMP(__offset) { frame->_ip+=__offset; goto __NEXT_STEP; } -#define DISPATCH_JUMP_ABSOLUTE(__target) { frame->_ip=co_codes+__target; goto __NEXT_STEP; } +#define DISPATCH_JUMP_ABSOLUTE(__target) { frame->_ip=&frame->co->codes[__target]; goto __NEXT_STEP; } PyVar VM::__run_top_frame(){ Frame* frame = &callstack.top(); @@ -108,8 +108,6 @@ PyVar VM::__run_top_frame(){ /**********************************************************************/ { __NEXT_FRAME: - // TODO: when jit is enabled, co_codes may not be const - const Bytecode* co_codes = frame->co->codes.data(); Bytecode byte; if(__internal_exception.type == InternalExceptionType::Null){ @@ -117,7 +115,7 @@ __NEXT_FRAME: frame->_ip++; }else if(__internal_exception.type == InternalExceptionType::Handled){ // HandledException + continue - frame->_ip = co_codes + __internal_exception.arg; + frame->_ip = &frame->co->codes[__internal_exception.arg]; __internal_exception = {}; }else{ // UnhandledException + continue (need_raise = true)