[arm] Also fix OP_ATOMIC_STORE_R4.
[mono.git] / mono / mini / decompose.c
index f29e913acf91e5849479f9e12d74514ffa68c1df..25dd97da870ef5c821a31e1b0c15a3c3dc6aa438 100644 (file)
@@ -299,7 +299,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins)
  * Sets the cfg exception if an opcode is not supported.
  */
 MonoInst*
-mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
+mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins, MonoBasicBlock **out_cbb)
 {
        MonoInst *repl = NULL;
        int type = ins->type;
@@ -466,7 +466,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
                                MONO_EMIT_NEW_UNALU (cfg, OP_ICEQ, reg2, -1);
                                MONO_EMIT_NEW_BIALU (cfg, OP_IAND, reg1, reg1, reg2);
                                MONO_EMIT_NEW_ICOMPARE_IMM (cfg, reg1, 1);
-                               MONO_EMIT_NEW_COND_EXC (cfg, IEQ, "DivideByZeroException");
+                               MONO_EMIT_NEW_COND_EXC (cfg, IEQ, "OverflowException");
                        }
 #endif
                        MONO_EMIT_NEW_BIALU (cfg, ins->opcode, ins->dreg, ins->sreg1, ins->sreg2);
@@ -556,7 +556,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
                                }
                        }
 
-                       call = mono_emit_native_call (cfg, mono_icall_get_wrapper (info), info->sig, args);
+                       call = mono_emit_jit_icall_by_info (cfg, info, args, out_cbb);
                        call->dreg = ins->dreg;
 
                        NULLIFY_INS (ins);
@@ -629,14 +629,13 @@ mono_decompose_long_opts (MonoCompile *cfg)
        first_bb = cfg->cbb;
 
        for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
-               MonoInst *tree = bb->code;      
+               MonoInst *tree = mono_bb_first_inst(bb, FILTER_IL_SEQ_POINT);
                MonoInst *prev = NULL;
 
                   /*
                mono_print_bb (bb, "BEFORE LOWER_LONG_OPTS");
                */
 
-               tree = bb->code;
                cfg->cbb->code = cfg->cbb->last_ins = NULL;
 
                while (tree) {
@@ -967,7 +966,7 @@ mono_decompose_long_opts (MonoCompile *cfg)
                                break;
 
                        case OP_LCOMPARE: {
-                               MonoInst *next = tree->next;
+                               MonoInst *next = mono_inst_next (tree, FILTER_IL_SEQ_POINT);
 
                                g_assert (next);
 
@@ -1049,7 +1048,7 @@ mono_decompose_long_opts (MonoCompile *cfg)
 
                        /* Not yet used, since lcompare is decomposed before local cprop */
                        case OP_LCOMPARE_IMM: {
-                               MonoInst *next = tree->next;
+                               MonoInst *next = mono_inst_next (tree, FILTER_IL_SEQ_POINT);
                                guint32 low_imm = tree->inst_ls_word;
                                guint32 high_imm = tree->inst_ms_word;
                                int low_reg = tree->sreg1 + 1;
@@ -1149,9 +1148,9 @@ mono_decompose_long_opts (MonoCompile *cfg)
 
                                /* Process the newly added ops again since they can be long ops too */
                                if (prev)
-                                       tree = prev->next;
+                                       tree = mono_inst_next (prev, FILTER_IL_SEQ_POINT);
                                else
-                                       tree = bb->code;
+                                       tree = mono_bb_first_inst (bb, FILTER_IL_SEQ_POINT);
 
                                first_bb->code = first_bb->last_ins = NULL;
                                first_bb->in_count = first_bb->out_count = 0;
@@ -1159,7 +1158,7 @@ mono_decompose_long_opts (MonoCompile *cfg)
                        }
                        else {
                                prev = tree;
-                               tree = tree->next;
+                               tree = mono_inst_next (tree, FILTER_IL_SEQ_POINT);
                        }
                }
        }