Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Expand Down
14 changes: 4 additions & 10 deletions src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -9039,7 +9038,7 @@ emit_method_inner (EmitContext *ctx)
}

/* 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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
7 changes: 0 additions & 7 deletions src/mono/mono/mini/mini-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ typedef struct MonoDebugOptions {
gboolean gdb;
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
*/
Expand Down