svn path=/trunk/mono/; revision=53658
[mono.git] / mono / mini / jit-icalls.c
index b14473627cfef8af5e506b09cd7d4d9ac33afd20..8f0c7aa0efead853447ecfe1df8c923e0bfd7fde 100644 (file)
@@ -19,7 +19,7 @@ mono_ldftn (MonoMethod *method)
 
        addr = mono_create_jump_trampoline (mono_domain_get (), method, TRUE);
 
-       return addr;
+       return mono_create_ftnptr (mono_domain_get (), addr);
 }
 
 /*
@@ -35,7 +35,7 @@ mono_ldftn_nosync (MonoMethod *method)
 
        addr = mono_create_jump_trampoline (mono_domain_get (), method, FALSE);
 
-       return addr;
+       return mono_create_ftnptr (mono_domain_get (), addr);
 }
 
 static void*
@@ -226,15 +226,7 @@ mono_llmult_ovf (gint64 a, gint64 b)
        return 0;
 }
 
-#ifdef MONO_ARCH_EMULATE_MUL_DIV
-
-static gint32
-mono_imul (gint32 a, gint32 b)
-{
-       MONO_ARCH_SAVE_REGS;
-
-       return a * b;
-}
+#if defined(MONO_ARCH_EMULATE_MUL_DIV) || defined(MONO_ARCH_EMULATE_DIV)
 
 static gint32
 mono_idiv (gint32 a, gint32 b)
@@ -289,6 +281,18 @@ mono_irem_un (guint32 a, guint32 b)
        return a % b;
 }
 
+#endif
+
+#ifdef MONO_ARCH_EMULATE_MUL_DIV
+
+static gint32
+mono_imul (gint32 a, gint32 b)
+{
+       MONO_ARCH_SAVE_REGS;
+
+       return a * b;
+}
+
 static gint32
 mono_imul_ovf (gint32 a, gint32 b)
 {
@@ -494,7 +498,12 @@ mono_array_new_va (MonoMethod *cm, ...)
 
        if (rank == pcount) {
                /* Only lengths provided. */
-               lower_bounds = NULL;
+               if (cm->klass->byval_arg.type == MONO_TYPE_ARRAY) {
+                       lower_bounds = alloca (sizeof (guint32) * rank);
+                       memset (lower_bounds, 0, sizeof (guint32) * rank);
+               } else {
+                       lower_bounds = NULL;
+               }
        } else {
                g_assert (pcount == (rank * 2));
                /* lower bounds are first. */
@@ -647,9 +656,15 @@ helper_compile_generic_method (MonoObject *obj, MonoMethod *method, MonoGenericC
        gpointer addr;
 
        vmethod = mono_object_get_virtual_method (obj, method);
-       inflated = mono_class_inflate_generic_method (vmethod, context, NULL);
+       inflated = mono_class_inflate_generic_method (vmethod, context);
        inflated = mono_get_inflated_method (inflated);
        addr = mono_compile_method (inflated);
 
        return addr;
 }
+
+static MonoString*
+helper_ldstr (MonoImage *image, guint32 idx)
+{
+       return mono_ldstr (mono_domain_get (), image, idx);
+}