diff options
| author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-31 16:50:46 +0300 |
|---|---|---|
| committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-31 18:22:01 +0300 |
| commit | b4ebad3310b238bb85ea1f0d7b78b4fcb3d146df (patch) | |
| tree | eb6a96db22346acc782c4444ce14303fe47bc7ae /py/bc.h | |
| parent | b16523aa95ca0a95f3d5a82e6f691e088135d7ba (diff) | |
vm: Factor out structure with code execution state and pass it around.
This improves stack usage in callers to mp_execute_bytecode2, and is step
forward towards unifying execution interface for function and generators
(which is important because generators don't even support full forms
of arguments passing (keywords, etc.)).
Diffstat (limited to 'py/bc.h')
| -rw-r--r-- | py/bc.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -36,8 +36,21 @@ typedef struct _mp_exc_stack { byte opcode; } mp_exc_stack_t; +typedef struct _mp_code_state { + const byte *code_info; + const byte *ip; + mp_obj_t *sp; + // bit 0 is saved currently_in_except_block value + mp_exc_stack_t *exc_sp; + uint n_state; + // Variable-length + mp_obj_t state[0]; + // Variable-length, never accessed by name, only as (void*)(state + n_state) + //mp_exc_stack_t exc_state[0]; +} mp_code_state; + mp_vm_return_kind_t mp_execute_bytecode(const byte *code, const mp_obj_t *args, uint n_args, const mp_obj_t *args2, uint n_args2, mp_obj_t *ret); -mp_vm_return_kind_t mp_execute_bytecode2(const byte *code_info, const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out, mp_exc_stack_t *exc_stack, mp_exc_stack_t **exc_sp_in_out, volatile mp_obj_t inject_exc); +mp_vm_return_kind_t mp_execute_bytecode2(mp_code_state *code_state, volatile mp_obj_t inject_exc); void mp_bytecode_print(const byte *code, int len); void mp_bytecode_print2(const byte *code, int len); |
