#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-threads-coop.h>
#include <mono/utils/checked-build.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
#include <mono/io-layer/io-layer.h>
#include "mini.h"
void *ptr;
if (mono_aot_only)
- g_error ("Attempting to allocate from the global code manager while running with --aot-only.\n");
+ g_error ("Attempting to allocate from the global code manager while running in aot-only mode.\n");
if (!global_codeman) {
/* This can happen during startup */
return ji;
}
+#if !defined(DISABLE_LOGGING) && !defined(DISABLE_JIT)
+
+static const char* const patch_info_str[] = {
+#define PATCH_INFO(a,b) "" #a,
+#include "patch-info.h"
+#undef PATCH_INFO
+};
+
+const char*
+mono_ji_type_to_string (MonoJumpInfoType type)
+{
+ return patch_info_str [type];
+}
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
+{
+ switch (ji->type) {
+ case MONO_PATCH_INFO_RGCTX_FETCH: {
+ MonoJumpInfoRgctxEntry *entry = ji->data.rgctx_entry;
+
+ printf ("[RGCTX_FETCH ");
+ mono_print_ji (entry->data);
+ printf (" - %s]", mono_rgctx_info_type_to_str (entry->info_type));
+ break;
+ }
+ case MONO_PATCH_INFO_METHODCONST: {
+ char *s = mono_method_full_name (ji->data.method, TRUE);
+ printf ("[METHODCONST - %s]", s);
+ g_free (s);
+ break;
+ }
+ case MONO_PATCH_INFO_INTERNAL_METHOD: {
+ printf ("[INTERNAL_METHOD - %s]", ji->data.name);
+ break;
+ }
+ default:
+ printf ("[%s]", patch_info_str [ji->type]);
+ break;
+ }
+}
+
+#else
+
+const char*
+mono_ji_type_to_string (MonoJumpInfoType type)
+{
+ return "";
+}
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
+{
+}
+
+#endif
+
/**
* mono_patch_info_dup_mp:
*
case MONO_PATCH_INFO_GOT_OFFSET:
case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
case MONO_PATCH_INFO_AOT_MODULE:
+ case MONO_PATCH_INFO_GET_TLS_TRAMP:
return (ji->type << 8);
case MONO_PATCH_INFO_CASTCLASS_CACHE:
return (ji->type << 8) | (ji->data.index);
break;
case MONO_PATCH_INFO_IID:
mono_class_init (patch_info->data.klass);
- target = GINT_TO_POINTER ((int)patch_info->data.klass->interface_id);
+ target = GUINT_TO_POINTER (patch_info->data.klass->interface_id);
break;
case MONO_PATCH_INFO_ADJUSTED_IID:
mono_class_init (patch_info->data.klass);
- target = GINT_TO_POINTER ((int)(-((patch_info->data.klass->interface_id + 1) * SIZEOF_VOID_P)));
+ target = GUINT_TO_POINTER ((guint32)(-((patch_info->data.klass->interface_id + 1) * SIZEOF_VOID_P)));
break;
case MONO_PATCH_INFO_VTABLE:
target = mono_class_vtable (domain, patch_info->data.klass);
}
g_assert (vtable);
- if (!vtable->initialized && !(vtable->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) && (method && mono_class_needs_cctor_run (vtable->klass, method)))
+ if (!vtable->initialized && !mono_class_is_before_field_init (vtable->klass) && (method && mono_class_needs_cctor_run (vtable->klass, method)))
/* Done by the generated code */
;
else {
case MONO_PATCH_INFO_GSHAREDVT_IN_WRAPPER:
target = mini_get_gsharedvt_wrapper (TRUE, NULL, patch_info->data.sig, NULL, -1, FALSE);
break;
+ case MONO_PATCH_INFO_GET_TLS_TRAMP:
+#ifdef MONO_ARCH_HAVE_GET_TLS_TRAMP
+ target = mono_arch_get_get_tls_tramp ();
+#else
+ target = NULL;
+#endif
+ break;
default:
g_assert_not_reached ();
}
if ((code = mono_aot_get_method_checked (domain, method, error))) {
MonoVTable *vtable;
+ if (mono_runtime_is_critical_method (method) || mono_gc_is_critical_method (method)) {
+ /*
+ * The suspend code needs to be able to lookup these methods by ip in async context,
+ * so preload their jit info.
+ */
+ MonoJitInfo *ji = mono_jit_info_table_find (domain, code);
+ g_assert (ji);
+ }
+
/*
* In llvm-only mode, method might be a shared method, so we can't initialize its class.
* This is not a problem, since it will be initialized when the method is first
*/
mono_class_setup_vtable (method->klass);
if (mono_class_has_failure (method->klass)) {
- MonoException *fail_exc = mono_class_get_exception_for_failure (method->klass);
+ mono_error_set_for_class_failure (error, method->klass);
if (exc)
- *exc = (MonoObject*)fail_exc;
- mono_error_set_exception_instance (error, fail_exc);
+ *exc = (MonoObject*)mono_class_get_exception_for_failure (method->klass);
return NULL;
}
}
return NULL;
is_virtual_generic = method->is_inflated && mono_method_get_declaring_generic_method (method)->is_generic;
- is_interface = method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ? TRUE : FALSE;
+ is_interface = mono_class_is_interface (method->klass);
load_imt_reg = is_virtual_generic || is_interface;
if (is_interface)
ves_icall_get_trace);
mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers",
mono_runtime_install_handlers);
+ mono_add_internal_call ("Mono.Runtime::mono_runtime_cleanup_handlers",
+ mono_runtime_cleanup_handlers);
#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
}
if (method->flags & METHOD_ATTRIBUTE_ABSTRACT)
continue;
- if (method->is_generic || method->klass->generic_container)
+ if (method->is_generic || mono_class_is_gtd (method->klass))
continue;
count++;
/* Not used */
g_assert_not_reached ();
}
+
+// Custom handlers currently only implemented by Windows.
+#ifndef HOST_WIN32
+gboolean
+mono_runtime_install_custom_handlers (const char *handlers)
+{
+ return FALSE;
+}
+
+void
+mono_runtime_install_custom_handlers_usage (void)
+{
+ fprintf (stdout,
+ "Custom Handlers:\n"
+ " --handlers=HANDLERS Enable handler support, HANDLERS is a comma\n"
+ " separated list of available handlers to install.\n"
+ "\n"
+ "No handlers supported on current platform.\n");
+}
+#endif /* HOST_WIN32 */