extern MonoStats mono_stats;
-typedef gpointer (*MonoRemotingTrampoline) (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target, MonoError *error);
-typedef gpointer (*MonoDelegateTrampoline) (MonoDomain *domain, MonoClass *klass);
-
typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
const char*
mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
-void
-mono_install_delegate_trampoline (MonoDelegateTrampoline func);
-
gpointer
mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
MonoRemoteClass*
mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_class, MonoError *error);
-void
-mono_install_remoting_trampoline (MonoRemotingTrampoline func);
-
#define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
#define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
#define mono_object_is_transparent_proxy(object) (((MonoObject*)object)->vtable->klass == mono_defaults.transparent_proxy_class)
void* (*compile_method) (MonoMethod *method, MonoError *error);
gpointer (*create_jump_trampoline) (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper, MonoError *error);
gpointer (*create_jit_trampoline) (MonoDomain *domain, MonoMethod *method, MonoError *error);
+ /* used to free a dynamic method */
+ void (*free_method) (MonoDomain *domain, MonoMethod *method);
+ gpointer (*create_remoting_trampoline) (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target, MonoError *error);
+ gpointer (*create_delegate_trampoline) (MonoDomain *domain, MonoClass *klass);
} MonoRuntimeCallbacks;
typedef gboolean (*MonoInternalStackWalk) (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer data);
gboolean (*mono_current_thread_has_handle_block_guard) (void);
} MonoRuntimeExceptionHandlingCallbacks;
-/* used to free a dynamic method */
-typedef void (*MonoFreeMethodFunc) (MonoDomain *domain, MonoMethod *method);
-
MONO_COLD void mono_set_pending_exception (MonoException *exc);
/* remoting and async support */
void
mono_runtime_free_method (MonoDomain *domain, MonoMethod *method);
-void
-mono_install_free_method (MonoFreeMethodFunc func);
-
void
mono_install_callbacks (MonoRuntimeCallbacks *cbs);
#ifndef DISABLE_REMOTING
static gpointer
-default_remoting_trampoline (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target, MonoError *error)
+create_remoting_trampoline (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target, MonoError *error)
{
- g_error ("remoting not installed");
- return NULL;
+ if (!callbacks.create_remoting_trampoline)
+ g_error ("remoting not installed");
+ return callbacks.create_remoting_trampoline (domain, method, target, error);
}
-static MonoRemotingTrampoline arch_create_remoting_trampoline = default_remoting_trampoline;
#endif
-static gpointer
-default_delegate_trampoline (MonoDomain *domain, MonoClass *klass)
-{
- g_assert_not_reached ();
- return NULL;
-}
-
-static MonoDelegateTrampoline arch_create_delegate_trampoline = default_delegate_trampoline;
static MonoImtTrampolineBuilder imt_trampoline_builder;
static gboolean always_build_imt_trampolines;
return &callbacks;
}
-#ifndef DISABLE_REMOTING
-void
-mono_install_remoting_trampoline (MonoRemotingTrampoline func)
-{
- arch_create_remoting_trampoline = func? func: default_remoting_trampoline;
-}
-#endif
-
-void
-mono_install_delegate_trampoline (MonoDelegateTrampoline func)
-{
- arch_create_delegate_trampoline = func? func: default_delegate_trampoline;
-}
-
void
mono_install_imt_trampoline_builder (MonoImtTrampolineBuilder func)
{
mono_error_init (error);
- if (!callbacks.compile_method) {
- g_error ("compile method called on uninitialized runtime");
- return NULL;
- }
+ g_assert (callbacks.compile_method);
res = callbacks.compile_method (method, error);
return res;
}
{
MONO_REQ_GC_NEUTRAL_MODE
- return arch_create_delegate_trampoline (mono_domain_get (), klass);
-}
-
-static MonoFreeMethodFunc default_mono_free_method = NULL;
-
-/**
- * mono_install_free_method:
- * @func: pointer to the MonoFreeMethodFunc used to release a method
- *
- * This is an internal VM routine, it is used for the engines to
- * register a handler to release the resources associated with a method.
- *
- * Methods are freed when no more references to the delegate that holds
- * them are left.
- */
-void
-mono_install_free_method (MonoFreeMethodFunc func)
-{
- default_mono_free_method = func;
+ g_assert (callbacks.create_delegate_trampoline);
+ return callbacks.create_delegate_trampoline (mono_domain_get (), klass);
}
/**
{
MONO_REQ_GC_NEUTRAL_MODE
- if (default_mono_free_method != NULL)
- default_mono_free_method (domain, method);
+ if (callbacks.free_method)
+ callbacks.free_method (domain, method);
mono_method_clear_object (domain, method);
MonoMethod *cm;
if ((cm = klass->vtable [i])) {
- pvt->vtable [i] = arch_create_remoting_trampoline (domain, cm, target_type, error);
+ pvt->vtable [i] = create_remoting_trampoline (domain, cm, target_type, error);
if (!is_ok (error))
goto failure;
} else
gpointer iter = NULL;
while ((m = mono_class_get_methods (k, &iter)))
if (!pvt->vtable [m->slot]) {
- pvt->vtable [m->slot] = arch_create_remoting_trampoline (domain, m, target_type, error);
+ pvt->vtable [m->slot] = create_remoting_trampoline (domain, m, target_type, error);
if (!is_ok (error))
goto failure;
}
iter = NULL;
j = 0;
while ((cm = mono_class_get_methods (interf, &iter))) {
- pvt->vtable [slot + j++] = arch_create_remoting_trampoline (domain, cm, target_type, error);
+ pvt->vtable [slot + j++] = create_remoting_trampoline (domain, cm, target_type, error);
if (!is_ok (error))
goto failure;
}
MONO_OBJECT_SETREF (delegate, target, target);
}
- delegate->invoke_impl = arch_create_delegate_trampoline (delegate->object.vtable->domain, delegate->object.vtable->klass);
+ delegate->invoke_impl = callbacks.create_delegate_trampoline (delegate->object.vtable->domain, delegate->object.vtable->klass);
if (callbacks.init_delegate)
callbacks.init_delegate (delegate);
return TRUE;
callbacks.compile_method = mono_jit_compile_method;
callbacks.create_jump_trampoline = mono_create_jump_trampoline;
callbacks.create_jit_trampoline = mono_create_jit_trampoline;
+ callbacks.create_delegate_trampoline = mono_create_delegate_trampoline;
+ callbacks.free_method = mono_jit_free_method;
+#ifndef DISABLE_REMOTING
+ callbacks.create_remoting_trampoline = mono_jit_create_remoting_trampoline;
+#endif
#endif
mono_install_callbacks (&callbacks);
mono_threads_install_cleanup (mini_thread_cleanup);
#ifdef JIT_TRAMPOLINES_WORK
- mono_install_free_method (mono_jit_free_method);
-#ifndef DISABLE_REMOTING
- mono_install_remoting_trampoline (mono_jit_create_remoting_trampoline);
-#endif
- mono_install_delegate_trampoline (mono_create_delegate_trampoline);
mono_install_create_domain_hook (mini_create_jit_domain_info);
mono_install_free_domain_hook (mini_free_jit_domain_info);
#endif