diff --git a/include/pocketpy/interpreter/frame.h b/include/pocketpy/interpreter/frame.h index be5b160d..03426333 100644 --- a/include/pocketpy/interpreter/frame.h +++ b/include/pocketpy/interpreter/frame.h @@ -62,8 +62,6 @@ int Frame__dellocal(Frame* self, py_Name name) PY_RAISE; py_Ref Frame__getclosure(Frame* self, py_Name name); py_StackRef Frame__getlocal_noproxy(Frame* self, py_Name name); -py_StackRef Frame__locals_sp(Frame* self); - int Frame__prepare_jump_exception_handler(Frame* self, ValueStack*); UnwindTarget* Frame__find_unwind_target(Frame* self, int iblock); diff --git a/src/interpreter/frame.c b/src/interpreter/frame.c index 8920273a..dfeb35a6 100644 --- a/src/interpreter/frame.c +++ b/src/interpreter/frame.c @@ -80,10 +80,6 @@ void Frame__delete(Frame* self) { FixedMemoryPool__dealloc(&pk_current_vm->pool_frame, self); } -py_StackRef Frame__locals_sp(Frame* self) { - return !self->is_locals_special ? self->locals : self->p0; -} - int Frame__prepare_jump_exception_handler(Frame* self, ValueStack* _s) { // try to find a parent try block int iblock = Frame__iblock(self); @@ -94,7 +90,7 @@ int Frame__prepare_jump_exception_handler(Frame* self, ValueStack* _s) { } if(iblock < 0) return -1; UnwindTarget* uw = Frame__find_unwind_target(self, iblock); - _s->sp = (Frame__locals_sp(self) + uw->offset); // unwind the stack + _s->sp = (self->p0 + uw->offset); // unwind the stack return c11__at(CodeBlock, &self->co->blocks, iblock)->end; } @@ -110,10 +106,10 @@ void Frame__set_unwind_target(Frame* self, py_TValue* sp) { int iblock = Frame__iblock(self); UnwindTarget* existing = Frame__find_unwind_target(self, iblock); if(existing) { - existing->offset = sp - Frame__locals_sp(self); + existing->offset = sp - self->p0; } else { UnwindTarget* prev = self->uw_list; - self->uw_list = UnwindTarget__new(prev, iblock, sp - Frame__locals_sp(self)); + self->uw_list = UnwindTarget__new(prev, iblock, sp - self->p0); } }