diff options
| author | Damien George <damien.p.george@gmail.com> | 2015-10-22 23:45:37 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2015-11-13 12:49:18 +0000 |
| commit | 3a3db4dcf0400cffef860f61a84979cb1f7a7541 (patch) | |
| tree | cfdcb6931cb120f2f993e10e7db6dc14f40b1ded /py/emitbc.c | |
| parent | 9b7f583b0ca37ee87e5fb82e2d65fcd96a609b2f (diff) | |
py: Put all bytecode state (arg count, etc) in bytecode.
Diffstat (limited to 'py/emitbc.c')
| -rw-r--r-- | py/emitbc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index 0ed7828f9..6b4501901 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -294,6 +294,13 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { emit_write_code_info_uint(emit, scope->exc_stack_size); } + // Write scope flags and number of arguments. + // TODO check that num args all fit in a byte + emit_write_code_info_byte(emit, emit->scope->scope_flags); + emit_write_code_info_byte(emit, emit->scope->num_pos_args); + emit_write_code_info_byte(emit, emit->scope->num_kwonly_args); + emit_write_code_info_byte(emit, emit->scope->num_def_pos_args); + // Align code-info so that following pointers are aligned on a machine word. emit_align_code_info_to_machine_word(emit); @@ -372,9 +379,7 @@ void mp_emit_bc_end_pass(emit_t *emit) { } else if (emit->pass == MP_PASS_EMIT) { mp_emit_glue_assign_bytecode(emit->scope->raw_code, emit->code_base, - emit->code_info_size + emit->bytecode_size, - emit->scope->num_pos_args, emit->scope->num_kwonly_args, - emit->scope->scope_flags); + emit->code_info_size + emit->bytecode_size, emit->scope->scope_flags); } } |
