summaryrefslogtreecommitdiffstatshomepage
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-06-30 05:17:25 +0100
committerDamien George <damien.p.george@gmail.com>2014-06-30 05:17:25 +0100
commitb601d9574ad03a18d3eb476d631f547c7ea28243 (patch)
tree9fceb779e8109b1c147f6c30fe9a24e9d2b19d22 /py/compile.c
parent5813efd634a282caea3cca6e8448bda253f21c35 (diff)
downloadmicropython-b601d9574ad03a18d3eb476d631f547c7ea28243.tar.gz
micropython-b601d9574ad03a18d3eb476d631f547c7ea28243.zip
py: Improvements to native emitter.
Native emitter can now compile try/except blocks using nlr_push/nlr_pop. It probably only works for 1 level of exception handling. It doesn't work on Thumb (only x64). Native emitter can also handle some additional op codes. With this patch, 198 tests now pass using "-X emit=native" option to micropython.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/compile.c b/py/compile.c
index d49edd6ef3..f2a108074f 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1894,7 +1894,7 @@ void compile_try_except(compiler_t *comp, mp_parse_node_t pn_body, int n_except,
EMIT_ARG(jump, success_label); // jump over exception handler
EMIT_ARG(label_assign, l1); // start of exception handler
- EMIT_ARG(adjust_stack_size, 6); // stack adjust for the 3 exception items, +3 for possible UNWIND_JUMP state
+ EMIT(start_except_handler);
uint l2 = comp_next_label(comp);
@@ -1966,7 +1966,7 @@ void compile_try_except(compiler_t *comp, mp_parse_node_t pn_body, int n_except,
compile_decrease_except_level(comp);
EMIT(end_finally);
- EMIT_ARG(adjust_stack_size, -5); // stack adjust
+ EMIT(end_except_handler);
EMIT_ARG(label_assign, success_label);
compile_node(comp, pn_else); // else block, can be null