Created
January 22, 2016 15:24
-
-
Save rolfbjarne/4ab3e2a0ac3507bcd985 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c | |
index be57350..f6df138 100644 | |
--- a/mono/mini/method-to-ir.c | |
+++ b/mono/mini/method-to-ir.c | |
@@ -6454,34 +6454,45 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign | |
if (!strcmp (cmethod->name, "Read") && fsig->param_count == 1) { | |
guint32 opcode = 0; | |
+<<<<<<< HEAD | |
gboolean is_ref = mini_type_is_reference (cfg, fsig->params [0]); | |
gboolean is_float = fsig->params [0]->type == MONO_TYPE_R4 || fsig->params [0]->type == MONO_TYPE_R8; | |
if (fsig->params [0]->type == MONO_TYPE_I1) | |
+======= | |
+ MonoType *t = fsig->params [0]; | |
+ gboolean is_ref; | |
+ gboolean is_float = t->type == MONO_TYPE_R4 || t->type == MONO_TYPE_R8; | |
+ | |
+ g_assert (t->byref); | |
+ /* t is a byref type, so the reference check is more complicated */ | |
+ is_ref = mini_type_is_reference (&mono_class_from_mono_type (t)->byval_arg); | |
+ if (t->type == MONO_TYPE_I1) | |
+>>>>>>> 7003343... [jit] Fix the reference type detection for Volatile:Read/Write (). Fixes part of #37846. | |
opcode = OP_ATOMIC_LOAD_I1; | |
- else if (fsig->params [0]->type == MONO_TYPE_U1 || fsig->params [0]->type == MONO_TYPE_BOOLEAN) | |
+ else if (t->type == MONO_TYPE_U1 || t->type == MONO_TYPE_BOOLEAN) | |
opcode = OP_ATOMIC_LOAD_U1; | |
- else if (fsig->params [0]->type == MONO_TYPE_I2) | |
+ else if (t->type == MONO_TYPE_I2) | |
opcode = OP_ATOMIC_LOAD_I2; | |
- else if (fsig->params [0]->type == MONO_TYPE_U2) | |
+ else if (t->type == MONO_TYPE_U2) | |
opcode = OP_ATOMIC_LOAD_U2; | |
- else if (fsig->params [0]->type == MONO_TYPE_I4) | |
+ else if (t->type == MONO_TYPE_I4) | |
opcode = OP_ATOMIC_LOAD_I4; | |
- else if (fsig->params [0]->type == MONO_TYPE_U4) | |
+ else if (t->type == MONO_TYPE_U4) | |
opcode = OP_ATOMIC_LOAD_U4; | |
- else if (fsig->params [0]->type == MONO_TYPE_R4) | |
+ else if (t->type == MONO_TYPE_R4) | |
opcode = OP_ATOMIC_LOAD_R4; | |
- else if (fsig->params [0]->type == MONO_TYPE_R8) | |
+ else if (t->type == MONO_TYPE_R8) | |
opcode = OP_ATOMIC_LOAD_R8; | |
#if SIZEOF_REGISTER == 8 | |
- else if (fsig->params [0]->type == MONO_TYPE_I8 || fsig->params [0]->type == MONO_TYPE_I) | |
+ else if (t->type == MONO_TYPE_I8 || t->type == MONO_TYPE_I) | |
opcode = OP_ATOMIC_LOAD_I8; | |
- else if (is_ref || fsig->params [0]->type == MONO_TYPE_U8 || fsig->params [0]->type == MONO_TYPE_U) | |
+ else if (is_ref || t->type == MONO_TYPE_U8 || t->type == MONO_TYPE_U) | |
opcode = OP_ATOMIC_LOAD_U8; | |
#else | |
- else if (fsig->params [0]->type == MONO_TYPE_I) | |
+ else if (t->type == MONO_TYPE_I) | |
opcode = OP_ATOMIC_LOAD_I4; | |
- else if (is_ref || fsig->params [0]->type == MONO_TYPE_U) | |
+ else if (is_ref || t->type == MONO_TYPE_U) | |
opcode = OP_ATOMIC_LOAD_U4; | |
#endif | |
@@ -6495,7 +6506,7 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign | |
ins->backend.memory_barrier_kind = MONO_MEMORY_BARRIER_ACQ; | |
MONO_ADD_INS (cfg->cbb, ins); | |
- switch (fsig->params [0]->type) { | |
+ switch (t->type) { | |
case MONO_TYPE_BOOLEAN: | |
case MONO_TYPE_I1: | |
case MONO_TYPE_U1: | |
@@ -6524,7 +6535,11 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign | |
ins->type = STACK_R8; | |
break; | |
default: | |
+<<<<<<< HEAD | |
g_assert (mini_type_is_reference (cfg, fsig->params [0])); | |
+======= | |
+ g_assert (is_ref); | |
+>>>>>>> 7003343... [jit] Fix the reference type detection for Volatile:Read/Write (). Fixes part of #37846. | |
ins->type = STACK_OBJ; | |
break; | |
} | |
@@ -6533,33 +6548,40 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign | |
if (!strcmp (cmethod->name, "Write") && fsig->param_count == 2) { | |
guint32 opcode = 0; | |
+<<<<<<< HEAD | |
gboolean is_ref = mini_type_is_reference (cfg, fsig->params [0]); | |
- | |
- if (fsig->params [0]->type == MONO_TYPE_I1) | |
+======= | |
+ MonoType *t = fsig->params [0]; | |
+ gboolean is_ref; | |
+>>>>>>> 7003343... [jit] Fix the reference type detection for Volatile:Read/Write (). Fixes part of #37846. | |
+ | |
+ g_assert (t->byref); | |
+ is_ref = mini_type_is_reference (&mono_class_from_mono_type (t)->byval_arg); | |
+ if (t->type == MONO_TYPE_I1) | |
opcode = OP_ATOMIC_STORE_I1; | |
- else if (fsig->params [0]->type == MONO_TYPE_U1 || fsig->params [0]->type == MONO_TYPE_BOOLEAN) | |
+ else if (t->type == MONO_TYPE_U1 || t->type == MONO_TYPE_BOOLEAN) | |
opcode = OP_ATOMIC_STORE_U1; | |
- else if (fsig->params [0]->type == MONO_TYPE_I2) | |
+ else if (t->type == MONO_TYPE_I2) | |
opcode = OP_ATOMIC_STORE_I2; | |
- else if (fsig->params [0]->type == MONO_TYPE_U2) | |
+ else if (t->type == MONO_TYPE_U2) | |
opcode = OP_ATOMIC_STORE_U2; | |
- else if (fsig->params [0]->type == MONO_TYPE_I4) | |
+ else if (t->type == MONO_TYPE_I4) | |
opcode = OP_ATOMIC_STORE_I4; | |
- else if (fsig->params [0]->type == MONO_TYPE_U4) | |
+ else if (t->type == MONO_TYPE_U4) | |
opcode = OP_ATOMIC_STORE_U4; | |
- else if (fsig->params [0]->type == MONO_TYPE_R4) | |
+ else if (t->type == MONO_TYPE_R4) | |
opcode = OP_ATOMIC_STORE_R4; | |
- else if (fsig->params [0]->type == MONO_TYPE_R8) | |
+ else if (t->type == MONO_TYPE_R8) | |
opcode = OP_ATOMIC_STORE_R8; | |
#if SIZEOF_REGISTER == 8 | |
- else if (fsig->params [0]->type == MONO_TYPE_I8 || fsig->params [0]->type == MONO_TYPE_I) | |
+ else if (t->type == MONO_TYPE_I8 || t->type == MONO_TYPE_I) | |
opcode = OP_ATOMIC_STORE_I8; | |
- else if (is_ref || fsig->params [0]->type == MONO_TYPE_U8 || fsig->params [0]->type == MONO_TYPE_U) | |
+ else if (is_ref || t->type == MONO_TYPE_U8 || t->type == MONO_TYPE_U) | |
opcode = OP_ATOMIC_STORE_U8; | |
#else | |
- else if (fsig->params [0]->type == MONO_TYPE_I) | |
+ else if (t->type == MONO_TYPE_I) | |
opcode = OP_ATOMIC_STORE_I4; | |
- else if (is_ref || fsig->params [0]->type == MONO_TYPE_U) | |
+ else if (is_ref || t->type == MONO_TYPE_U) | |
opcode = OP_ATOMIC_STORE_U4; | |
#endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment