[runtime] Remove handler block trampoline code
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 24 Jul 2017 20:42:45 +0000 (23:42 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Tue, 25 Jul 2017 09:25:53 +0000 (12:25 +0300)
22 files changed:
mono/metadata/object-offsets.h
mono/mini/aot-compiler.c
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-arm64.c
mono/mini/mini-arm64.h
mono/mini/mini-exceptions.c
mono/mini/mini-ppc.c
mono/mini/mini-ppc.h
mono/mini/mini-s390x.c
mono/mini/mini-s390x.h
mono/mini/mini-trampolines.c
mono/mini/mini-x86.c
mono/mini/mini-x86.h
mono/mini/mini.h
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/mini/tramp-arm64.c
mono/mini/tramp-s390x.c
mono/mini/tramp-x86.c

index 375831531f6773464a0868363a37450985c6128c..9f2fa37e04e5c1a7edf0e51ddadc83e6ca9ba57d 100644 (file)
@@ -158,7 +158,6 @@ DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable)
 DECL_OFFSET(MonoJitTlsData, lmf)
 DECL_OFFSET(MonoJitTlsData, class_cast_from)
 DECL_OFFSET(MonoJitTlsData, class_cast_to)
-DECL_OFFSET(MonoJitTlsData, handler_block_return_address)
 DECL_OFFSET(MonoJitTlsData, restore_stack_prot)
 
 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size)
index b9c86a44c8906c043bff5a82e3e52d9683c6be9a..c2dd1b28eebe419ab43ba79e3b25c250012db779 100644 (file)
@@ -6741,10 +6741,6 @@ emit_trampolines (MonoAotCompile *acfg)
 #ifdef DISABLE_REMOTING
                        if (tramp_type == MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING)
                                continue;
-#endif
-#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
-                       if (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
-                               continue;
 #endif
                        mono_arch_create_generic_trampoline ((MonoTrampolineType)tramp_type, &info, acfg->aot_opts.use_trampolines_page? 2: TRUE);
                        emit_trampoline (acfg, acfg->got_offset, info);
@@ -6825,11 +6821,6 @@ emit_trampolines (MonoAotCompile *acfg)
                        }
                }
 
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
-               mono_arch_create_handler_block_trampoline (&info, TRUE);
-               emit_trampoline (acfg, acfg->got_offset, info);
-#endif
-
                if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
                        mono_arch_get_enter_icall_trampoline (&info);
                        emit_trampoline (acfg, acfg->got_offset, info);
index bab77635fde6c1a54313b1dc4faef6f4f018563f..5a376b8945017f49fa82fb49d444b81c8b19cc0e 100644 (file)
@@ -1168,7 +1168,6 @@ mono_arch_init (void)
        mono_aot_register_jit_icall ("mono_amd64_throw_corlib_exception", mono_amd64_throw_corlib_exception);
        mono_aot_register_jit_icall ("mono_amd64_resume_unwind", mono_amd64_resume_unwind);
        mono_aot_register_jit_icall ("mono_amd64_get_original_ip", mono_amd64_get_original_ip);
-       mono_aot_register_jit_icall ("mono_amd64_handler_block_trampoline_helper", mono_amd64_handler_block_trampoline_helper);
 
 #if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
        mono_aot_register_jit_icall ("mono_amd64_start_gsharedvt_call", mono_amd64_start_gsharedvt_call);
