Fix bug: emit native didn't clear last_was_return in label_assign.

This commit is contained in:
Damien 2013-11-02 20:34:54 +00:00
parent 7410e440ab
commit 6ba1314265
3 changed files with 11 additions and 4 deletions

View File

@ -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) { 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 to commit stack because we can jump here from elsewhere
need_stack_settled(emit); need_stack_settled(emit);
#if N_X64 #if N_X64
@ -521,6 +522,7 @@ static void emit_native_label_assign(emit_t *emit, int l) {
#elif N_THUMB #elif N_THUMB
asm_thumb_label_assign(emit->as, l); asm_thumb_label_assign(emit->as, l);
#endif #endif
emit_post(emit);
} }
static void emit_native_import_name(emit_t *emit, qstr qstr) { 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) { static void emit_native_load_const_dec(emit_t *emit, qstr qstr) {
// not supported for viper (although, could support floats in future) // for viper, a float/complex is just a Python object
assert(0); 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) { 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) { 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) { static void emit_native_continue_loop(emit_t *emit, int label) {
assert(0); assert(0);

View File

@ -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] = { void *const rt_fun_table[RT_F_NUMBER_OF] = {
rt_load_const_dec,
rt_load_const_str, rt_load_const_str,
rt_load_name, rt_load_name,
rt_load_global, rt_load_global,

View File

@ -48,7 +48,8 @@ typedef enum {
} rt_compare_op_t; } rt_compare_op_t;
typedef enum { 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_NAME,
RT_F_LOAD_GLOBAL, RT_F_LOAD_GLOBAL,
RT_F_LOAD_BUILD_CLASS, RT_F_LOAD_BUILD_CLASS,