#include <mono/utils/dtrace.h>
#include <mono/utils/mono-signal-handler.h>
#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-threads-coop.h>
#include <mono/utils/checked-build.h>
#include <mono/io-layer/io-layer.h>
handle = mono_ldtoken_checked (patch_info->data.token->image,
patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
if (!mono_error_ok (error))
- g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
+ return NULL;
mono_class_init (handle_class);
mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
mono_error_init (error);
+ if (mono_llvm_only)
+ /* Should be handled by the caller */
+ g_assert (!(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED));
+
/*
* ICALL wrappers are handled specially, since there is only one copy of them
* shared by all appdomains.
info = g_new0 (RuntimeInvokeInfo, 1);
info->compiled_method = compiled_method;
- info->sig = mono_method_signature (method);
+ if (mono_llvm_only && method->string_ctor)
+ info->sig = mono_marshal_get_string_ctor_signature (method);
+ else
+ info->sig = mono_method_signature (method);
invoke = mono_marshal_get_runtime_invoke (method, FALSE);
info->vtable = mono_class_vtable_full (domain, method->klass, error);
return NULL;
g_assert (info->vtable);
- MonoMethodSignature *sig = mono_method_signature (method);
+ MonoMethodSignature *sig = info->sig;
MonoType *ret_type;
/*
runtime_invoke = (MonoObject *(*)(MonoObject *, void **, MonoObject **, void *))info->runtime_invoke;
runtime_invoke (NULL, args, exc, info->compiled_method);
- if (exc && *exc)
+ if (exc && *exc) {
mono_error_set_exception_instance (error, (MonoException*) *exc);
+ return NULL;
+ }
if (sig->ret->type != MONO_TYPE_VOID && info->ret_box_class)
return mono_value_box_checked (domain, info->ret_box_class, retval, error);
mono_arch_start_dyn_call (info->dyn_call_info, (gpointer**)args, retval, buf, sizeof (buf));
dyn_runtime_invoke (buf, exc, info->compiled_method);
- if (catchExcInMonoError && *exc != NULL)
- mono_error_set_exception_instance (error, (MonoException*) *exc);
-
mono_arch_finish_dyn_call (info->dyn_call_info, buf);
+ if (catchExcInMonoError && *exc != NULL) {
+ mono_error_set_exception_instance (error, (MonoException*) *exc);
+ return NULL;
+ }
+
if (info->ret_box_class)
return mono_value_box_checked (domain, info->ret_box_class, retval, error);
else
MonoException *exc;
MONO_SIG_HANDLER_GET_CONTEXT;
+ if (mono_runtime_get_no_exec ())
+ exit (1);
+
+ MONO_ENTER_GC_UNSAFE_UNBALANCED;
+
exc = mono_get_exception_execution_engine ("SIGILL");
mono_arch_handle_exception (ctx, exc);
+
+ MONO_EXIT_GC_UNSAFE_UNBALANCED;
}
#if defined(MONO_ARCH_USE_SIGACTION) || defined(HOST_WIN32)
del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
}
+char*
+mono_get_delegate_virtual_invoke_impl_name (gboolean load_imt_reg, int offset)
+{
+ int abs_offset;
+
+ abs_offset = offset;
+ if (abs_offset < 0)
+ abs_offset = - abs_offset;
+ return g_strdup_printf ("delegate_virtual_invoke%s_%s%d", load_imt_reg ? "_imt" : "", offset < 0 ? "m_" : "", abs_offset / SIZEOF_VOID_P);
+}
+
gpointer
mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method)
{
/* FIXME Support more cases */
if (mono_aot_only) {
- char tramp_name [256];
- const char *imt = load_imt_reg ? "_imt" : "";
- int ind = (load_imt_reg ? (-offset) : offset) / SIZEOF_VOID_P;
-
- sprintf (tramp_name, "delegate_virtual_invoke%s_%d", imt, ind);
- cache [idx] = (guint8 *)mono_aot_get_trampoline (tramp_name);
+ cache [idx] = (guint8 *)mono_aot_get_trampoline (mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset));
g_assert (cache [idx]);
} else {
cache [idx] = (guint8 *)mono_arch_get_delegate_virtual_invoke_impl (sig, method, offset, load_imt_reg);
else if (!strcmp (option, "gen-seq-points"))
debug_options.gen_sdb_seq_points = TRUE;
else if (!strcmp (option, "gen-compact-seq-points"))
- debug_options.gen_seq_points_compact_data = TRUE;
+ fprintf (stderr, "Mono Warning: option gen-compact-seq-points is deprecated.\n");
+ else if (!strcmp (option, "no-compact-seq-points"))
+ debug_options.no_seq_points_compact_data = TRUE;
else if (!strcmp (option, "single-imm-size"))
debug_options.single_imm_size = TRUE;
else if (!strcmp (option, "init-stacks"))
if (!mini_parse_debug_option (arg)) {
fprintf (stderr, "Invalid option for the MONO_DEBUG env variable: %s\n", arg);
- fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dont-free-domains', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'gen-seq-points', 'gen-compact-seq-points', 'single-imm-size', 'init-stacks', 'casts', 'soft-breakpoints', 'check-pinvoke-callconv', 'arm-use-fallback-tls', 'debug-domain-unload', 'partial-sharing', 'align-small-structs', 'native-debugger-break'\n");
+ fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dont-free-domains', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'gen-seq-points', 'no-compact-seq-points', 'single-imm-size', 'init-stacks', 'casts', 'soft-breakpoints', 'check-pinvoke-callconv', 'arm-use-fallback-tls', 'debug-domain-unload', 'partial-sharing', 'align-small-structs', 'native-debugger-break'\n");
exit (1);
}
}
mono_counters_register ("JIT/liveness_handle_exception_clauses (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_liveness_handle_exception_clauses);
mono_counters_register ("JIT/handle_out_of_line_bblock (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_handle_out_of_line_bblock);
mono_counters_register ("JIT/decompose_long_opts (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_decompose_long_opts);
+ mono_counters_register ("JIT/decompose_typechecks (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_decompose_typechecks);
mono_counters_register ("JIT/local_cprop (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_local_cprop);
mono_counters_register ("JIT/local_emulate_ops (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_local_emulate_ops);
mono_counters_register ("JIT/optimize_branches (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_optimize_branches);
mono_simd_intrinsics_init ();
#endif
-#if MONO_SUPPORT_TASKLETS
mono_tasklets_init ();
-#endif
register_trampolines (domain);
register_icall (mono_thread_get_undeniable_exception, "mono_thread_get_undeniable_exception", "object", FALSE);
register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
-#ifndef DISABLE_REMOTING
- register_icall (mono_load_remote_field_new_icall, "mono_load_remote_field_new_icall", "object object ptr ptr", FALSE);
- register_icall (mono_store_remote_field_new_icall, "mono_store_remote_field_new_icall", "void object ptr ptr object", FALSE);
-#endif
#if defined(__native_client__) || defined(__native_client_codegen__)
register_icall (mono_nacl_gc, "mono_nacl_gc", "void", FALSE);
register_icall (mono_object_castclass_with_cache, "mono_object_castclass_with_cache", "object object ptr ptr", FALSE);
register_icall (mono_object_isinst_with_cache, "mono_object_isinst_with_cache", "object object ptr ptr", FALSE);
register_icall (mono_generic_class_init, "mono_generic_class_init", "void ptr", FALSE);
- register_icall (mono_fill_class_rgctx, "mono_class_fill_rgctx", "ptr ptr int", FALSE);
- register_icall (mono_fill_method_rgctx, "mono_method_fill_rgctx", "ptr ptr int", FALSE);
+ register_icall (mono_fill_class_rgctx, "mono_fill_class_rgctx", "ptr ptr int", FALSE);
+ register_icall (mono_fill_method_rgctx, "mono_fill_method_rgctx", "ptr ptr int", FALSE);
register_icall (mono_debugger_agent_user_break, "mono_debugger_agent_user_break", "void", FALSE);
register_icall (mono_llvmonly_init_delegate_virtual, "mono_llvmonly_init_delegate_virtual", "void object object ptr", TRUE);
register_icall (mono_get_assembly_object, "mono_get_assembly_object", "object ptr", TRUE);
register_icall (mono_get_method_object, "mono_get_method_object", "object ptr", TRUE);
+ register_icall (mono_throw_method_access, "mono_throw_method_access", "void ptr ptr", FALSE);
register_icall_with_wrapper (mono_monitor_enter, "mono_monitor_enter", "void obj");
register_icall_with_wrapper (mono_monitor_enter_v4, "mono_monitor_enter_v4", "void obj ptr");