@@ -8132,25 +8131,6 @@ mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val)
        ctx->gregs [reg] = val;
 }
 
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
-       gpointer *sp, old_value;
-       char *bp;
-
-       /*Load the spvar*/
-       bp = (char *)MONO_CONTEXT_GET_BP (ctx);
-       sp = (gpointer *)*(gpointer*)(bp + clause->exvar_offset);
-
-       old_value = *sp;
-       if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
-               return old_value;
-
-       *sp = new_value;
-
-       return old_value;
-}
-
 /*
  * mono_arch_emit_load_aotconst:
  *
index d568af78db8b190b775e019051bde842b4404605..b688502060669d8f06f5cec7f668d70fd6b3284f 100644 (file)
@@ -431,8 +431,6 @@ typedef struct {
 #define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * 8)
 
 #define MONO_ARCH_LLVM_SUPPORTED 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
 #define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GC_MAPS_SUPPORTED 1
@@ -503,9 +501,6 @@ mono_amd64_get_exception_trampolines (gboolean aot);
 int
 mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL;
 
-gpointer
-mono_amd64_handler_block_trampoline_helper (void);
-
 #if defined(TARGET_WIN32) && !defined(DISABLE_JIT)
 
 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
index 9703c1e09de12282e8cef5f83cb8d4a0a6fa78bf..e61e7b00c7123020d41e26f9b156f2e739882bf2 100644 (file)
@@ -799,7 +799,6 @@ mono_arch_init (void)
        mono_aot_register_jit_icall ("mono_arm_start_gsharedvt_call", mono_arm_start_gsharedvt_call);
 #endif
        mono_aot_register_jit_icall ("mono_arm_unaligned_stack", mono_arm_unaligned_stack);
-       mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
 #if defined(__ARM_EABI__)
        eabi_supported = TRUE;
 #endif
@@ -7082,26 +7081,6 @@ mono_arch_get_trampolines (gboolean aot)
        return mono_arm_get_exception_trampolines (aot);
 }
 
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
-       gpointer *lr_loc;
-       char *old_value;
-       char *bp;
-
-       /*Load the spvar*/
-       bp = MONO_CONTEXT_GET_BP (ctx);
-       lr_loc = (gpointer*)(bp + clause->exvar_offset);
-
-       old_value = *lr_loc;
-       if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
-               return old_value;
-
-       *lr_loc = new_value;
-
-       return old_value;
-}
-
 #if defined(MONO_ARCH_SOFT_DEBUG_SUPPORTED)
 /*
  * mono_arch_set_breakpoint:
index 2e8914c395c6160462754e6c8c34155e31eb9079..633c16f306b6a26a21702258d8a8733c9ac4bbd6 100644 (file)
@@ -340,10 +340,6 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_GC_MAPS_SUPPORTED 1
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
 #define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-#ifndef TARGET_IOS
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
-#endif
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GSHAREDVT_SUPPORTED 1
 #define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
@@ -414,9 +410,6 @@ mono_arm_is_hard_float (void);
 void
 mono_arm_unaligned_stack (MonoMethod *method);
 
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr);
-
 /* MonoJumpInfo **ji */
 guint8*
 mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *buf, int dreg, int patch_type, gconstpointer data);
index 7a189792a2c5d0e6a2f08655e1df538723950856..aacdd599afcd8003aecb9cba419b6ec55a977172 100644 (file)
@@ -234,7 +234,6 @@ mono_arch_init (void)
 {
        mono_aot_register_jit_icall ("mono_arm_throw_exception", mono_arm_throw_exception);
        mono_aot_register_jit_icall ("mono_arm_resume_unwind", mono_arm_resume_unwind);
-       mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
 
        if (!mono_aot_only)
                bp_trampoline = mini_get_breakpoint_trampoline ();
@@ -5241,22 +5240,3 @@ mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
        return get_call_info (mp, sig);
 }
 
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
-       gpointer *lr_loc;
-       char *old_value;
-       char *bp;
-
-       /*Load the spvar*/
-       bp = MONO_CONTEXT_GET_BP (ctx);
-       lr_loc = (gpointer*)(bp + clause->exvar_offset);
-
-       old_value = *lr_loc;
-       if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
-               return old_value;
-
-       *lr_loc = new_value;
-
-       return old_value;
-}
index c7cd1fb1262f4f40dc91cf98e148f5f1f61fd03c..6268a1064de9266f034eaa7b72f1a3b34a722560 100644 (file)
@@ -154,11 +154,7 @@ typedef struct {
 #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1
 #define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
 #define MONO_ARCH_HAVE_INIT_LMF_EXT 1
-#ifndef TARGET_IOS
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
-#endif
 
 #ifdef TARGET_IOS
 
@@ -260,8 +256,6 @@ GSList* mono_arm_get_exception_trampolines (gboolean aot);
 
 void mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow);
 
-gpointer mono_arm_handler_block_trampoline_helper (gpointer *ptr);
-
 CallInfo* mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig);
 
 #endif /* __MONO_MINI_ARM64_H__ */
