[mini] Handle magic interfaces in common_trampoline as if they were variant.
[mono.git] / mono / mini / alias-analysis.c
index ebab8ae4b25519a818acf6fc04a10b53de9004c8..c30de719a428d6a5683febbcdf1e00295edde822 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * alias-analysis.c: Implement simple alias analysis for local variables.
+/**
+ * \file
+ * Implement simple alias analysis for local variables.
  *
  * Author:
  *   Rodrigo Kumpera (kumpera@gmail.com)
@@ -13,6 +14,7 @@
 #include "mini.h"
 #include "ir-emit.h"
 #include "glib.h"
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -158,10 +160,17 @@ lower_memory_access (MonoCompile *cfg)
                for (ins = bb->code; ins; ins = ins->next) {
 handle_instruction:
                        switch (ins->opcode) {
-                       case OP_LDADDR:
-                               g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
-                               if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                       case OP_LDADDR: {
+                               MonoInst *var = (MonoInst*)ins->inst_p0;
+                               if (var->flags & MONO_INST_VOLATILE) {
+                                       if (cfg->verbose_level > 2) { printf ("Found address to volatile var, can't take it: "); mono_print_ins (ins); }
+                               } else {
+                                       g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
+                                       if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                               }
                                break;
+                       }
+
                        case OP_MOVE:
                                tmp = (MonoInst*)g_hash_table_lookup (addr_loads, GINT_TO_POINTER (ins->sreg1));
                                /*
@@ -191,7 +200,9 @@ handle_instruction:
                        case OP_LOADU4_MEMBASE:
                        case OP_LOADI1_MEMBASE:
                        case OP_LOADI8_MEMBASE:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
                        case OP_LOADR4_MEMBASE:
+#endif
                        case OP_LOADR8_MEMBASE:
                                if (ins->inst_offset != 0)
                                        continue;
@@ -211,7 +222,9 @@ handle_instruction:
                        case OP_STOREI2_MEMBASE_REG:
                        case OP_STOREI4_MEMBASE_REG:
                        case OP_STOREI8_MEMBASE_REG:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
                        case OP_STORER4_MEMBASE_REG:
+#endif
                        case OP_STORER8_MEMBASE_REG:
                        case OP_STOREV_MEMBASE:
                                if (ins->inst_offset != 0)
@@ -358,4 +371,8 @@ done:
                mono_print_code (cfg, "AFTER ALIAS_ANALYSIS");
 }
 
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (alias_analysis);
+
 #endif /* !DISABLE_JIT */