diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-24 14:32:40 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-24 14:32:40 -0800 |
commit | ceb87835fe24873cd8b2f7d1d3d88cb6144e33b8 (patch) | |
tree | be3e0b2da874ab98f98a4fd756ff8534f74b5b6d /py/emitbc.c | |
parent | 4461970da027ce16b41189f75257239f46a3b087 (diff) | |
parent | f46d87a30d09bfa904c2b9769ea52271abb86b0c (diff) | |
download | micropython-ceb87835fe24873cd8b2f7d1d3d88cb6144e33b8.tar.gz micropython-ceb87835fe24873cd8b2f7d1d3d88cb6144e33b8.zip |
Merge pull request #217 from pfalcon/free-emitter
Add support for freeing code emitter objects at the end of compilation.
Diffstat (limited to 'py/emitbc.c')
-rw-r--r-- | py/emitbc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index c3385e0b66..d66202eb2a 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -43,6 +43,11 @@ emit_t *emit_bc_new(uint max_num_labels) { return emit; } +static void emit_bc_free(emit_t *emit) { + m_del(uint, emit->label_offsets, emit->max_num_labels); + m_del_obj(emit_t, emit); +} + // all functions must go through this one to emit code info static byte* emit_get_cur_to_write_code_info(emit_t* emit, int num_bytes_to_write) { //printf("emit %d\n", num_bytes_to_write); @@ -751,6 +756,8 @@ static void emit_bc_yield_from(emit_t *emit) { } const emit_method_table_t emit_bc_method_table = { + emit_bc_free, + emit_bc_set_native_types, emit_bc_start_pass, emit_bc_end_pass, |