index d73c4c8e462dd16dfa9dca540fe95066f2823734..c8a71c69378dac317a72716a0aa8cccb1182bc29 100644 (file)
@@ -2963,11 +2963,6 @@ mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
        FindHandlerBlockData data = { 0 };
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS];
 
-#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
-       if (mono_aot_only)
-               return FALSE;
-#endif
-
        /* Guard against a null MonoJitTlsData. This can happens if the thread receives the
          * interrupt signal before the JIT has time to initialize its TLS data for the given thread.
         */
index f36a3fd528ae4e964fdac0435b760bc47c9c3d8d..59fa9edc03e5c7e119c94680e549ddedef96f6cb 100644 (file)
@@ -6017,15 +6017,3 @@ mono_arch_opcode_supported (int opcode)
        }
 }
 
-
-#if 0
-// FIXME: To get the test case  finally_block_ending_in_dead_bb  to work properly we need to define the following
-// (in mini-ppc.h) and then implement the fuction mono_arch_create_handler_block_trampoline.
-//  #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-
-gpointer
-mono_arch_create_handler_block_trampoline (void)
-{
-       . . .
-}
-#endif
index 718bb98d6fa4077ed1e8179f5c3bbb419ca3c21e..3f241f6db3178ee9f456421b06748c2cefb70a65 100644 (file)
@@ -160,10 +160,6 @@ typedef struct MonoCompileArch {
   #define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 1
   #define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 1
 
-// FIXME: To get the test case  finally_block_ending_in_dead_bb  to work properly define the following
-// and then implement the fuction mono_arch_create_handler_block_trampoline.
-//  #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-
 // Define "DEBUG_ELFABIV2" to allow for debugging output for ELF ABI v2 function call and return codegen
 //  #define DEBUG_ELFABIV2
 
index bab41317cc6012bd583e8b0f9063ed8ad80bbb21..7f726bfaadbdd45244dd31987102662e25d85263 100644 (file)
@@ -6413,39 +6413,6 @@ mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code)
 
 /*========================= End of Function ========================*/
  
-/*------------------------------------------------------------------*/
-/*                                                                  */
-/* Name                - mono_arch_install_handler_block_guard             */
-/*                                                                  */
-/* Function    -                                                   */
-/*                                                                 */
-/*------------------------------------------------------------------*/
-
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, 
-                                      MonoContext *ctx, gpointer new_value)
-{
-       int offset;
-       gpointer *sp, old_value;
-       char *bp;
-
-       offset = clause->exvar_offset;
-
-       /*Load the spvar*/
-       bp = MONO_CONTEXT_GET_BP (ctx);
-       sp = *(gpointer*)(bp + offset);
-
-       old_value = *sp;
-       if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
-               return old_value;
-
-       *sp = new_value;
-
-       return old_value;
-}
-
-/*========================= End of Function ========================*/
 /*------------------------------------------------------------------*/
 /*                                                                  */
 /* Name                - get_delegate_invoke_impl.                         */
