summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-11-02 20:34:54 +0000
committerDamien <damien.p.george@gmail.com>2013-11-02 20:34:54 +0000
commit6ba1314265e07f79e18d52f04435c5c846cb9405 (patch)
treeac86d782c6f839e324fa96e27344e9d56bd9a2e9
parent7410e440aba6826629e850f69a38615ad1039814 (diff)
downloadmicropython-6ba1314265e07f79e18d52f04435c5c846cb9405.tar.gz
micropython-6ba1314265e07f79e18d52f04435c5c846cb9405.zip
Fix bug: emit native didn't clear last_was_return in label_assign.
-rw-r--r--py/emitnative.c10
-rw-r--r--py/runtime.c2
-rw-r--r--py/runtime.h3
3 files changed, 11 insertions, 4 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index b535df74b6..7f35f0c4d8 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -514,6 +514,7 @@ static void emit_native_delete_id(emit_t *emit, qstr qstr) {
}
static void emit_native_label_assign(emit_t *emit, int l) {
+ emit_pre(emit);
// need to commit stack because we can jump here from elsewhere
need_stack_settled(emit);
#if N_X64
@@ -521,6 +522,7 @@ static void emit_native_label_assign(emit_t *emit, int l) {
#elif N_THUMB
asm_thumb_label_assign(emit->as, l);
#endif
+ emit_post(emit);
}
static void emit_native_import_name(emit_t *emit, qstr qstr) {
@@ -577,8 +579,10 @@ static void emit_native_load_const_int(emit_t *emit, qstr qstr) {
}
static void emit_native_load_const_dec(emit_t *emit, qstr qstr) {
- // not supported for viper (although, could support floats in future)
- assert(0);
+ // for viper, a float/complex is just a Python object
+ emit_pre(emit);
+ emit_call_with_imm_arg(emit, RT_F_LOAD_CONST_DEC, rt_load_const_dec, qstr, REG_ARG_1);
+ emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
static void emit_native_load_const_id(emit_t *emit, qstr qstr) {
@@ -903,7 +907,7 @@ static void emit_native_setup_loop(emit_t *emit, int label) {
}
static void emit_native_break_loop(emit_t *emit, int label) {
- assert(0);
+ emit_native_jump(emit, label); // TODO properly
}
static void emit_native_continue_loop(emit_t *emit, int label) {
assert(0);
diff --git a/py/runtime.c b/py/runtime.c
index 6270039597..76f194daa3 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1925,7 +1925,9 @@ py_obj_t rt_iternext(py_obj_t o_in) {
}
}
+// these must correspond to the respective enum
void *const rt_fun_table[RT_F_NUMBER_OF] = {
+ rt_load_const_dec,
rt_load_const_str,
rt_load_name,
rt_load_global,
diff --git a/py/runtime.h b/py/runtime.h
index 541c4de8f6..a867378838 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -48,7 +48,8 @@ typedef enum {
} rt_compare_op_t;
typedef enum {
- RT_F_LOAD_CONST_STR = 0,
+ RT_F_LOAD_CONST_DEC = 0,
+ RT_F_LOAD_CONST_STR,
RT_F_LOAD_NAME,
RT_F_LOAD_GLOBAL,
RT_F_LOAD_BUILD_CLASS,