[aot] Pass the aot method index to mini_method_compile ().
authorZoltan Varga <vargaz@gmail.com>
Fri, 26 Jun 2015 00:28:10 +0000 (20:28 -0400)
committerZoltan Varga <vargaz@gmail.com>
Fri, 26 Jun 2015 00:28:10 +0000 (20:28 -0400)
mono/mini/aot-compiler.c
mono/mini/driver.c
mono/mini/mini.c
mono/mini/mini.h

index 75d8945f7d5c30abe10dcadc94ba8a219f33cbf8..e5b931a2f83fc1a8e03e95a2b9359707cec69f70 100644 (file)
@@ -227,6 +227,7 @@ typedef struct MonoAotCompile {
        int align_pad_value;
        guint32 label_generator;
        gboolean llvm;
+       gboolean has_jitted_code;
        MonoAotFileFlags flags;
        MonoDynamicStream blob;
        MonoClass **typespec_classes;
@@ -6807,7 +6808,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                flags |= JIT_FLAG_LLVM;
        if (acfg->aot_opts.no_direct_calls)
                flags |= JIT_FLAG_NO_DIRECT_ICALLS;
-       cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0);
+       cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0, index);
        mono_loader_clear_error ();
 
        if (cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) {
@@ -6895,6 +6896,9 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                return;
        }
 
+       if (!cfg->compile_llvm)
+               acfg->has_jitted_code = TRUE;
+
        if (method->is_inflated && acfg->aot_opts.log_instances) {
                if (acfg->instances_logfile)
                        fprintf (acfg->instances_logfile, "%s ### %d\n", mono_method_full_name (method, TRUE), cfg->code_size);
index 487d7c083eabeb55901dd3bafcf0e305254cb107..884d4a82ae9b88e5ab0a4f5fafe79e0f5d58f28b 100644 (file)
@@ -384,7 +384,7 @@ mini_regression_step (MonoImage *image, int verbose, int *total_run, int *total,
                        run++;
                        start_time = g_timer_elapsed (timer, NULL);
                        comp_time -= start_time;
-                       cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, opt_flags), mono_get_root_domain (), JIT_FLAG_RUN_CCTORS, 0);
+                       cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, opt_flags), mono_get_root_domain (), JIT_FLAG_RUN_CCTORS, 0, -1);
                        comp_time += g_timer_elapsed (timer, NULL);
                        if (cfg->exception_type == MONO_EXCEPTION_NONE) {
                                if (verbose >= 2)
@@ -932,7 +932,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args)
                        g_print ("Compiling %d %s\n", count, desc);
                        g_free (desc);
                }
-               cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, args->opts), mono_get_root_domain (), 0, 0);
+               cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, args->opts), mono_get_root_domain (), 0, 0, -1);
                if (cfg->exception_type != MONO_EXCEPTION_NONE) {
                        printf ("Compilation of %s failed with exception '%s':\n", mono_method_full_name (cfg->method, TRUE), cfg->exception_message);
                        fail_count ++;
@@ -2066,10 +2066,10 @@ mono_main (int argc, char* argv[])
                        (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
                        MonoMethod *nm;
                        nm = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
-                       cfg = mini_method_compile (nm, opt, mono_get_root_domain (), 0, part);
+                       cfg = mini_method_compile (nm, opt, mono_get_root_domain (), 0, part, -1);
                }
                else
-                       cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, part);
+                       cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, part, -1);
                if ((mono_graph_options & MONO_GRAPH_CFG_SSA) && !(cfg->comp_done & MONO_COMP_SSA)) {
                        g_warning ("no SSA info available (use -O=deadce)");
                        return 1;
@@ -2101,7 +2101,7 @@ mono_main (int argc, char* argv[])
                                opt = opt_sets [i];
                                g_timer_start (timer);
                                for (j = 0; j < count; ++j) {
-                                       cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0);
+                                       cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0, -1);
                                        mono_destroy_compile (cfg);
                                }
                                g_timer_stop (timer);
@@ -2124,12 +2124,12 @@ mono_main (int argc, char* argv[])
                                        (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
                                        method = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
 
-                               cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0);
+                               cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0, -1);
                                mono_destroy_compile (cfg);
                        }
                }
        } else {
-               cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0);
+               cfg = mini_method_compile (method, opt, mono_get_root_domain (), 0, 0, -1);
                mono_destroy_compile (cfg);
        }
 #endif
index be741a249066a9f9e0b7b098fcee2776a681e4c4..dbc15df88215f00b7e84ac3f604744f7b35b8d66 100644 (file)
@@ -3135,7 +3135,7 @@ mono_insert_safepoints (MonoCompile *cfg)
  * field in the returned struct to see if compilation succeded.
  */
 MonoCompile*
-mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts)
+mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts, int aot_method_index)
 {
        MonoMethodHeader *header;
        MonoMethodSignature *sig;
@@ -3230,6 +3230,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        cfg->orig_method = method;
        cfg->gen_seq_points = debug_options.gen_seq_points_compact_data || debug_options.gen_sdb_seq_points;
        cfg->gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
+       cfg->flags = flags;
 
 #ifdef PLATFORM_ANDROID
        if (cfg->method->wrapper_type != MONO_WRAPPER_NONE) {
@@ -3251,6 +3252,8 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                cfg->generic_sharing_context = (MonoGenericSharingContext*)&cfg->gsctx;
        cfg->compile_llvm = try_llvm;
        cfg->token_info_hash = g_hash_table_new (NULL, NULL);
+       if (cfg->compile_aot)
+               cfg->method_index = aot_method_index;
 
        if (!mono_debug_count ())
                cfg->opt &= ~MONO_OPT_FLOAT32;
@@ -4076,7 +4079,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
 
        jit_timer = g_timer_new ();
 
-       cfg = mini_method_compile (method, opt, target_domain, JIT_FLAG_RUN_CCTORS, 0);
+       cfg = mini_method_compile (method, opt, target_domain, JIT_FLAG_RUN_CCTORS, 0, -1);
        prof_method = cfg->method;
 
        g_timer_stop (jit_timer);
index 01bdf96063309eb8643a283af288c65d58656a7f..449e7d5f1d96285044f7f7c6387b102e0baba2df 100644 (file)
@@ -2202,7 +2202,7 @@ void      mono_linear_scan                  (MonoCompile *cfg, GList *vars, GLis
 void      mono_global_regalloc              (MonoCompile *cfg);
 void      mono_create_jump_table            (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
 int       mono_compile_assembly             (MonoAssembly *ass, guint32 opts, const char *aot_options);
-MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts);
+MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts, int aot_method_index);
 void      mono_destroy_compile              (MonoCompile *cfg);
 MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode);
 void     mono_print_ins_index (int i, MonoInst *ins);