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
20 changes: 14 additions & 6 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7224,7 +7224,7 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
code = cfg->native_code;
header = cfg->header;

if (!acfg->aot_opts.nodebug) {
if (!acfg->aot_opts.nodebug && !acfg->aot_opts.llvm_only) {
mono_debug_serialize_debug_info (cfg, &debug_info, &debug_info_size);
} else {
debug_info = NULL;
Expand All @@ -7245,7 +7245,6 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
use_unwind_ops = cfg->unwind_ops != NULL;

flags = (jinfo->has_generic_jit_info ? 1 : 0) | (use_unwind_ops ? 2 : 0) | (header->num_clauses ? 4 : 0) | (seq_points_size ? 8 : 0) | (cfg->compile_llvm ? 16 : 0) | (jinfo->has_try_block_holes ? 32 : 0) | (cfg->gc_map ? 64 : 0) | (jinfo->has_arch_eh_info ? 128 : 0);

encode_value (flags, p, &p);

if (use_unwind_ops) {
Expand Down Expand Up @@ -7279,7 +7278,9 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
}

/* Exception table */
if (cfg->compile_llvm) {
if (cfg->llvm_only) {
/* Unused */
} else if (cfg->compile_llvm) {
/*
* When using LLVM, we can't emit some data, like pc offsets, this reg/offset etc.,
* since the information is only available to llc. Instead, we let llc save the data
Expand Down Expand Up @@ -7470,8 +7471,10 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
g_assert (p - buf < buf_size);

/* Emit info */
/* The GC Map requires 4 byte alignment */
cfg->ex_info_offset = add_to_blob_aligned (acfg, buf, GPTRDIFF_TO_UINT32 (p - buf), cfg->gc_map ? 4 : 1);
if (!cfg->llvm_only) {
/* The GC Map requires 4 byte alignment */
cfg->ex_info_offset = add_to_blob_aligned (acfg, buf, GPTRDIFF_TO_UINT32 (p - buf), cfg->gc_map ? 4 : 1);
}
g_free (buf);
}

Expand Down Expand Up @@ -11145,7 +11148,12 @@ emit_exception_info (MonoAotCompile *acfg)
g_free (aot_file_path);
}

acfg->stats.offsets_size += emit_offset_table (acfg, "ex_info_offsets", MONO_AOT_TABLE_EX_INFO_OFFSETS, acfg->nmethods, 10, offsets);
if (mono_llvm_only) {
/* Unused */
emit_aot_data (acfg, MONO_AOT_TABLE_EX_INFO_OFFSETS, "ex_info_offsets", NULL, 0);
} else {
acfg->stats.offsets_size += emit_offset_table (acfg, "ex_info_offsets", MONO_AOT_TABLE_EX_INFO_OFFSETS, acfg->nmethods, 10, offsets);
}
g_free (offsets);
}

Expand Down
34 changes: 26 additions & 8 deletions src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3049,16 +3049,19 @@ decode_exception_debug_info (MonoAotModule *amodule,
}

/* Exception table */
if (has_clauses)
num_clauses = decode_value (p, &p);
else
num_clauses = 0;

if (from_llvm) {
if (mono_llvm_only) {
/* Handled by the caller */
g_assert_not_reached ();
} else if (from_llvm) {
int len;
MonoJitExceptionInfo *clauses;
GSList **nesting;

if (has_clauses)
num_clauses = decode_value (p, &p);
else
num_clauses = 0;

/*
* Part of the info is encoded by the AOT compiler, the rest is in the .eh_frame
* section.
Expand Down Expand Up @@ -3134,6 +3137,11 @@ decode_exception_debug_info (MonoAotModule *amodule,
}
jinfo->from_llvm = 1;
} else {
if (has_clauses)
num_clauses = decode_value (p, &p);
else
num_clauses = 0;

int len = mono_jit_info_size (flags, num_clauses, num_holes);
jinfo = (MonoJitInfo *)alloc0_jit_info_data (mem_manager, len, async);
/* The jit info table needs to sort addresses so it contains non-authenticated pointers on arm64e */
Expand Down Expand Up @@ -3551,7 +3559,10 @@ mono_aot_find_jit_info (MonoImage *image, gpointer addr)
}

code = (guint8 *)amodule->methods [method_index];
ex_info = &amodule->blob [mono_aot_get_offset (amodule->ex_info_offsets, method_index)];
if (mono_llvm_only)
ex_info = NULL;
else
ex_info = &amodule->blob [mono_aot_get_offset (amodule->ex_info_offsets, method_index)];

#ifdef HOST_WASM
/* WASM methods have no length, can only look up the method address */
Expand Down Expand Up @@ -3635,7 +3646,14 @@ mono_aot_find_jit_info (MonoImage *image, gpointer addr)

//printf ("F: %s\n", mono_method_full_name (method, TRUE));

jinfo = decode_exception_debug_info (amodule, method, ex_info, code, GPTRDIFF_TO_UINT32 (code_len));
if (mono_llvm_only) {
/* Unused */
int len = mono_jit_info_size (0, 0, 0);
jinfo = (MonoJitInfo *)alloc0_jit_info_data (mem_manager, len, async);
mono_jit_info_init (jinfo, method, code, code_len, 0, 0, 0);
} else {
jinfo = decode_exception_debug_info (amodule, method, ex_info, code, GPTRDIFF_TO_UINT32 (code_len));
}

g_assert ((guint8*)addr >= (guint8*)jinfo->code_start);

Expand Down