2008-08-29 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / mini / mini.c
index 7a0490f5573146c852405bce13c2400f70d656df..ce23ded4aa5a8bde7b43886e687416bad25f983d 100644 (file)
@@ -11185,7 +11185,7 @@ mono_create_tls_get (MonoCompile *cfg, int offset)
                return NULL;
        
        MONO_INST_NEW (cfg, ins, OP_TLS_GET);
-       ins->dreg = mono_regstate_next_int (cfg->rs);
+       ins->dreg = cfg->new_ir ? mono_alloc_preg (cfg) : mono_regstate_next_int (cfg->rs);
        ins->inst_offset = offset;
        return ins;
 #else
@@ -14587,17 +14587,18 @@ mini_init (const char *filename, const char *runtime_version)
 
        mono_generic_sharing_init ();
 
+       if (mono_compile_aot)
+               /* 
+                * Avoid running managed code when AOT compiling, since the platform
+                * might only support aot-only execution.
+                */
+               mono_runtime_set_no_exec (TRUE);
+
 #define JIT_RUNTIME_WORKS
 #ifdef JIT_RUNTIME_WORKS
        mono_install_runtime_cleanup ((MonoDomainFunc)mini_cleanup);
-       /* 
-        * Avoid initializing the runtime when AOT compiling, since the platform
-        * might only support aot-only execution.
-        */
-       if (!mono_compile_aot) {
-               mono_runtime_init (domain, mono_thread_start_cb, mono_thread_attach_cb);
-               mono_thread_attach (domain);
-       }
+       mono_runtime_init (domain, mono_thread_start_cb, mono_thread_attach_cb);
+       mono_thread_attach (domain);
 #endif
 
        mono_profiler_runtime_initialized ();
@@ -14720,8 +14721,7 @@ mini_cleanup (MonoDomain *domain)
        /* This accesses metadata so needs to be called before runtime shutdown */
        print_jit_stats ();
 
-       if (!mono_compile_aot)
-               mono_runtime_cleanup (domain);
+       mono_runtime_cleanup (domain);
 
        mono_profiler_shutdown ();