Skip to content
Merged
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
26 changes: 26 additions & 0 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ typedef struct MonoAotOptions {
char *llvm_outfile;
char *data_outfile;
char *export_symbols_outfile;
char *compiled_methods_outfile;
GList *profile_files;
GList *mibc_profile_files;
gboolean save_temps;
Expand Down Expand Up @@ -404,6 +405,7 @@ typedef struct MonoAotCompile {
FILE *logfile;
FILE *instances_logfile;
FILE *data_outfile;
FILE *compiled_methods_outfile;
int datafile_offset;
int gc_name_offset;
// In this mode, we are emitting dedupable methods that we encounter
Expand Down Expand Up @@ -8433,6 +8435,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
opts->llvm_outfile = g_strdup (arg + strlen ("llvm-outfile="));
} else if (str_begins_with (arg, "export-symbols-outfile=")) {
opts->export_symbols_outfile = g_strdup (arg + strlen ("export-symbols-outfile="));
} else if (str_begins_with (arg, "compiled-methods-outfile=")) {
opts->compiled_methods_outfile = g_strdup (arg + strlen ("compiled-methods-outfile="));
} else if (str_begins_with (arg, "temp-path=")) {
opts->temp_path = clean_path (g_strdup (arg + strlen ("temp-path=")));
} else if (str_begins_with (arg, "save-temps")) {
Expand Down Expand Up @@ -9425,6 +9429,11 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
mono_acfg_unlock (acfg);

mono_atomic_inc_i32 (&acfg->stats.ccount);

if (acfg->aot_opts.compiled_methods_outfile && acfg->compiled_methods_outfile != NULL) {
if (!mono_method_is_generic_impl (method) && method->token != 0)
fprintf (acfg->compiled_methods_outfile, "%x\n", method->token);
}
}

static mono_thread_start_return_t WINAPI
Expand Down Expand Up @@ -14142,6 +14151,12 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
acfg->logfile = fopen (acfg->aot_opts.logfile, "a+");
}

if (acfg->aot_opts.compiled_methods_outfile && !acfg->dedup_collect_only) {
acfg->compiled_methods_outfile = fopen (acfg->aot_opts.compiled_methods_outfile, "w+");
if (!acfg->compiled_methods_outfile)
aot_printerrf (acfg, "Unable to open compiled-methods-outfile specified file %s\n", acfg->aot_opts.compiled_methods_outfile);
}

if (acfg->aot_opts.data_outfile) {
acfg->data_outfile = fopen (acfg->aot_opts.data_outfile, "w+");
if (!acfg->data_outfile) {
Expand Down Expand Up @@ -14455,6 +14470,10 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)

current_acfg = NULL;

if (acfg->compiled_methods_outfile) {
fclose (acfg->compiled_methods_outfile);
}

return emit_aot_image (acfg);
}

Expand Down Expand Up @@ -14818,6 +14837,13 @@ mono_aot_assemblies (MonoAssembly **assemblies, int nassemblies, guint32 jit_opt
dedup_methods = g_hash_table_new (NULL, NULL);
}

if (aot_opts.compiled_methods_outfile) {
if (g_ensure_directory_exists (aot_opts.compiled_methods_outfile) == FALSE) {
fprintf (stderr, "AOT : failed to create the directory to save the compiled method names: %s\n", aot_opts.compiled_methods_outfile);
exit (1);
}
}

for (int i = 0; i < nassemblies; ++i) {
res = aot_assembly (assemblies [i], jit_opts, &aot_opts);
if (res != 0) {
Expand Down