[hybrid-aot] Add runtime support (#3556)
authorLudovic Henry <ludovic@xamarin.com>
Tue, 13 Sep 2016 21:40:01 +0000 (23:40 +0200)
committerGitHub <noreply@github.com>
Tue, 13 Sep 2016 21:40:01 +0000 (23:40 +0200)
* [aot-compiler] Add generic class and gsharedvt for hybrid AOT mode

* [aot-compiler] Remove dead code

* [hybrid-aot] Add --hybrid-aot for future use

mono/mini/aot-compiler.c
mono/mini/driver.c

index 26cc57f88c2c5bb961e7b21c2fb794ba07abde37..8af33cd7976e92d3efa2cd751fe11d1ad31f919f 100644 (file)
@@ -4327,13 +4327,19 @@ gboolean mono_aot_mode_is_full (MonoAotOptions *opts)
        return opts->mode == MONO_AOT_MODE_FULL;
 }
 
+static
+gboolean mono_aot_mode_is_hybrid (MonoAotOptions *opts)
+{
+       return opts->mode == MONO_AOT_MODE_HYBRID;
+}
+
 static void add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, const char *ref);
 
 static void
 add_generic_class (MonoAotCompile *acfg, MonoClass *klass, gboolean force, const char *ref)
 {
        /* This might lead to a huge code blowup so only do it if neccesary */
-       if (!mono_aot_mode_is_full (&acfg->aot_opts) && !force)
+       if (!mono_aot_mode_is_full (&acfg->aot_opts) && !mono_aot_mode_is_hybrid (&acfg->aot_opts) && !force)
                return;
 
        add_generic_class_with_depth (acfg, klass, 0, ref);
@@ -8363,7 +8369,7 @@ emit_code (MonoAotCompile *acfg)
                method = cfg->orig_method;
 
                /* Emit unbox trampoline */
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
                        sprintf (symbol, "ut_%d", get_method_index (acfg, method));
 
                        emit_section_change (acfg, ".text", 0);
@@ -8445,11 +8451,7 @@ emit_code (MonoAotCompile *acfg)
                int call_size;
 
                if (acfg->cfgs [i]) {
-                       if (acfg->aot_opts.llvm_only && acfg->cfgs [i]->compile_llvm)
-                               /* Obtained by calling a generated function in the LLVM image */
-                               arch_emit_direct_call (acfg, symbol, FALSE, FALSE, NULL, &call_size);
-                       else
-                               arch_emit_direct_call (acfg, acfg->cfgs [i]->asm_symbol, FALSE, acfg->thumb_mixed && acfg->cfgs [i]->compile_llvm, NULL, &call_size);
+                       arch_emit_direct_call (acfg, acfg->cfgs [i]->asm_symbol, FALSE, acfg->thumb_mixed && acfg->cfgs [i]->compile_llvm, NULL, &call_size);
                } else {
                        arch_emit_direct_call (acfg, symbol, FALSE, FALSE, NULL, &call_size);
                }
@@ -8478,7 +8480,7 @@ emit_code (MonoAotCompile *acfg)
 
                method = cfg->orig_method;
 
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
                        index = get_method_index (acfg, method);
 
                        emit_int32 (acfg, index);
@@ -8508,7 +8510,7 @@ emit_code (MonoAotCompile *acfg)
 
                method = cfg->orig_method;
 
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
 #ifdef MONO_ARCH_AOT_SUPPORTED
                        int call_size;
 
@@ -10437,7 +10439,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
        }
 
 #if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
-       if (acfg->aot_opts.llvm_only || mono_aot_mode_is_full (&acfg->aot_opts)) {
+       if (acfg->aot_opts.llvm_only || mono_aot_mode_is_full (&acfg->aot_opts) || mono_aot_mode_is_hybrid (&acfg->aot_opts)) {
                acfg->opts |= MONO_OPT_GSHAREDVT;
                opts |= MONO_OPT_GSHAREDVT;
        }
index bd6e19fc4f50a07f60071c1ecd484b9cd3db2a60..a6d2bd117b1f75181421b9e0b65ddb23265e5fd7 100644 (file)
@@ -1748,6 +1748,7 @@ mono_main (int argc, char* argv[])
                } else if (strcmp (argv [i], "--llvmonly") == 0) {
                        mono_aot_only = TRUE;
                        mono_llvm_only = TRUE;
+               } else if (strcmp (argv [i], "--hybrid-aot") == 0) {
                } else if (strcmp (argv [i], "--print-vtable") == 0) {
                        mono_print_vtable = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {