return NULL;
}
+static gboolean
+byref_arg_is_reference (MonoType *t)
+{
+ g_assert (t->byref);
+
+ return mini_type_is_reference (m_class_get_byval_arg (mono_class_from_mono_type_internal (t)));
+}
+
MonoInst*
mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
{
return ins;
} else if (strcmp (cmethod->name, "MemoryBarrier") == 0 && fsig->param_count == 0) {
return mini_emit_memory_barrier (cfg, MONO_MEMORY_BARRIER_SEQ);
- } else if (!strcmp (cmethod->name, "VolatileRead") && fsig->param_count == 1) {
+ } else if (!strcmp (cmethod->name, "VolatileRead") && fsig->param_count == 1 && fsig->params [0]->byref) {
guint32 opcode = 0;
- gboolean is_ref = mini_type_is_reference (fsig->params [0]);
+ gboolean is_ref = byref_arg_is_reference (fsig->params [0]);
if (fsig->params [0]->type == MONO_TYPE_I1)
opcode = OP_LOADI1_MEMBASE;
return ins;
}
- } else if (!strcmp (cmethod->name, "VolatileWrite") && fsig->param_count == 2) {
+ } else if (!strcmp (cmethod->name, "VolatileWrite") && fsig->param_count == 2 && fsig->params [0]->byref) {
guint32 opcode = 0;
- gboolean is_ref = mini_type_is_reference (fsig->params [0]);
+ gboolean is_ref = byref_arg_is_reference (fsig->params [0]);
if (fsig->params [0]->type == MONO_TYPE_I1 || fsig->params [0]->type == MONO_TYPE_U1)
opcode = OP_STOREI1_MEMBASE_REG;
MONO_ADD_INS (cfg->cbb, ins);
}
}
- else if (strcmp (cmethod->name, "Exchange") == 0 && fsig->param_count == 2) {
+ else if (strcmp (cmethod->name, "Exchange") == 0 && fsig->param_count == 2 && fsig->params [0]->byref) {
MonoInst *f2i = NULL, *i2f;
guint32 opcode, f2i_opcode, i2f_opcode;
- gboolean is_ref = mini_type_is_reference (fsig->params [0]);
+ gboolean is_ref = byref_arg_is_reference (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_I4 ||
ins->type = STACK_R8;
break;
default:
- g_assert (mini_type_is_reference (fsig->params [0]));
+ g_assert (is_ref);
ins->type = STACK_OBJ;
break;
}
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 (m_class_get_byval_arg (mono_class_from_mono_type_internal (t)));
+ is_ref = byref_arg_is_reference (t);
if (t->type == MONO_TYPE_I1)
opcode = OP_ATOMIC_LOAD_I1;
else if (t->type == MONO_TYPE_U1 || t->type == MONO_TYPE_BOOLEAN)
gboolean is_ref;
g_assert (t->byref);
- is_ref = mini_type_is_reference (m_class_get_byval_arg (mono_class_from_mono_type_internal (t)));
+ is_ref = byref_arg_is_reference (t);
if (t->type == MONO_TYPE_I1)
opcode = OP_ATOMIC_STORE_I1;
else if (t->type == MONO_TYPE_U1 || t->type == MONO_TYPE_BOOLEAN)