index 9747be08ce7f9b504e35437cda29af54bfdaf83d..01dcfd997a9bf6a9822f412625f7b16b3989aaf0 100644 (file)
@@ -61,7 +61,6 @@ typedef struct
 #define MONO_ARCH_GC_MAPS_SUPPORTED                    1
 #define MONO_ARCH_GSHARED_SUPPORTED                    1
 #define MONO_ARCH_MONITOR_ENTER_ADJUSTMENT             1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD             1
 #define MONO_ARCH_HAVE_INVALIDATE_METHOD               1
 #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT           1
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK            1
index 3ef30208cf7b65a0e8a1d5dfdf5c8ce400380f7e..c78abccad633d929d1dcef391ef5ba360dd0ee16 100644 (file)
@@ -1273,68 +1273,6 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
        return code;
 }
 
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
-static gpointer
-mono_handler_block_guard_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_info, guint8* tramp)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoContext ctx;
-       MonoException *exc;
-       MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls ();
-       gpointer resume_ip = jit_tls->handler_block_return_address;
-
-       memcpy (&ctx, &jit_tls->handler_block_context, sizeof (MonoContext));
-       MONO_CONTEXT_SET_IP (&ctx, jit_tls->handler_block_return_address);
-
-       jit_tls->handler_block_return_address = NULL;
-       jit_tls->handler_block = NULL;
-
-       if (!resume_ip) /*this should not happen, but we should avoid crashing */
-               exc = mono_get_exception_execution_engine ("Invalid internal state, resuming abort after handler block but no resume ip found");
-       else
-               exc = mono_thread_resume_interruption (TRUE);
-
-       if (exc) {
-               mono_handle_exception (&ctx, (MonoObject *)exc);
-               mono_restore_context (&ctx);
-       }
-
-       return resume_ip;
-}
-
-gpointer
-mono_create_handler_block_trampoline (void)
-{
-       static gpointer code;
-
-       if (code)
-               return code;
-
-       if (mono_aot_only) {
-               gpointer tmp = mono_aot_get_trampoline ("handler_block_trampoline");
-               g_assert (tmp);
-               mono_memory_barrier ();
-               code = tmp;
-               return code;
-       }
-
-       mono_trampolines_lock ();
-       if (!code) {
-               MonoTrampInfo *info;
-               gpointer tmp;
-
-               tmp = mono_arch_create_handler_block_trampoline (&info, FALSE);
-               mono_tramp_info_register (info, NULL);
-               mono_memory_barrier ();
-               code = tmp;
-       }
-       mono_trampolines_unlock ();
-
-       return code;
-}
-#endif
-
 /*
  * mono_get_trampoline_func:
  *
@@ -1366,10 +1304,6 @@ mono_get_trampoline_func (MonoTrampolineType tramp_type)
 #endif
        case MONO_TRAMPOLINE_VCALL:
                return mono_vcall_trampoline;
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
-       case MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD:
-               return mono_handler_block_guard_trampoline;
-#endif
        default:
                g_assert_not_reached ();
                return NULL;
@@ -1409,10 +1343,6 @@ mono_trampolines_init (void)
        mono_trampoline_code [MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING] = create_trampoline_code (MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING);
 #endif
        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);
-       mono_create_handler_block_trampoline ();
-#endif
 
        mono_counters_register ("Calls to trampolines", MONO_COUNTER_JIT | MONO_COUNTER_INT, &trampoline_calls);
        mono_counters_register ("JIT trampolines", MONO_COUNTER_JIT | MONO_COUNTER_INT, &jit_trampolines);
@@ -1740,8 +1670,7 @@ static const char*tramp_names [MONO_TRAMPOLINE_NUM] = {
        "delegate",
        "restore_stack_prot",
        "generic_virtual_remoting",
-       "vcall",
-       "handler_block_guard"
+       "vcall"
 };
 
 /*
index ad1637319c864f3875104b3fc4f05c364319f8af..54966b1dc8f39bbbafc7fe04dcfe581c4781e90d 100644 (file)
@@ -6294,29 +6294,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *long_ins)
 #endif /* MONO_ARCH_SIMD_INTRINSICS */
 }
 
-/*MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD*/
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
-       int offset;
-       gpointer *sp, old_value;
-       char *bp;
-
-       offset = clause->exvar_offset;
-
-       /*Load the spvar*/
-       bp = MONO_CONTEXT_GET_BP (ctx);
-       sp = *(gpointer*)(bp + offset);
-
-       old_value = *sp;
-       if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
-               return old_value;
-
-       *sp = new_value;
-
-       return old_value;
-}
-
 /*
  * mono_aot_emit_load_got_addr:
  *
index a3d0a60000383c2ad3c790fdadd618b6ed149220..180e6cc967cab907b5ae8a86cfd070c5b18a7dbd 100644 (file)
@@ -224,7 +224,6 @@ typedef struct {
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
 
 #define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
 
 #define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
index 348c4a5e9583f6cc227a40f2879ebc1cde523780..a8bd6f70221f2d606c6589a2756eda6430432ec6 100644 (file)
@@ -1170,10 +1170,6 @@ typedef struct {
        MonoContext     ex_ctx;
        ResumeState resume_state;
 
-       /*Variabled use to implement handler blocks (finally/catch/etc) guards during interruption*/
-       /* handler block return address */
-       gpointer handler_block_return_address;
-
        /* handler block been guarded. It's safe to store this even for dynamic methods since there
        is an activation on stack making sure it will remain alive.*/
        MonoJitExceptionInfo *handler_block;
