diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-27 11:07:04 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-27 11:07:04 +0000 |
commit | bee17b00e38ffc005a4247cb00ab01eb40162a2d (patch) | |
tree | 856c12181e8b16a9d0e40868623f5932b9bb8df7 /py/obj.h | |
parent | 8dcc0c79248a413f01f1d669b99d51e2519c5267 (diff) | |
download | micropython-bee17b00e38ffc005a4247cb00ab01eb40162a2d.tar.gz micropython-bee17b00e38ffc005a4247cb00ab01eb40162a2d.zip |
py: Put n_state for bytecode in the bytecode prelude.
Rationale: setting up the stack (state for locals and exceptions) is
really part of the "code", it's the prelude of the function. For
example, native code adjusts the stack pointer on entry to the function.
Native code doesn't need to know n_state for any other reason. So
putting the state size in the bytecode prelude is sensible.
It reduced ROM usage on STM by about 30 bytes :) And makes it easier to
pass information about the bytecode between functions.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -257,10 +257,10 @@ mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, const char *msg mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char *fmt, ...); // counts args by number of % symbols in fmt, excluding %%; can only handle void* sizes (ie no float/double!) mp_obj_t mp_obj_new_range(int start, int stop, int step); mp_obj_t mp_obj_new_range_iterator(int cur, int stop, int step); -mp_obj_t mp_obj_new_fun_bc(uint scope_flags, qstr *args, uint n_args, mp_obj_t def_args, uint n_state, const byte *code); +mp_obj_t mp_obj_new_fun_bc(uint scope_flags, qstr *args, uint n_args, mp_obj_t def_args, const byte *code); mp_obj_t mp_obj_new_fun_asm(uint n_args, void *fun); mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun); -mp_obj_t mp_obj_new_gen_instance(const byte *bytecode, uint n_state, int n_args, const mp_obj_t *args); +mp_obj_t mp_obj_new_gen_instance(const byte *bytecode, int n_args, const mp_obj_t *args); mp_obj_t mp_obj_new_closure(mp_obj_t fun, mp_obj_t closure_tuple); mp_obj_t mp_obj_new_tuple(uint n, const mp_obj_t *items); mp_obj_t mp_obj_new_list(uint n, mp_obj_t *items); @@ -419,7 +419,7 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object extern const mp_obj_type_t fun_native_type; extern const mp_obj_type_t fun_bc_type; -void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, uint *n_state, const byte **code); +void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code); mp_obj_t mp_identity(mp_obj_t self); MP_DECLARE_CONST_FUN_OBJ(mp_identity_obj); |