* Exception.cs: Cosmetic change to default exception message on
[mono.git] / mono / mini / cfold.c
index 9ecef4709a08d7df7768a12fa638005f6bf3cae1..ff187c3fa68a3532a670f634b578c42b94d5fc94 100644 (file)
@@ -29,7 +29,7 @@ mono_is_power_of_two (guint32 val)
                        return; \
                if (inst->inst_i1->opcode == OP_ICONST) {       \
                        inst->opcode = OP_ICONST;       \
-                       inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0;       \
+                       inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0);     \
                } \
                 return;
 
@@ -43,7 +43,7 @@ mono_is_power_of_two (guint32 val)
                if (inst->inst_i0->opcode == OP_ICONST) {\
                        if (inst->inst_i1->opcode == OP_ICONST) {       \
                                inst->opcode = OP_ICONST;       \
-                               inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0;       \
+                               inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0);     \
                                 return; \
                        } else { \
                                MonoInst *tmp = inst->inst_i0;  \
@@ -150,9 +150,9 @@ mono_is_power_of_two (guint32 val)
                        return; \
                if (inst->inst_i0->inst_i1->opcode == OP_ICONST) {      \
                        if ((cast)inst->inst_i0->inst_i0->inst_c0 op (cast)inst->inst_i0->inst_i1->inst_c0)     \
-                               inst->opcode = CEE_BR;  \
+                               inst->opcode = OP_BR;   \
                        else    \
-                               inst->opcode = CEE_NOP; \
+                               inst->opcode = OP_NOP;  \
                } \
                 return;
 
@@ -258,6 +258,9 @@ mono_constant_fold (MonoCompile *cfg)
  * If the arguments to the cond branch are constants, eval and
  * return BRANCH_NOT_TAKEN for not taken, BRANCH_TAKEN for taken,
  * BRANCH_UNDEF otherwise.
+ * If this code is changed to handle also non-const values, make sure
+ * side effects are handled in optimize_branches() in mini.c, by
+ * inserting pop instructions.
  */
 int
 mono_eval_cond_branch (MonoInst *ins)