@@ -1489,7 +1485,6 @@ typedef enum {
        MONO_TRAMPOLINE_RESTORE_STACK_PROT,
        MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING,
        MONO_TRAMPOLINE_VCALL,
-       MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD,
        MONO_TRAMPOLINE_NUM
 } MonoTrampolineType;
 
@@ -1500,7 +1495,7 @@ typedef enum {
 
 /* These trampolines receive an argument directly in a register */
 #define MONO_TRAMPOLINE_TYPE_HAS_ARG(t)                \
-       ((t) == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
+       (FALSE)
 
 /* optimization flags */
 #define OPTFLAG(id,shift,name,descr) MONO_OPT_ ## id = 1 << shift,
@@ -2864,11 +2859,6 @@ guint32 mono_arch_get_plt_info_offset           (guint8 *plt_entry, mgreg_t *reg
 GSList *mono_arch_get_trampolines               (gboolean aot);
 gpointer mono_arch_get_enter_icall_trampoline   (MonoTrampInfo **info);
 
-/* Handle block guard */
-gpointer mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value);
-gpointer mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot);
-gpointer mono_create_handler_block_trampoline (void);
-
 /*New interruption machinery */
 void
 mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
index cf519e1c9298d378f62a1209838e4452966aef96..53e3bc2e834c53dd39f310e66e6f4da222d49f72 100644 (file)
@@ -239,7 +239,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        MonoJumpInfo *ji = NULL;
        const guint kMaxCodeSize = 630;
 
-       if (tramp_type == MONO_TRAMPOLINE_JUMP || tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
+       if (tramp_type == MONO_TRAMPOLINE_JUMP)
                has_caller = FALSE;
        else
                has_caller = TRUE;
@@ -379,43 +379,38 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        mono_amd64_patch (br [0], code);
        //amd64_breakpoint (code);
 
-       if (tramp_type != MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD) {
-               /* Obtain the trampoline argument which is encoded in the instruction stream */
-               if (aot) {
-                       /* Load the GOT offset */
-                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
-                       /*
-                        * r11 points to a call *<offset>(%rip) instruction, load the
-                        * pc-relative offset from the instruction itself.
-                        */
-                       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 3, 4);
-                       /* 7 is the length of the call, 8 is the offset to the next got slot */
-                       amd64_alu_reg_imm_size (code, X86_ADD, AMD64_RAX, 7 + sizeof (gpointer), sizeof(gpointer));
-                       /* Compute the address of the GOT slot */
-                       amd64_alu_reg_reg_size (code, X86_ADD, AMD64_R11, AMD64_RAX, sizeof(gpointer));
-                       /* Load the value */
-                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, sizeof(gpointer));
-               } else {                        
-                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
-                       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 5, 1);
-                       amd64_widen_reg (code, AMD64_RAX, AMD64_RAX, TRUE, FALSE);
-                       amd64_alu_reg_imm_size (code, X86_CMP, AMD64_RAX, 4, 1);
-                       br [0] = code;
-                       x86_branch8 (code, X86_CC_NE, 6, FALSE);
-                       /* 32 bit immediate */
-                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 4);
-                       br [1] = code;
-                       x86_jump8 (code, 10);
-                       /* 64 bit immediate */
-                       mono_amd64_patch (br [0], code);
-                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 8);
-                       mono_amd64_patch (br [1], code);
-               }
-               amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
+       /* Obtain the trampoline argument which is encoded in the instruction stream */
+       if (aot) {
+               /* Load the GOT offset */
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
+               /*
+                * r11 points to a call *<offset>(%rip) instruction, load the
+                * pc-relative offset from the instruction itself.
+                */
+               amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 3, 4);
+               /* 7 is the length of the call, 8 is the offset to the next got slot */
+               amd64_alu_reg_imm_size (code, X86_ADD, AMD64_RAX, 7 + sizeof (gpointer), sizeof(gpointer));
+               /* Compute the address of the GOT slot */
+               amd64_alu_reg_reg_size (code, X86_ADD, AMD64_R11, AMD64_RAX, sizeof(gpointer));
+               /* Load the value */
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, sizeof(gpointer));
        } else {
-               amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, saved_regs_offset + (MONO_AMD64_ARG_REG1 * sizeof(mgreg_t)), sizeof(mgreg_t));
-               amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
+               amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 5, 1);
+               amd64_widen_reg (code, AMD64_RAX, AMD64_RAX, TRUE, FALSE);
+               amd64_alu_reg_imm_size (code, X86_CMP, AMD64_RAX, 4, 1);
+               br [0] = code;
+               x86_branch8 (code, X86_CC_NE, 6, FALSE);
+               /* 32 bit immediate */
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 4);
+               br [1] = code;
+               x86_jump8 (code, 10);
+               /* 64 bit immediate */
+               mono_amd64_patch (br [0], code);
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 8);
+               mono_amd64_patch (br [1], code);
        }
