[aot] Enable direct calls to icalls in aot mode, disable them when the 'direct-calls...
authorZoltan Varga <vargaz@gmail.com>
Mon, 16 Mar 2015 21:49:01 +0000 (17:49 -0400)
committerZoltan Varga <vargaz@gmail.com>
Mon, 16 Mar 2015 21:49:01 +0000 (17:49 -0400)
mono/mini/aot-compiler.c
mono/mini/method-to-ir.c
mono/mini/mini.c
mono/mini/mini.h

index 0688d36f654c6f7ae1fce59a87734dc966364b1b..492ae3b12b0515313ed24808538fdaf19989e9a8 100644 (file)
@@ -6712,6 +6712,8 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                flags |= JIT_FLAG_FULL_AOT;
        if (acfg->llvm)
                flags |= JIT_FLAG_LLVM;
+       if (acfg->aot_opts.no_direct_calls)
+               flags |= JIT_FLAG_NO_DIRECT_ICALLS;
        cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0);
        mono_loader_clear_error ();
 
index fe32fbd3c0d113e03ff71ecbb077906d2a46bd65..ee42979c2209c9c98bf0f852d87dfbf1936b86a0 100755 (executable)
@@ -3002,15 +3002,10 @@ mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst
         *   threads when debugging.
         */
        if (info->no_raise) {
-               if (cfg->compile_aot) {
-                       // FIXME: This might be loaded into a runtime during debugging
-                       // even if it is not compiled using 'soft-debug'.
-               } else {
-                       no_wrapper = TRUE;
-                       /* LLVM on amd64 can't handle calls to non-32 bit addresses */
-                       if ((cfg->compile_llvm && SIZEOF_VOID_P == 8) || cfg->gen_seq_points_debug_data)
-                               no_wrapper = FALSE;
-               }
+               no_wrapper = TRUE;
+               /* LLVM on amd64 can't handle calls to non-32 bit addresses */
+               if ((cfg->compile_llvm && SIZEOF_VOID_P == 8) || cfg->gen_seq_points_debug_data || cfg->disable_direct_icalls)
+                       no_wrapper = FALSE;
        }
 
        if (no_wrapper) {
index ef9dbf0e06cf59935cf3678bd684ffdb65905192..7b36bf8d4571d71bc6d08433cd87f1aa010ecab1 100755 (executable)
@@ -3033,6 +3033,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        gboolean run_cctors = (flags & JIT_FLAG_RUN_CCTORS) ? 1 : 0;
        gboolean compile_aot = (flags & JIT_FLAG_AOT) ? 1 : 0;
        gboolean full_aot = (flags & JIT_FLAG_FULL_AOT) ? 1 : 0;
+       gboolean disable_direct_icalls = (flags & JIT_FLAG_NO_DIRECT_ICALLS) ? 1 : 0;
        gboolean gsharedvt_method = FALSE;
 #ifdef ENABLE_LLVM
        gboolean llvm = (flags & JIT_FLAG_LLVM) ? 1 : 0;
@@ -3124,6 +3125,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        cfg->explicit_null_checks = debug_options.explicit_null_checks;
        cfg->soft_breakpoints = debug_options.soft_breakpoints;
        cfg->check_pinvoke_callconv = debug_options.check_pinvoke_callconv;
+       cfg->disable_direct_icalls = disable_direct_icalls;
        if (try_generic_shared)
                cfg->generic_sharing_context = (MonoGenericSharingContext*)&cfg->gsctx;
        cfg->compile_llvm = try_llvm;
index e338cc0209a00753f7496119bd9e6d5ab39dd07c..8e920c5aa0d7beda716070714f4509e8ff5f329f 100644 (file)
@@ -1325,6 +1325,8 @@ typedef enum {
        JIT_FLAG_FULL_AOT = (1 << 2),
        /* Whenever to compile with LLVM */
        JIT_FLAG_LLVM = (1 << 3),
+       /* Whenever to disable direct calls to direct calls to icall functions */
+       JIT_FLAG_NO_DIRECT_ICALLS = (1 << 4)
 } JitFlags;
 
 /* Bit-fields in the MonoBasicBlock.region */
@@ -1493,6 +1495,7 @@ typedef struct {
        guint            disable_vreg_to_lvreg : 1;
        guint            disable_deadce_vars : 1;
        guint            disable_out_of_line_bblocks : 1;
+       guint            disable_direct_icalls : 1;
        guint            create_lmf_var : 1;
        /*
         * When this is set, the code to push/pop the LMF from the LMF stack is generated as IR