res = mono_class_inflate_generic_method (res, &context);
}
- if (mono_method_needs_static_rgctx_invoke (res, FALSE))
- res = mono_marshal_get_static_rgctx_invoke (res);
+ /* An rgctx wrapper is added by the trampolines no need to do it here */
return mono_ldftn (res);
}
{
MonoDomain *domain = mono_domain_get ();
va_list ap;
- guint32 *lengths;
- guint32 *lower_bounds;
+ uintptr_t *lengths;
+ intptr_t *lower_bounds;
int pcount;
int rank;
int i, d;
va_start (ap, cm);
- lengths = alloca (sizeof (guint32) * pcount);
+ lengths = alloca (sizeof (uintptr_t) * pcount);
for (i = 0; i < pcount; ++i)
lengths [i] = d = va_arg(ap, int);
if (rank == pcount) {
/* Only lengths provided. */
if (cm->klass->byval_arg.type == MONO_TYPE_ARRAY) {
- lower_bounds = alloca (sizeof (guint32) * rank);
- memset (lower_bounds, 0, sizeof (guint32) * rank);
+ lower_bounds = alloca (sizeof (intptr_t) * rank);
+ memset (lower_bounds, 0, sizeof (intptr_t) * rank);
} else {
lower_bounds = NULL;
}
} else {
g_assert (pcount == (rank * 2));
/* lower bounds are first. */
- lower_bounds = lengths;
+ lower_bounds = (intptr_t*)lengths;
lengths += rank;
}
va_end(ap);
mono_array_new_1 (MonoMethod *cm, guint32 length)
{
MonoDomain *domain = mono_domain_get ();
- guint32 lengths [1];
- guint32 *lower_bounds;
+ uintptr_t lengths [1];
+ intptr_t *lower_bounds;
int pcount;
int rank;
g_assert (rank == pcount);
if (cm->klass->byval_arg.type == MONO_TYPE_ARRAY) {
- lower_bounds = alloca (sizeof (guint32) * rank);
- memset (lower_bounds, 0, sizeof (guint32) * rank);
+ lower_bounds = alloca (sizeof (intptr_t) * rank);
+ memset (lower_bounds, 0, sizeof (intptr_t) * rank);
} else {
lower_bounds = NULL;
}
mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2)
{
MonoDomain *domain = mono_domain_get ();
- guint32 lengths [2];
- guint32 *lower_bounds;
+ uintptr_t lengths [2];
+ intptr_t *lower_bounds;
int pcount;
int rank;
g_assert (rank == pcount);
if (cm->klass->byval_arg.type == MONO_TYPE_ARRAY) {
- lower_bounds = alloca (sizeof (guint32) * rank);
- memset (lower_bounds, 0, sizeof (guint32) * rank);
+ lower_bounds = alloca (sizeof (intptr_t) * rank);
+ memset (lower_bounds, 0, sizeof (intptr_t) * rank);
+ } else {
+ lower_bounds = NULL;
+ }
+
+ return mono_array_new_full (domain, cm->klass, lengths, lower_bounds);
+}
+
+MonoArray *
+mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3)
+{
+ MonoDomain *domain = mono_domain_get ();
+ uintptr_t lengths [3];
+ intptr_t *lower_bounds;
+ int pcount;
+ int rank;
+
+ MONO_ARCH_SAVE_REGS;
+
+ pcount = mono_method_signature (cm)->param_count;
+ rank = cm->klass->rank;
+
+ lengths [0] = length1;
+ lengths [1] = length2;
+ lengths [2] = length3;
+
+ g_assert (rank == pcount);
+
+ if (cm->klass->byval_arg.type == MONO_TYPE_ARRAY) {
+ lower_bounds = alloca (sizeof (intptr_t) * rank);
+ memset (lower_bounds, 0, sizeof (intptr_t) * rank);
} else {
lower_bounds = NULL;
}
mono_class_init (field->parent);
- vtable = mono_class_vtable (domain, field->parent);
+ vtable = mono_class_vtable_full (domain, field->parent, TRUE);
if (!vtable->initialized)
mono_runtime_class_init (vtable);
gpointer
mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg)
{
- MonoMethod *vmethod, *inflated;
+ MonoMethod *vmethod;
gpointer addr;
MonoGenericContext *context = mono_method_get_context (method);
if (obj == NULL)
mono_raise_exception (mono_get_exception_null_reference ());
vmethod = mono_object_get_virtual_method (obj, method);
-
- /* 'vmethod' is partially inflated. All the blanks corresponding to the type parameters of the
- declaring class have been inflated. We still need to fully inflate the method parameters.
-
- FIXME: This code depends on the declaring class being fully inflated, since we inflate it twice with
- the same context.
- */
g_assert (!vmethod->klass->generic_container);
g_assert (!vmethod->klass->generic_class || !vmethod->klass->generic_class->context.class_inst->is_open);
g_assert (!context->method_inst || !context->method_inst->is_open);
- inflated = mono_class_inflate_generic_method (vmethod, context);
- if (mono_method_needs_static_rgctx_invoke (inflated, FALSE))
- inflated = mono_marshal_get_static_rgctx_invoke (inflated);
- addr = mono_compile_method (inflated);
+
+ addr = mono_compile_method (vmethod);
+
+ if (mono_method_needs_static_rgctx_invoke (vmethod, FALSE))
+ addr = mono_create_static_rgctx_trampoline (vmethod, addr);
/* Since this is a virtual call, have to unbox vtypes */
if (obj->vtable->klass->valuetype)
return NULL;
}
+
+gpointer
+mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpointer func)
+{
+ MonoMarshalSpec **mspecs;
+ MonoMethodPInvoke piinfo;
+ MonoMethod *m;
+
+ mspecs = g_new0 (MonoMarshalSpec*, sig->param_count + 1);
+ memset (&piinfo, 0, sizeof (piinfo));
+
+ m = mono_marshal_get_native_func_wrapper (image, sig, &piinfo, mspecs, func);
+
+ return mono_compile_method (m);
+}