extern MonoMethodSignature *helper_sig_generic_class_init_trampoline;
extern MonoMethodSignature *helper_sig_rgctx_lazy_fetch_trampoline;
extern MonoMethodSignature *helper_sig_monitor_enter_exit_trampoline;
+extern MonoMethodSignature *helper_sig_monitor_enter_exit_trampoline_llvm;
/*
* Instruction metadata
if (strcmp (cmethod->name, "Enter") == 0) {
MonoCallInst *call;
- call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_ENTER,
- NULL, helper_sig_monitor_enter_exit_trampoline, NULL);
- mono_call_inst_add_outarg_reg (cfg, call, args [0]->dreg,
- MONO_ARCH_MONITOR_OBJECT_REG, FALSE);
+ if (COMPILE_LLVM (cfg)) {
+ /*
+ * Pass the argument normally, the LLVM backend will handle the
+ * calling convention problems.
+ */
+ call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_ENTER, NULL, helper_sig_monitor_enter_exit_trampoline_llvm, args);
+ } else {
+ call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_ENTER,
+ NULL, helper_sig_monitor_enter_exit_trampoline, NULL);
+ mono_call_inst_add_outarg_reg (cfg, call, args [0]->dreg,
+ MONO_ARCH_MONITOR_OBJECT_REG, FALSE);
+ }
return (MonoInst*)call;
} else if (strcmp (cmethod->name, "Exit") == 0) {
MonoCallInst *call;
- call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_EXIT,
- NULL, helper_sig_monitor_enter_exit_trampoline, NULL);
- mono_call_inst_add_outarg_reg (cfg, call, args [0]->dreg,
- MONO_ARCH_MONITOR_OBJECT_REG, FALSE);
+ if (COMPILE_LLVM (cfg)) {
+ call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_EXIT, NULL, helper_sig_monitor_enter_exit_trampoline_llvm, args);
+ } else {
+ call = (MonoCallInst*)mono_emit_abs_call (cfg, MONO_PATCH_INFO_MONITOR_EXIT,
+ NULL, helper_sig_monitor_enter_exit_trampoline, NULL);
+ mono_call_inst_add_outarg_reg (cfg, call, args [0]->dreg,
+ MONO_ARCH_MONITOR_OBJECT_REG, FALSE);
+ }
return (MonoInst*)call;
}
MonoJumpInfo *abs_ji = g_hash_table_lookup (cfg->abs_patches, call->fptr);
if (abs_ji) {
/*
- * The monitor entry/exit trampolines have their
- * own calling convention, and call->signature
- * doesn't include the argument.
+ * The monitor entry/exit trampolines might have
+ * their own calling convention on some platforms.
*/
+#ifndef TARGET_AMD64
if (abs_ji->type == MONO_PATCH_INFO_MONITOR_ENTER || abs_ji->type == MONO_PATCH_INFO_MONITOR_EXIT)
LLVM_FAILURE (ctx, "monitor enter/exit");
+#endif
target = mono_resolve_patch_target (cfg->method, cfg->domain, NULL, abs_ji, FALSE);
LLVMAddGlobalMapping (ee, callee, target);
}
MonoMethodSignature *helper_sig_generic_class_init_trampoline = NULL;
MonoMethodSignature *helper_sig_rgctx_lazy_fetch_trampoline = NULL;
MonoMethodSignature *helper_sig_monitor_enter_exit_trampoline = NULL;
+MonoMethodSignature *helper_sig_monitor_enter_exit_trampoline_llvm = NULL;
static guint32 default_opt = 0;
static gboolean default_opt_set = FALSE;
helper_sig_generic_class_init_trampoline = mono_create_icall_signature ("void");
helper_sig_rgctx_lazy_fetch_trampoline = mono_create_icall_signature ("ptr ptr");
helper_sig_monitor_enter_exit_trampoline = mono_create_icall_signature ("void");
+ helper_sig_monitor_enter_exit_trampoline_llvm = mono_create_icall_signature ("void object");
}
static gconstpointer