Skip to content

Commit 9f6976b

Browse files
committed
py: Make mp_setup_code_state take concrete pointer for func arg.
1 parent 278f359 commit 9f6976b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

py/bc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ STATIC void dump_args(const mp_obj_t *a, mp_uint_t sz) {
8989
// - code_state->ip should contain the offset in bytes from the start of
9090
// the bytecode chunk to just after n_state and n_exc_stack
9191
// - code_state->n_state should be set to the state size (locals plus stack)
92-
void mp_setup_code_state(mp_code_state *code_state, mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
92+
void mp_setup_code_state(mp_code_state *code_state, mp_obj_fun_bc_t *self, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
9393
// This function is pretty complicated. It's main aim is to be efficient in speed and RAM
9494
// usage for the common case of positional only args.
95-
mp_obj_fun_bc_t *self = self_in;
9695
mp_uint_t n_state = code_state->n_state;
9796

9897
// ip comes in as an offset into bytecode, so turn it into a true pointer

py/bc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ mp_uint_t mp_decode_uint(const byte **ptr);
9191

9292
mp_vm_return_kind_t mp_execute_bytecode(mp_code_state *code_state, volatile mp_obj_t inject_exc);
9393
mp_code_state *mp_obj_fun_bc_prepare_codestate(mp_obj_t func, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
94-
void mp_setup_code_state(mp_code_state *code_state, mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
94+
struct _mp_obj_fun_bc_t;
95+
void mp_setup_code_state(mp_code_state *code_state, struct _mp_obj_fun_bc_t *self, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
9596
void mp_bytecode_print(const void *descr, const byte *code, mp_uint_t len, const mp_uint_t *const_table);
9697
void mp_bytecode_print2(const byte *code, mp_uint_t len);
9798
const byte *mp_bytecode_print_str(const byte *ip);

py/objfun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw,
231231

232232
code_state->ip = (byte*)(ip - self->bytecode); // offset to after n_state/n_exc_stack
233233
code_state->n_state = n_state;
234-
mp_setup_code_state(code_state, self_in, n_args, n_kw, args);
234+
mp_setup_code_state(code_state, self, n_args, n_kw, args);
235235

236236
// execute the byte code with the correct globals context
237237
code_state->old_globals = mp_globals_get();

0 commit comments

Comments
 (0)