+       amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
 
        /* Save LMF begin */
 
@@ -786,85 +781,6 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
 }
 #endif /* !DISABLE_JIT */
 
-gpointer
-mono_amd64_handler_block_trampoline_helper (void)
-{
-       MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls ();
-       return jit_tls->handler_block_return_address;
-}
-
-#ifndef DISABLE_JIT
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       guint8 *code, *buf;
-       int tramp_size = 64;
-       MonoJumpInfo *ji = NULL;
-       GSList *unwind_ops;
-
-       code = buf = (guint8 *)mono_global_codeman_reserve (tramp_size + MONO_TRAMPOLINE_UNWINDINFO_SIZE(0));
-
-       unwind_ops = mono_arch_get_cie_program ();
-
-       /*
-        * This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
-        * We get here from the ret emitted by CEE_ENDFINALLY.
-        * The stack is misaligned.
-        */
-       /* Align the stack before the call to mono_amd64_handler_block_trampoline_helper() */
-#ifdef TARGET_WIN32
-       /* Also make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
-       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8 + 4 * 8);
-#else
-       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
-#endif
-       if (aot) {
-               code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
-               amd64_call_reg (code, AMD64_R11);
-       } else {
-               amd64_mov_reg_imm (code, AMD64_RAX, mono_amd64_handler_block_trampoline_helper);
-               amd64_call_reg (code, AMD64_RAX);
-       }
-       /* Undo stack alignment */
-#ifdef TARGET_WIN32
-       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8 + 4 * 8);
-#else
-       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
-#endif
-       /* Save the result to the stack */
-       amd64_push_reg (code, AMD64_RAX);
-#ifdef TARGET_WIN32
-       /* Make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
-       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 4 * 8);
-#endif
-       if (aot) {
-               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-               code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
-               amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
-       } else {
-               amd64_mov_reg_imm (code, AMD64_RAX, mono_get_trampoline_func (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD));
-       }
-       /* The stack is aligned */
-       amd64_call_reg (code, AMD64_RAX);
-#ifdef TARGET_WIN32
-       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 4 * 8);
-#endif
-       /* Load return address */
-       amd64_pop_reg (code, AMD64_RAX);
-       /* The stack is misaligned, thats what the code we branch to expects */
-       amd64_jump_reg (code, AMD64_RAX);
-
-       mono_arch_flush_icache (buf, code - buf);
-       MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
-       g_assert (code - buf <= tramp_size);
-       g_assert_checked (mono_arch_unwindinfo_validate_size (unwind_ops, MONO_TRAMPOLINE_UNWINDINFO_SIZE(0)));
-
-       *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
-       return buf;
-}
-#endif /* !DISABLE_JIT */
-
 /*
  * mono_arch_get_call_target:
  *
@@ -1207,13 +1123,6 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo
        return NULL;
 }
 
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-        g_assert_not_reached ();
-        return NULL;
-}
-
 void
 mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
 {
index 935a2ee6882c14839f1b5bd6e6c3721c826990a7..bf2c9c91447c7b97dc15a180698becb1a13410fc 100644 (file)
@@ -89,13 +89,6 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *a
        *(guint8**)jump_entry = addr;
 }
 
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr)
-{
-       MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
-       return jit_tls->handler_block_return_address;
-}
-
 #ifndef DISABLE_JIT
 
 #define arm_is_imm12(v) ((int)(v) > -4096 && (int)(v) < 4096)
@@ -692,62 +685,6 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo
        return buf;
 }
 
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       guint8 *tramp;
-       guint8 *code, *buf;
-       int tramp_size = 64;
-       MonoJumpInfo *ji = NULL;
-       GSList *unwind_ops = NULL;
-
-       code = buf = mono_global_codeman_reserve (tramp_size);
-
-       unwind_ops = mono_arch_get_cie_program ();
-
-       tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
-
-       /*
-       This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
-       */
-
-       /*
-        * We are in a method frame after the call emitted by OP_CALL_HANDLER.
-        */
-       /* Obtain jit_tls->handler_block_return_address */
-       if (aot) {
-               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
-       } else {
-               ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
-               ARM_B (code, 0);
-               *(gpointer*)code = mono_arm_handler_block_trampoline_helper;
-               code += 4;
-       }
-       ARM_BLX_REG (code, ARMREG_R0);
-       /* Set it as the return address so the trampoline will return to it */
-       ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_R0);
-
-       /* Call the trampoline */
-       if (aot) {
-               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
-               code = emit_bx (code, ARMREG_R0);
-       } else {
-               ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
-               code = emit_bx (code, ARMREG_R0);
-               *(gpointer*)code = tramp;
-               code += 4;
-       }
-
-       mono_arch_flush_icache (buf, code - buf);
-       MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
-       g_assert (code - buf <= tramp_size);
-
-       *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
-       return buf;
-}
-
 guint8*
 mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
 {
@@ -1028,13 +965,6 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info
        return NULL;
 }
 
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
-
 guint8*
 mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
 {
index be10117bbe7a049007042c451f2b6359f26f62f3..a09fed858fe73688f99cc3924a6c11637d7a10fd 100644 (file)
@@ -97,13 +97,6 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code)
        return ((guint32*)plt_entry) [4];
 }
 
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr)
-{
-       MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
-       return jit_tls->handler_block_return_address;
-}
-
 #ifndef DISABLE_JIT
 
 guchar*
