Fri Apr 9 15:28:01 CEST 2010 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Fri, 9 Apr 2010 13:31:23 +0000 (13:31 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Fri, 9 Apr 2010 13:31:23 +0000 (13:31 -0000)
* driver.c, optflags-def.h, ir-emit.h: introduce an unsupported
unsafe optimization that will remove bound checks.

svn path=/trunk/mono/; revision=155146

mono/mini/ChangeLog
mono/mini/driver.c
mono/mini/ir-emit.h
mono/mini/optflags-def.h

index caa2d9f537709b5322f41bee5a358c9b9857bd60..e42201b6a8f41d8ce5c199cc31d37bbe6769936a 100755 (executable)
@@ -1,3 +1,9 @@
+
+Fri Apr 9 15:28:01 CEST 2010 Paolo Molaro <lupus@ximian.com>
+
+       * driver.c, optflags-def.h, ir-emit.h: introduce an unsupported
+       unsafe optimization that will remove bound checks.
+
 2010-04-08  Kornel Pal  <kornelpal@gmail.com>
 
        * method-to-ir.c (mini_emit_inst_for_method): Fix a typo that caused
index 27138a27752210c6263a05e527cd3042cf7a3e36..fea2633eae7243d1b5e7251a7240a99ab3acdee4 100644 (file)
@@ -133,7 +133,7 @@ opt_funcs [sizeof (int) * 8] = {
        MONO_OPT_SIMD | \
        MONO_OPT_AOT)
 
-#define EXCLUDED_FROM_ALL (MONO_OPT_SHARED | MONO_OPT_PRECOMP)
+#define EXCLUDED_FROM_ALL (MONO_OPT_SHARED | MONO_OPT_PRECOMP | MONO_OPT_UNSAFE)
 
 static guint32
 parse_optimizations (const char* p)
index 83bab8d4ee76bb1cb328c5e8793f086480381996..348802b65ecec93abc9c63a4eed1286a826f0c13 100755 (executable)
@@ -809,6 +809,7 @@ static int ccount = 0;
  * index_reg is the vreg holding the index
  */
 #define MONO_EMIT_BOUNDS_CHECK(cfg, array_reg, array_type, array_length_field, index_reg) do { \
+               if (!(cfg->opt & MONO_OPT_UNSAFE)) {                                                    \
                if (!(cfg->opt & MONO_OPT_ABCREM)) {                                                    \
                        MONO_EMIT_NULL_CHECK (cfg, array_reg);                                          \
                        MONO_ARCH_EMIT_BOUNDS_CHECK ((cfg), (array_reg), G_STRUCT_OFFSET (array_type, array_length_field), (index_reg)); \
@@ -822,6 +823,7 @@ static int ccount = 0;
                        (cfg)->flags |= MONO_CFG_HAS_ARRAY_ACCESS;                                      \
                        (cfg)->cbb->has_array_access = TRUE;                                            \
                }                                                                                                                               \
+               }                                                                                                                               \
     } while (0)
 
 G_END_DECLS
index 572eeab06f928aa75c9dd30425cace727d1d0227..e0333ea456037c1cef8b91994452713af4c36c87 100644 (file)
@@ -23,3 +23,4 @@ OPTFLAG(SSA      ,21, "ssa",        "Use plain SSA form")
 OPTFLAG(SSE2     ,23, "sse2",       "SSE2 instructions on x86")
 OPTFLAG(GSHARED  ,24, "gshared",    "Share generics")
 OPTFLAG(SIMD    ,25, "simd",       "Simd intrinsics")
+OPTFLAG(UNSAFE  ,26, "unsafe",     "Remove bound checks and perform other dangerous changes")