2005-07-21 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mono / mini / inssel.brg
index 212d0a1224c0827e488945ba0dba8f3fcff06b7b..40c00f1df2155c897b58ba5546000c4eca0991b7 100644 (file)
@@ -931,8 +931,13 @@ stmt: OP_THROW_OR_NULL (reg, reg) {
 
        MONO_NEW_LABEL (s, dont_throw);
 
-       MONO_EMIT_NEW_BIALU (s, OP_COMPARE, 0, state->left->reg1, state->right->reg1);
-       MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BNE_UN, dont_throw);
+       /*
+        * Currently, we allways rethrow the abort exception, despite the fact
+        * that this is not correct. See thread6.cs for an example. But propagating
+        * the abort exception is more important than getting the sematics right.
+     */
+       MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, state->left->reg1, 0);
+       MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BEQ, dont_throw);
        MONO_EMIT_UNALU (s, tree, CEE_THROW, -1, state->left->reg1);
        mono_bblock_add_inst (s->cbb, dont_throw);
 }
@@ -998,7 +1003,7 @@ reg: CEE_ISINST (reg) {
                        MONO_EMIT_NEW_LOAD_MEMBASE (s, eclass_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, cast_class));
                        if (klass->cast_class == mono_defaults.object_class) {
                                int parent_reg = mono_regstate_next_int (s->rs);
-                               int const_reg;
+                               int const_reg = -1;
                                MONO_EMIT_NEW_LOAD_MEMBASE (s, parent_reg, eclass_reg, G_STRUCT_OFFSET (MonoClass, parent));
                                if (s->compile_aot) {
                                        const_reg = mono_regstate_next_int (s->rs);
@@ -1017,7 +1022,7 @@ reg: CEE_ISINST (reg) {
                                MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BEQ, object_is_null);
                                MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BR, false_label);
                        } else if (klass->cast_class == mono_defaults.enum_class->parent) {
-                               int const_reg;
+                               int const_reg = -1;
                                
                                if (s->compile_aot) {
                                        const_reg = mono_regstate_next_int (s->rs);
@@ -1231,7 +1236,7 @@ reg: CEE_CASTCLASS (reg) {
                        MONO_EMIT_NEW_LOAD_MEMBASE (s, eclass_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, cast_class));
                        if (klass->cast_class == mono_defaults.object_class) {
                                int parent_reg = mono_regstate_next_int (s->rs);
-                               int const_reg;
+                               int const_reg = -1;
                                MONO_EMIT_NEW_LOAD_MEMBASE (s, parent_reg, eclass_reg, G_STRUCT_OFFSET (MonoClass, parent));
                                if (s->compile_aot) {
                                        const_reg = mono_regstate_next_int (s->rs);