register_icall (mono_marshal_xdomain_copy_out_value, "mono_marshal_xdomain_copy_out_value", "void object object", FALSE);
register_icall (mono_remoting_wrapper, "mono_remoting_wrapper", "object ptr ptr", FALSE);
register_icall (mono_upgrade_remote_class_wrapper, "mono_upgrade_remote_class_wrapper", "void object object", FALSE);
+
+#ifndef DISABLE_JIT
register_icall (mono_compile_method_icall, "mono_compile_method_icall", "ptr ptr", FALSE);
- /* mono_load_remote_field_new_icall registered by mini-runtime.c */
- /* mono_store_remote_field_new_icall registered by mini-runtime.c */
+#endif
}
return res;
}
-/*
- * mono_marshal_get_ldfld_remote_wrapper:
- * @klass: The return type
- *
- * This method generates a wrapper for calling mono_load_remote_field_new.
- * The return type is ignored for now, as mono_load_remote_field_new () always
- * returns an object. In the future, to optimize some codepaths, we might
- * call a different function that takes a pointer to a valuetype, instead.
- */
-MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass)
-{
- MonoMethodSignature *sig;
- MonoMethodBuilder *mb;
- MonoMethod *res;
- static MonoMethod* cached = NULL;
-
- mono_marshal_lock_internal ();
- if (cached) {
- mono_marshal_unlock_internal ();
- return cached;
- }
- mono_marshal_unlock_internal ();
-
- mb = mono_mb_new_no_dup_name (mono_defaults.object_class, "__mono_load_remote_field_new_wrapper", MONO_WRAPPER_LDFLD_REMOTE);
-
- mb->method->save_lmf = 1;
-
- sig = mono_metadata_signature_alloc (mono_defaults.corlib, 3);
- sig->params [0] = &mono_defaults.object_class->byval_arg;
- sig->params [1] = &mono_defaults.int_class->byval_arg;
- sig->params [2] = &mono_defaults.int_class->byval_arg;
- sig->ret = &mono_defaults.object_class->byval_arg;
-
-#ifndef DISABLE_JIT
- mono_mb_emit_ldarg (mb, 0);
- mono_mb_emit_ldarg (mb, 1);
- mono_mb_emit_ldarg (mb, 2);
-
- mono_mb_emit_icall (mb, mono_load_remote_field_new_icall);
-
- mono_mb_emit_byte (mb, CEE_RET);
-#endif
-
- mono_marshal_lock_internal ();
- res = cached;
- mono_marshal_unlock_internal ();
- if (!res) {
- MonoMethod *newm;
- newm = mono_mb_create (mb, sig, 4, NULL);
- mono_marshal_lock_internal ();
- res = cached;
- if (!res) {
- res = newm;
- cached = res;
- mono_marshal_unlock_internal ();
- } else {
- mono_marshal_unlock_internal ();
- mono_free_method (newm);
- }
- }
- mono_mb_free (mb);
-
- return res;
-}
-
/*
* mono_marshal_get_ldfld_wrapper:
* @type: the type of the field
WrapperInfo *info;
char *name;
int t, pos0, pos1 = 0;
+ static MonoMethod* tp_load = NULL;
type = mono_type_get_underlying_type (type);
if ((res = mono_marshal_find_in_cache (cache, klass)))
return res;
+#ifndef DISABLE_REMOTING
+ if (!tp_load) {
+ tp_load = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "LoadRemoteFieldNew", -1);
+ g_assert (tp_load != NULL);
+ }
+#endif
+
/* we add the %p pointer value of klass because class names are not unique */
name = g_strdup_printf ("__ldfld_wrapper_%p_%s.%s", klass, klass->name_space, klass->name);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_LDFLD);
mono_mb_emit_ldarg (mb, 0);
pos0 = mono_mb_emit_proxy_check (mb, CEE_BNE_UN);
+#ifndef DISABLE_REMOTING
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_ldarg (mb, 1);
mono_mb_emit_ldarg (mb, 2);
- mono_mb_emit_managed_call (mb, mono_marshal_get_ldfld_remote_wrapper (klass), NULL);
+ mono_mb_emit_managed_call (mb, tp_load, NULL);
/*
csig = mono_metadata_signature_alloc (mono_defaults.corlib, 3);
} else {
mono_mb_emit_byte (mb, CEE_RET);
}
+#endif
mono_mb_patch_branch (mb, pos0);
klass = mono_defaults.array_class;
} else if (type->type == MONO_TYPE_VALUETYPE) {
klass = type->data.klass;
- } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING ||
- t == MONO_TYPE_CLASS) {
+ } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING) {
klass = mono_defaults.object_class;
} else if (t == MONO_TYPE_PTR || t == MONO_TYPE_FNPTR) {
klass = mono_defaults.int_class;
return res;
}
-/*
- * mono_marshal_get_stfld_remote_wrapper:
- * klass: The type of the field
- *
- * This function generates a wrapper for calling mono_store_remote_field_new
- * with the appropriate signature.
- * Similarly to mono_marshal_get_ldfld_remote_wrapper () this doesn't depend on the
- * klass argument anymore.
- */
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass)
-{
- MonoMethodSignature *sig;
- MonoMethodBuilder *mb;
- MonoMethod *res;
- static MonoMethod *cached = NULL;
-
- mono_marshal_lock_internal ();
- if (cached) {
- mono_marshal_unlock_internal ();
- return cached;
- }
- mono_marshal_unlock_internal ();
-
- mb = mono_mb_new_no_dup_name (mono_defaults.object_class, "__mono_store_remote_field_new_wrapper", MONO_WRAPPER_STFLD_REMOTE);
-
- mb->method->save_lmf = 1;
-
- sig = mono_metadata_signature_alloc (mono_defaults.corlib, 4);
- sig->params [0] = &mono_defaults.object_class->byval_arg;
- sig->params [1] = &mono_defaults.int_class->byval_arg;
- sig->params [2] = &mono_defaults.int_class->byval_arg;
- sig->params [3] = &mono_defaults.object_class->byval_arg;
- sig->ret = &mono_defaults.void_class->byval_arg;
-
-#ifndef DISABLE_JIT
- mono_mb_emit_ldarg (mb, 0);
- mono_mb_emit_ldarg (mb, 1);
- mono_mb_emit_ldarg (mb, 2);
- mono_mb_emit_ldarg (mb, 3);
-
- mono_mb_emit_icall (mb, mono_store_remote_field_new_icall);
-
- mono_mb_emit_byte (mb, CEE_RET);
-#endif
-
- mono_marshal_lock_internal ();
- res = cached;
- mono_marshal_unlock_internal ();
- if (!res) {
- MonoMethod *newm;
- newm = mono_mb_create (mb, sig, 6, NULL);
- mono_marshal_lock_internal ();
- res = cached;
- if (!res) {
- res = newm;
- cached = res;
- mono_marshal_unlock_internal ();
- } else {
- mono_marshal_unlock_internal ();
- mono_free_method (newm);
- }
- }
- mono_mb_free (mb);
-
- return res;
-}
/*
* mono_marshal_get_stfld_wrapper:
WrapperInfo *info;
char *name;
int t, pos;
+ static MonoMethod *tp_store = NULL;
type = mono_type_get_underlying_type (type);
t = type->type;
if ((res = mono_marshal_find_in_cache (cache, klass)))
return res;
+#ifndef DISABLE_REMOTING
+ if (!tp_store) {
+ tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1);
+ g_assert (tp_store != NULL);
+ }
+#endif
+
/* we add the %p pointer value of klass because class names are not unique */
name = g_strdup_printf ("__stfld_wrapper_%p_%s.%s", klass, klass->name_space, klass->name);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_STFLD);
mono_mb_emit_ldarg (mb, 0);
pos = mono_mb_emit_proxy_check (mb, CEE_BNE_UN);
+#ifndef DISABLE_REMOTING
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_ldarg (mb, 1);
mono_mb_emit_ldarg (mb, 2);
if (klass->valuetype)
mono_mb_emit_op (mb, CEE_BOX, klass);
- mono_mb_emit_managed_call (mb, mono_marshal_get_stfld_remote_wrapper (klass), NULL);
+ mono_mb_emit_managed_call (mb, tp_store, NULL);
mono_mb_emit_byte (mb, CEE_RET);
+#endif
mono_mb_patch_branch (mb, pos);