2008-08-29 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / mini / mini.c
index e9a5ca2101f4ec5caedf466613dd494ba25cd9ec..ce23ded4aa5a8bde7b43886e687416bad25f983d 100644 (file)
@@ -174,9 +174,7 @@ static __thread gpointer mono_jit_tls MONO_TLS_FAST;
 
 MonoTraceSpec *mono_jit_trace_calls = NULL;
 gboolean mono_break_on_exc = FALSE;
-#ifndef DISABLE_AOT
 gboolean mono_compile_aot = FALSE;
-#endif
 /* If this is set, no code is generated dynamically, everything is taken from AOT files */
 gboolean mono_aot_only = FALSE;
 /* Whenever to use IMT */
@@ -2151,6 +2149,13 @@ mono_compile_create_var_for_vreg (MonoCompile *cfg, MonoType *type, int opcode,
                        printf ("  Create LVAR R%d (R%d, R%d)\n", inst->dreg, inst->dreg + 1, inst->dreg + 2);
                }
 
+#ifdef MONO_ARCH_SOFT_FLOAT
+               if (cfg->opt & MONO_OPT_SSA) {
+                       if (mono_type_is_float (type))
+                               inst->flags = MONO_INST_VOLATILE;
+               }
+#endif
+
                /* Allocate a dummy MonoInst for the first vreg */
                MONO_INST_NEW (cfg, tree, OP_LOCAL);
                tree->dreg = inst->dreg + 1;
@@ -9699,8 +9704,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                                for (i = 0; i < header->num_clauses; ++i) {
                                        MonoExceptionClause *clause = &header->clauses [i];
-                                       if (MONO_OFFSET_IN_HANDLER (clause, ip - header->code) && !(clause->flags & MONO_EXCEPTION_CLAUSE_FINALLY))
+                                       if (MONO_OFFSET_IN_HANDLER (clause, ip - header->code) && !(clause->flags & MONO_EXCEPTION_CLAUSE_FINALLY)) {
                                                handler_offset = clause->handler_offset;
+                                               break;
+                                       }
                                }
 
                                bblock->flags |= BB_EXCEPTION_UNSAFE;
@@ -11178,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
@@ -14578,16 +14585,22 @@ mini_init (const char *filename, const char *runtime_version)
        register_icall (mono_array_new_2, "mono_array_new_2", "object ptr int int", FALSE);
 #endif
 
+       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);
        mono_runtime_init (domain, mono_thread_start_cb, mono_thread_attach_cb);
+       mono_thread_attach (domain);
 #endif
 
-       mono_generic_sharing_init ();
-
-       mono_thread_attach (domain);
-       
        mono_profiler_runtime_initialized ();
        
        MONO_PROBE_VES_INIT_END ();