@@ -188,6 +188,7 @@ typedef struct MonoAotOptions {
188
188
char * llvm_outfile ;
189
189
char * data_outfile ;
190
190
char * export_symbols_outfile ;
191
+ char * compiled_methods_outfile ;
191
192
GList * profile_files ;
192
193
GList * mibc_profile_files ;
193
194
gboolean save_temps ;
@@ -407,6 +408,7 @@ typedef struct MonoAotCompile {
407
408
FILE * logfile ;
408
409
FILE * instances_logfile ;
409
410
FILE * data_outfile ;
411
+ FILE * compiled_methods_outfile ;
410
412
int datafile_offset ;
411
413
int gc_name_offset ;
412
414
// In this mode, we are emitting dedupable methods that we encounter
@@ -8546,6 +8548,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
8546
8548
opts -> llvm_outfile = g_strdup (arg + strlen ("llvm-outfile=" ));
8547
8549
} else if (str_begins_with (arg , "export-symbols-outfile=" )) {
8548
8550
opts -> export_symbols_outfile = g_strdup (arg + strlen ("export-symbols-outfile=" ));
8551
+ } else if (str_begins_with (arg , "compiled-methods-outfile=" )) {
8552
+ opts -> compiled_methods_outfile = g_strdup (arg + strlen ("compiled-methods-outfile=" ));
8549
8553
} else if (str_begins_with (arg , "temp-path=" )) {
8550
8554
opts -> temp_path = clean_path (g_strdup (arg + strlen ("temp-path=" )));
8551
8555
} else if (str_begins_with (arg , "save-temps" )) {
@@ -9565,6 +9569,11 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
9565
9569
mono_acfg_unlock (acfg );
9566
9570
9567
9571
mono_atomic_inc_i32 (& acfg -> stats .ccount );
9572
+
9573
+ if (acfg -> aot_opts .compiled_methods_outfile && acfg -> compiled_methods_outfile != NULL ) {
9574
+ if (!mono_method_is_generic_impl (method ) && method -> token != 0 )
9575
+ fprintf (acfg -> compiled_methods_outfile , "%x\n" , method -> token );
9576
+ }
9568
9577
}
9569
9578
9570
9579
static mono_thread_start_return_t WINAPI
@@ -14525,6 +14534,12 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
14525
14534
acfg -> logfile = fopen (acfg -> aot_opts .logfile , "a+" );
14526
14535
}
14527
14536
14537
+ if (acfg -> aot_opts .compiled_methods_outfile && !acfg -> dedup_collect_only ) {
14538
+ acfg -> compiled_methods_outfile = fopen (acfg -> aot_opts .compiled_methods_outfile , "w+" );
14539
+ if (!acfg -> compiled_methods_outfile )
14540
+ aot_printerrf (acfg , "Unable to open compiled-methods-outfile specified file %s\n" , acfg -> aot_opts .compiled_methods_outfile );
14541
+ }
14542
+
14528
14543
if (acfg -> aot_opts .data_outfile ) {
14529
14544
acfg -> data_outfile = fopen (acfg -> aot_opts .data_outfile , "w+" );
14530
14545
if (!acfg -> data_outfile ) {
@@ -14880,6 +14895,10 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
14880
14895
14881
14896
current_acfg = NULL ;
14882
14897
14898
+ if (acfg -> compiled_methods_outfile ) {
14899
+ fclose (acfg -> compiled_methods_outfile );
14900
+ }
14901
+
14883
14902
return emit_aot_image (acfg );
14884
14903
}
14885
14904
@@ -15245,6 +15264,13 @@ mono_aot_assemblies (MonoAssembly **assemblies, int nassemblies, guint32 jit_opt
15245
15264
dedup_methods = g_hash_table_new (NULL , NULL );
15246
15265
}
15247
15266
15267
+ if (aot_opts .compiled_methods_outfile ) {
15268
+ if (g_ensure_directory_exists (aot_opts .compiled_methods_outfile ) == FALSE) {
15269
+ fprintf (stderr , "AOT : failed to create the directory to save the compiled method names: %s\n" , aot_opts .compiled_methods_outfile );
15270
+ exit (1 );
15271
+ }
15272
+ }
15273
+
15248
15274
for (int i = 0 ; i < nassemblies ; ++ i ) {
15249
15275
res = aot_assembly (assemblies [i ], jit_opts , & aot_opts );
15250
15276
if (res != 0 ) {
0 commit comments