Merge pull request #2003 from esdrubal/seq_test_fix2
[mono.git] / mono / mini / mini-trampolines.c
index b644c8fac18fb10d315c422f8b9a41acfdaf7510..d4af8df57a08e4065f746f834cfc369e426a6a9c 100644 (file)
@@ -896,29 +896,6 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu
                return mono_class_fill_runtime_generic_context (arg, index);
 }
 
-void
-mono_monitor_enter_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp)
-{
-       mono_monitor_enter (obj);
-}
-
-void
-mono_monitor_enter_v4_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp)
-{
-#ifdef MONO_ARCH_MONITOR_LOCK_TAKEN_REG
-       char *lock_taken = (char*)regs [MONO_ARCH_MONITOR_LOCK_TAKEN_REG];
-       mono_monitor_enter_v4 (obj, lock_taken);
-#else
-       g_assert_not_reached ();
-#endif
-}
-
-void
-mono_monitor_exit_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp)
-{
-       mono_monitor_exit (obj);
-}
-
 /*
  * Precompute data to speed up mono_delegate_trampoline ().
  * METHOD might be NULL.
@@ -1025,7 +1002,10 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
                                }
                        }
                }
-       } else {
+       // If "delegate->method_ptr" is null mono_get_addr_from_ftnptr will fail if
+       // ftnptrs are being used.  "method" would end up null on archtitectures without
+       // ftnptrs so we can just skip this.
+       } else if (delegate->method_ptr) {
                ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr));
                if (ji)
                        method = jinfo_get_method (ji);
@@ -1210,12 +1190,6 @@ mono_get_trampoline_func (MonoTrampolineType tramp_type)
        case MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING:
                return mono_generic_virtual_remoting_trampoline;
 #endif
-       case MONO_TRAMPOLINE_MONITOR_ENTER:
-               return mono_monitor_enter_trampoline;
-       case MONO_TRAMPOLINE_MONITOR_ENTER_V4:
-               return mono_monitor_enter_v4_trampoline;
-       case MONO_TRAMPOLINE_MONITOR_EXIT:
-               return mono_monitor_exit_trampoline;
        case MONO_TRAMPOLINE_VCALL:
                return mono_vcall_trampoline;
 #ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
@@ -1260,9 +1234,6 @@ mono_trampolines_init (void)
 #ifndef DISABLE_REMOTING
        mono_trampoline_code [MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING] = create_trampoline_code (MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING);
 #endif
-       mono_trampoline_code [MONO_TRAMPOLINE_MONITOR_ENTER] = create_trampoline_code (MONO_TRAMPOLINE_MONITOR_ENTER);
-       mono_trampoline_code [MONO_TRAMPOLINE_MONITOR_ENTER_V4] = create_trampoline_code (MONO_TRAMPOLINE_MONITOR_ENTER_V4);
-       mono_trampoline_code [MONO_TRAMPOLINE_MONITOR_EXIT] = create_trampoline_code (MONO_TRAMPOLINE_MONITOR_EXIT);
        mono_trampoline_code [MONO_TRAMPOLINE_VCALL] = create_trampoline_code (MONO_TRAMPOLINE_VCALL);
 #ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
        mono_trampoline_code [MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD] = create_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
@@ -1502,95 +1473,6 @@ mono_create_rgctx_lazy_fetch_trampoline (guint32 offset)
 
        return ptr;
 }
-
-gpointer
-mono_create_monitor_enter_trampoline (void)
-{
-       static gpointer code;
-
-       if (mono_aot_only) {
-               if (!code)
-                       code = mono_aot_get_trampoline ("monitor_enter_trampoline");
-               return code;
-       }
-
-#ifdef MONO_ARCH_MONITOR_OBJECT_REG
-       mono_trampolines_lock ();
-
-       if (!code) {
-               MonoTrampInfo *info;
-
-               code = mono_arch_create_monitor_enter_trampoline (&info, FALSE, FALSE);
-               mono_tramp_info_register (info, NULL);
-       }
-
-       mono_trampolines_unlock ();
-#else
-       code = NULL;
-       g_assert_not_reached ();
-#endif
-
-       return code;
-}
-
-gpointer
-mono_create_monitor_enter_v4_trampoline (void)
-{
-       static gpointer code;
-
-       if (mono_aot_only) {
-               if (!code)
-                       code = mono_aot_get_trampoline ("monitor_enter_v4_trampoline");
-               return code;
-       }
-
-#if defined(MONO_ARCH_MONITOR_OBJECT_REG) && defined(MONO_ARCH_MONITOR_LOCK_TAKEN_REG)
-       mono_trampolines_lock ();
-
-       if (!code) {
-               MonoTrampInfo *info;
-
-               code = mono_arch_create_monitor_enter_trampoline (&info, TRUE, FALSE);
-               mono_tramp_info_register (info, NULL);
-       }
-
-       mono_trampolines_unlock ();
-#else
-       code = NULL;
-       g_assert_not_reached ();
-#endif
-
-       return code;
-}
-
-gpointer
-mono_create_monitor_exit_trampoline (void)
-{
-       static gpointer code;
-
-       if (mono_aot_only) {
-               if (!code)
-                       code = mono_aot_get_trampoline ("monitor_exit_trampoline");
-               return code;
-       }
-
-#ifdef MONO_ARCH_MONITOR_OBJECT_REG
-       mono_trampolines_lock ();
-
-       if (!code) {
-               MonoTrampInfo *info;
-
-               code = mono_arch_create_monitor_exit_trampoline (&info, FALSE);
-               mono_tramp_info_register (info, NULL);
-       }
-
-       mono_trampolines_unlock ();
-#else
-       code = NULL;
-       g_assert_not_reached ();
-#endif
-       return code;
-}
  
 #ifdef MONO_ARCH_LLVM_SUPPORTED
 /*
@@ -1641,9 +1523,6 @@ static const char*tramp_names [MONO_TRAMPOLINE_NUM] = {
        "delegate",
        "restore_stack_prot",
        "generic_virtual_remoting",
-       "monitor_enter",
-       "monitor_enter_v4",
-       "monitor_exit",
        "vcall",
        "handler_block_guard"
 };