mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
some inline
This commit is contained in:
parent
9864fb13cc
commit
5e0e2c9c51
@ -94,12 +94,6 @@ 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) {}
|
||||||
|
|
||||||
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; }
|
PyVar* actual_sp_base() const { return _locals.a; }
|
||||||
|
|
||||||
int stack_size(ValueStack* _s) const { return _s->_sp - actual_sp_base(); }
|
int stack_size(ValueStack* _s) const { return _s->_sp - actual_sp_base(); }
|
||||||
|
@ -113,11 +113,14 @@ PyVar VM::__run_top_frame(){
|
|||||||
|
|
||||||
__NEXT_FRAME:
|
__NEXT_FRAME:
|
||||||
const CodeObject* co = frame->co;
|
const CodeObject* co = frame->co;
|
||||||
|
// TODO: when jit is enabled, co_codes may not be const
|
||||||
const Bytecode* co_codes = co->codes.data();
|
const Bytecode* co_codes = co->codes.data();
|
||||||
Bytecode byte;
|
Bytecode byte;
|
||||||
|
|
||||||
__NEXT_STEP:;
|
__NEXT_STEP:
|
||||||
byte = co_codes[frame->next_bytecode()];
|
frame->_ip = frame->_next_ip;
|
||||||
|
frame->_next_ip++;
|
||||||
|
byte = co_codes[frame->_ip];
|
||||||
CEVAL_STEP_CALLBACK()
|
CEVAL_STEP_CALLBACK()
|
||||||
|
|
||||||
#if PK_DEBUG_CEVAL_STEP
|
#if PK_DEBUG_CEVAL_STEP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user