* src/vm/jit/trap.cpp (trap_init): Disabled mmapping of first page by default.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Sat, 19 Sep 2009 21:59:03 +0000 (23:59 +0200)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Sat, 19 Sep 2009 21:59:03 +0000 (23:59 +0200)
* src/vm/options.c: Added -XX:+AlwaysMmapFirstPage to enable it again.
* src/vm/options.h: Likewise.

src/vm/jit/trap.cpp
src/vm/options.c
src/vm/options.h

index f43b1e7d09535ceaecefef1db029e283a9c769a5..6d9340c18377cf6dbd5d891a1740b4a26366123d 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/trap.cpp - hardware traps
 
-   Copyright (C) 2008
+   Copyright (C) 2008, 2009
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
    Copyright (C) 2009 Theobroma Systems Ltd.
 
@@ -66,21 +66,15 @@ extern "C" {
  */
 void trap_init(void)
 {
-#if !(defined(__ARM__) && defined(__LINUX__))
-       /* On arm-linux the first memory page can't be mmap'ed, as it
-          contains the exception vectors. */
-
-       int pagesize;
-
-       /* mmap a memory page at address 0x0, so our hardware-exceptions
-          work. */
+       TRACESUBSYSTEMINITIALIZATION("trap_init");
 
-       pagesize = os::getpagesize();
+       /* If requested we mmap a memory page at address 0x0,
+          so our hardware-exceptions work. */
 
-       (void) os::mmap_anonymous(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED);
-#endif
-
-       TRACESUBSYSTEMINITIALIZATION("trap_init");
+       if (opt_AlwaysMmapFirstPage) {
+               int pagesize = os::getpagesize();
+               (void) os::mmap_anonymous(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED);
+       }
 
 #if !defined(TRAP_INSTRUCTION_IS_LOAD)
 # error TRAP_INSTRUCTION_IS_LOAD is not defined in your md-trap.h
index dc73d2ff1997600c9a78aa2381820dd2788b7b30..5a6f5c29f89afa645dff5dcab7b1016e15b1cebc 100644 (file)
@@ -157,6 +157,7 @@ int      opt_ThreadStackSize              = 0;
 /* Debugging options which can be turned off. */
 
 bool     opt_AlwaysEmitLongBranches       = false;
+bool     opt_AlwaysMmapFirstPage          = false;
 int      opt_CompileAll                   = 0;
 char*    opt_CompileMethod                = NULL;
 char*    opt_CompileSignature             = NULL;
@@ -234,6 +235,7 @@ enum {
        /* Debugging options which can be turned off. */
 
        OPT_AlwaysEmitLongBranches,
+       OPT_AlwaysMmapFirstPage,
        OPT_CompileAll,
        OPT_CompileMethod,
        OPT_CompileSignature,
@@ -294,6 +296,7 @@ option_t options_XX[] = {
        /* Debugging options which can be turned off. */
 
        { "AlwaysEmitLongBranches",       OPT_AlwaysEmitLongBranches,       OPT_TYPE_BOOLEAN, "Always emit long-branches." },
+       { "AlwaysMmapFirstPage",          OPT_AlwaysMmapFirstPage,          OPT_TYPE_BOOLEAN, "Always mmap memory page at address 0x0." },
        { "CompileAll",                   OPT_CompileAll,                   OPT_TYPE_BOOLEAN, "compile all methods, no execution" },
        { "CompileMethod",                OPT_CompileMethod,                OPT_TYPE_VALUE,   "compile only a specific method" },
        { "CompileSignature",             OPT_CompileSignature,             OPT_TYPE_VALUE,   "specify signature for a specific method" },
@@ -636,6 +639,10 @@ void options_xx(JavaVMInitArgs *vm_args)
                        opt_AlwaysEmitLongBranches = enable;
                        break;
 
+               case OPT_AlwaysMmapFirstPage:
+                       opt_AlwaysMmapFirstPage = enable;
+                       break;
+
                case OPT_CompileAll:
                        opt_CompileAll = enable;
                        opt_run = false;
index 9a232a0246c54060e1784cb4e49baa6dc38a9620..0aa9ed3d8c7c6cd7109799067687159e17b26f03 100644 (file)
@@ -179,6 +179,7 @@ extern int      opt_ThreadStackSize;
 /* Debugging options which can be turned off. */
 
 extern bool     opt_AlwaysEmitLongBranches;
+extern bool     opt_AlwaysMmapFirstPage;
 extern int      opt_CompileAll;
 extern char*    opt_CompileMethod;
 extern char*    opt_CompileSignature;