[llvm] Remove the disable-self-init debug option, it doesn't work any more. (#32532)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 19 Feb 2020 18:10:58 +0000 (13:10 -0500)
committerGitHub <noreply@github.com>
Wed, 19 Feb 2020 18:10:58 +0000 (19:10 +0100)
Co-authored-by: Zoltan Varga <vargaz@gmail.com>
src/mono/mono/mini/aot-compiler.c
src/mono/mono/mini/mini-llvm.c
src/mono/mono/mini/mini-runtime.c
src/mono/mono/mini/mini-runtime.h

index a30b0ef..1984ca3 100644 (file)
@@ -216,7 +216,6 @@ typedef struct MonoAotOptions {
        gboolean try_llvm;
        gboolean llvm;
        gboolean llvm_only;
-       gboolean llvm_disable_self_init;
        int nthreads;
        int ntrampolines;
        int nrgctx_trampolines;
@@ -5833,7 +5832,7 @@ method_is_externally_callable (MonoAotCompile *acfg, MonoMethod *method)
        } else {
                if (!acfg->aot_opts.direct_extern_calls)
                        return FALSE;
-               if (!acfg->llvm || acfg->aot_opts.llvm_disable_self_init)
+               if (!acfg->llvm)
                        return FALSE;
                if (acfg->aot_opts.soft_debug || acfg->aot_opts.no_direct_calls)
                        return FALSE;
@@ -5874,7 +5873,7 @@ is_direct_callable (MonoAotCompile *acfg, MonoMethod *method, MonoJumpInfo *patc
                        if (direct_callable && (acfg->aot_opts.dedup || acfg->aot_opts.dedup_include) && mono_aot_can_dedup (patch_info->data.method))
                                direct_callable = FALSE;
 
-                       if (direct_callable && (!acfg->llvm || acfg->aot_opts.llvm_disable_self_init) && !(!callee_cfg->has_got_slots && mono_class_is_before_field_init (callee_cfg->method->klass)))
+                       if (direct_callable && !acfg->llvm && !(!callee_cfg->has_got_slots && mono_class_is_before_field_init (callee_cfg->method->klass)))
                                direct_callable = FALSE;
 
                        if (direct_callable && !strcmp (callee_cfg->method->name, ".cctor"))
index 69e8230..0915473 100644 (file)
@@ -101,7 +101,6 @@ typedef struct {
        gboolean has_jitted_code;
        gboolean static_link;
        gboolean llvm_only;
-       gboolean llvm_disable_self_init;
        gboolean interp;
        GHashTable *idx_to_lmethod;
        GHashTable *idx_to_unbox_tramp;
@@ -3745,7 +3744,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder)
        }
 
        /* Initialize the method if needed */
-       if (cfg->compile_aot && !ctx->module->llvm_disable_self_init) {
+       if (cfg->compile_aot) {
                /* Emit a location for the initialization code */
                ctx->init_bb = gen_bb (ctx, "INIT_BB");
                ctx->inited_bb = gen_bb (ctx, "INITED_BB");
@@ -9039,7 +9038,7 @@ after_codegen_1:
        }
 
        /* Initialize the method if needed */
-       if (cfg->compile_aot && !ctx->module->llvm_disable_self_init) {
+       if (cfg->compile_aot) {
                // FIXME: Add more shared got entries
                ctx->builder = create_builder (ctx);
                LLVMPositionBuilderAtEnd (ctx->builder, ctx->init_bb);
@@ -9998,7 +9997,6 @@ mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix,
        gboolean static_link = (flags & LLVM_MODULE_FLAG_STATIC) ? 1 : 0;
        gboolean llvm_only = (flags & LLVM_MODULE_FLAG_LLVM_ONLY) ? 1 : 0;
        gboolean interp = (flags & LLVM_MODULE_FLAG_INTERP) ? 1 : 0;
-       gboolean llvm_disable_self_init = mini_get_debug_options ()->llvm_disable_self_init;
 
        /* Delete previous module */
        g_hash_table_destroy (module->plt_entries);
@@ -10018,7 +10016,6 @@ mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix,
        module->emit_dwarf = emit_dwarf;
        module->static_link = static_link;
        module->llvm_only = llvm_only;
-       module->llvm_disable_self_init = llvm_disable_self_init && !llvm_only; // llvm_only implies !llvm_disable_self_init
        module->interp = interp;
        /* The first few entries are reserved */
        module->max_got_offset = initial_got_size;
@@ -10157,9 +10154,6 @@ mono_llvm_fixup_aot_module (void)
        MonoLLVMModule *module = &aot_module;
        MonoMethod *method;
 
-       if (module->llvm_disable_self_init)
-               return;
-
        /*
         * Replace GOT entries for directly callable methods with the methods themselves.
         * It would be easier to implement this by predefining all methods before compiling
@@ -10571,7 +10565,7 @@ typedef struct {
 static void
 mono_llvm_nonnull_state_update (EmitContext *ctx, LLVMValueRef lcall, MonoMethod *call_method, LLVMValueRef *args, int num_params)
 {
-       if (!ctx->module->llvm_disable_self_init && mono_aot_can_specialize (call_method)) {
+       if (mono_aot_can_specialize (call_method)) {
                int num_passed = LLVMGetNumArgOperands (lcall);
                g_assert (num_params <= num_passed);
 
@@ -10805,7 +10799,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
                                if (lmethod && LLVMTypeOf (callee) == LLVMTypeOf (lmethod)) {
                                        mono_llvm_replace_uses_of (callee, lmethod);
 
-                                       if (!module->llvm_disable_self_init && mono_aot_can_specialize (ji->data.method))
+                                       if (mono_aot_can_specialize (ji->data.method))
                                                g_hash_table_insert (specializable, lmethod, ji->data.method);
                                        mono_aot_mark_unused_llvm_plt_entry (ji);
                                }
index 7358aae..778ee13 100644 (file)
@@ -3693,8 +3693,6 @@ mini_parse_debug_option (const char *option)
                mini_debug_options.gdb = TRUE;
        else if (!strcmp (option, "lldb"))
                mini_debug_options.lldb = TRUE;
-       else if (!strcmp (option, "llvm-disable-self-init"))
-               mini_debug_options.llvm_disable_self_init = TRUE;
        else if (!strcmp (option, "llvm-disable-inlining"))
                mini_debug_options.llvm_disable_inlining = TRUE;
        else if (!strcmp (option, "llvm-disable-implicit-null-checks"))
index 1d12cdb..aa7b5db 100644 (file)
@@ -179,13 +179,6 @@ typedef struct MonoDebugOptions {
        gboolean lldb;
 
        /*
-        * With LLVM codegen, this option will cause methods to be called indirectly through the
-        * PLT (As they are in other FullAOT modes, without LLVM). 
-        *
-        * Enable this to debug problems with direct calls in llvm
-        */
-       gboolean llvm_disable_self_init;
-       /*
         * Prevent LLVM from inlining any methods
         */
        gboolean llvm_disable_inlining;