@@ -519,54 +512,6 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo
        return buf;
 }
 
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       guint8 *tramp;
-       guint8 *code, *buf;
-       int tramp_size = 64;
-       MonoJumpInfo *ji = NULL;
-       GSList *unwind_ops = NULL;
-
-       code = buf = mono_global_codeman_reserve (tramp_size);
-
-       unwind_ops = NULL;
-
-       /*
-       This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
-       */
-
-       /*
-        * We are in a method frame after the call emitted by OP_CALL_HANDLER.
-        */
-       /* Call a helper to obtain jit_tls->handler_block_return_address */
-       if (aot)
-               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
-       else
-               code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)mono_arm_handler_block_trampoline_helper);
-       arm_blrx (code, ARMREG_IP0);
-       /* Set it as the return address so the trampoline will return to it */
-       arm_movx (code, ARMREG_LR, ARMREG_R0);
-
-       /* Call the C trampoline function */
-       if (aot) {
-               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
-       } else {
-               tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
-               code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp);
-       }
-       arm_brx (code, ARMREG_IP0);
-
-       mono_arch_flush_icache (buf, code - buf);
-       MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
-       g_assert (code - buf <= tramp_size);
-
-       *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
-       return buf;
-}
-
 /*
  * mono_arch_create_sdb_trampoline:
  *
@@ -836,13 +781,6 @@ mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_ty
        return NULL;
 }
 
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-        g_assert_not_reached ();
-        return NULL;
-}
-
 gpointer
 mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
 {
index b0333d3cf18a92c3cfbca8fdec243131d1216168..91aed0b96e22801406dbc4482762d9e10cc4d63b 100644 (file)
@@ -190,8 +190,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
                
        code = buf = mono_global_codeman_reserve(512);
                
-       if ((tramp_type == MONO_TRAMPOLINE_JUMP) ||
-           (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)) 
+       if (tramp_type == MONO_TRAMPOLINE_JUMP) 
                has_caller = 0;
        else
                has_caller = 1;
@@ -587,64 +586,3 @@ mono_arch_get_static_rgctx_trampoline (gpointer arg,
 }      
 
 /*========================= End of Function ========================*/
-
-/*------------------------------------------------------------------*/
-/*                                                                  */
-/* Name                - handler_block_trampoline_helper                   */
-/*                                                                  */
-/* Function    -                                                   */
-/*                                                                  */
-/*------------------------------------------------------------------*/
-
-static void
-handler_block_trampoline_helper (gpointer *ptr)
-{
-       MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
-       *ptr = jit_tls->handler_block_return_address;
-}
-
-/*========================= End of Function ========================*/
-
-/*------------------------------------------------------------------*/
-/*                                                                  */
-/* Name                - mono_arch_create_handler_block_trampoline         */
-/*                                                                  */
-/* Function    -                                                   */
-/*                                                                  */
-/*------------------------------------------------------------------*/
-
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-       guint8 *code, *buf;
-       int tramp_size = 64;
-       MonoJumpInfo *ji = NULL;
-       GSList *unwind_ops = NULL;
-
-       g_assert (!aot);
-
-       code = buf = mono_global_codeman_reserve (tramp_size);
-
-       /*
-        * This trampoline restore the call chain of the handler block 
-        * then jumps into the code that deals with it.
-        */
-
-       /*
-        * Slow path uses a C helper
-        */
-       S390_SET  (code, s390_r2, tramp);
-       S390_SET  (code, s390_r1, handler_block_trampoline_helper);
-       s390_br   (code, s390_r1);
-
-       mono_arch_flush_icache (buf, code - buf);
-       MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
-       g_assert (code - buf <= tramp_size);
-
-       *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
-       return buf;
-}
-
-/*========================= End of Function ========================*/
index 6d2ba621ea9af056ea479fa475b5ca87ebb805e3..bced9017f43deb62af57f101446bf70456ae6005 100644 (file)
@@ -414,16 +414,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
                mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
                x86_ret (code);
        } else {
-               /* The trampoline argument is at the top of the stack, and it contains the address we need to branch to */
-               if (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD) {
-                       x86_pop_reg (code, X86_EAX);
-                       cfa_offset -= sizeof (mgreg_t);
-                       mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-                       x86_alu_reg_imm (code, X86_ADD, X86_ESP, 0x8);
-                       x86_jump_reg (code, X86_EAX);
-               } else {
-                       x86_ret (code);
-               }
+               x86_ret (code);
        }
 
        g_assert ((code - buf) <= 256);
@@ -608,65 +599,6 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
        x86_call_code (code, (guint8*)func);
 }
 
-static gpointer
-handler_block_trampoline_helper (void)
-{
-       MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
-       return jit_tls->handler_block_return_address;
-}
-
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
-       guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-       guint8 *code, *buf;
-       int tramp_size = 64;
-       MonoJumpInfo *ji = NULL;
-       int cfa_offset;
-       GSList *unwind_ops = NULL;
-
-       g_assert (!aot);
-
-       code = buf = mono_global_codeman_reserve (tramp_size);
-
-       unwind_ops = mono_arch_get_cie_program ();
-       cfa_offset = sizeof (mgreg_t);
-       /*
-       This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
-       */
-
-       /*
-        * We are in a method frame after the call emitted by OP_CALL_HANDLER.
-        */
-
-       /*Slow path uses a c helper*/
-       x86_call_code (code, handler_block_trampoline_helper);
-       /* Simulate a call */
-       /*Fix stack alignment*/
-       x86_alu_reg_imm (code, X86_SUB, X86_ESP, 0x4);
-       cfa_offset += sizeof (mgreg_t);
-       mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-
-       /* This is the address the trampoline will return to */
-       x86_push_reg (code, X86_EAX);
-       cfa_offset += sizeof (mgreg_t);
-       mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-
-       /* Dummy trampoline argument, since we call the generic trampoline directly */
-       x86_push_imm (code, 0);
-       cfa_offset += sizeof (mgreg_t);
-       mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-       x86_jump_code (code, tramp);
-
-       mono_arch_flush_icache (buf, code - buf);
-       MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
-       g_assert (code - buf <= tramp_size);
-
-       *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
-       return buf;
-}
-
 guint8*
 mono_arch_get_call_target (guint8 *code)
 {