Merged with new-trap-decoding branch at rev a792088a3f04 (branch closed).
[cacao.git] / src / vm / options.c
index ade24918c6a4304ef36fdcd4962749a7a8e36fd0..cc94d11cd966cd7907fa403f4359e72b6296eaac 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "vm/options.h"
 #include "vm/os.hpp"
@@ -62,7 +62,6 @@ s4   opt_stacksize     = 0;     /* thread stack size                          */
 
 bool opt_verbose = false;
 bool opt_debugcolor = false;   /* use ANSI terminal sequences                */
-bool compileall = false;
 
 bool loadverbose = false;
 bool initverbose = false;
@@ -76,9 +75,6 @@ bool showmethods = false;
 bool showconstantpool = false;
 bool showutf = false;
 
-char *opt_method = NULL;
-char *opt_signature = NULL;
-
 bool compileverbose =  false;           /* trace compiler actions             */
 bool showstack = false;
 
@@ -160,6 +156,10 @@ int      opt_ThreadStackSize              = 0;
 
 /* Debugging options which can be turned off. */
 
+bool     opt_AlwaysEmitLongBranches       = false;
+int      opt_CompileAll                   = 0;
+char*    opt_CompileMethod                = NULL;
+char*    opt_CompileSignature             = NULL;
 int      opt_DebugExceptions              = 0;
 int      opt_DebugFinalizer               = 0;
 int      opt_DebugLocalReferences         = 0;
@@ -190,6 +190,7 @@ int      opt_InlineMinSize                = 0;
 #endif
 #endif
 int      opt_PrintConfig                  = 0;
+int      opt_PrintWarnings                = 0;
 int      opt_ProfileGCMemoryUsage         = 0;
 int      opt_ProfileMemoryUsage           = 0;
 FILE    *opt_ProfileMemoryUsageGNUPlot    = NULL;
@@ -230,6 +231,10 @@ enum {
 
        /* Debugging options which can be turned off. */
 
+       OPT_AlwaysEmitLongBranches,
+       OPT_CompileAll,
+       OPT_CompileMethod,
+       OPT_CompileSignature,
        OPT_DebugExceptions,
        OPT_DebugFinalizer,
        OPT_DebugLocalReferences,
@@ -250,6 +255,7 @@ enum {
        OPT_InlineMaxSize,
        OPT_InlineMinSize,
        OPT_PrintConfig,
+       OPT_PrintWarnings,
        OPT_ProfileGCMemoryUsage,
        OPT_ProfileMemoryUsage,
        OPT_ProfileMemoryUsageGNUPlot,
@@ -283,6 +289,10 @@ option_t options_XX[] = {
 
        /* Debugging options which can be turned off. */
 
+       { "AlwaysEmitLongBranches",       OPT_AlwaysEmitLongBranches,       OPT_TYPE_BOOLEAN, "Always emit long-branches." },
+       { "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" },
        { "DebugExceptions",              OPT_DebugExceptions,              OPT_TYPE_BOOLEAN, "debug exceptions" },
        { "DebugFinalizer",               OPT_DebugFinalizer,               OPT_TYPE_BOOLEAN, "debug finalizer thread" },
        { "DebugLocalReferences",         OPT_DebugLocalReferences,         OPT_TYPE_BOOLEAN, "print debug information for local reference tables" },
@@ -313,6 +323,7 @@ option_t options_XX[] = {
 #endif
 #endif
        { "PrintConfig",                  OPT_PrintConfig,                  OPT_TYPE_BOOLEAN, "print VM configuration" },
+       { "PrintWarnings",                OPT_PrintWarnings,                OPT_TYPE_BOOLEAN, "print warnings about suspicious behavior"},
        { "ProfileGCMemoryUsage",         OPT_ProfileGCMemoryUsage,         OPT_TYPE_VALUE,   "profiles GC memory usage in the given interval, <value> is in seconds (default: 5)" },
        { "ProfileMemoryUsage",           OPT_ProfileMemoryUsage,           OPT_TYPE_VALUE,   "TODO" },
        { "ProfileMemoryUsageGNUPlot",    OPT_ProfileMemoryUsageGNUPlot,    OPT_TYPE_VALUE,   "TODO" },
@@ -615,6 +626,26 @@ void options_xx(JavaVMInitArgs *vm_args)
 
                /* Debugging options which can be turned off. */
 
+               case OPT_AlwaysEmitLongBranches:
+                       opt_AlwaysEmitLongBranches = enable;
+                       break;
+
+               case OPT_CompileAll:
+                       opt_CompileAll = enable;
+                       opt_run = false;
+                       makeinitializations = false;
+                       break;
+
+               case OPT_CompileMethod:
+                       opt_CompileMethod = value;
+                       opt_run = false;
+                       makeinitializations = false;
+                       break;
+
+               case OPT_CompileSignature:
+                       opt_CompileSignature = value;
+                       break;
+
                case OPT_DebugExceptions:
                        opt_DebugExceptions = enable;
                        break;
@@ -707,6 +738,10 @@ void options_xx(JavaVMInitArgs *vm_args)
                        opt_PrintConfig = enable;
                        break;
 
+               case OPT_PrintWarnings:
+                       opt_PrintWarnings = enable;
+                       break;
+
                case OPT_ProfileGCMemoryUsage:
                        if (value == NULL)
                                opt_ProfileGCMemoryUsage = 5;
@@ -736,7 +771,9 @@ void options_xx(JavaVMInitArgs *vm_args)
                        file = fopen(filename, "w");
 
                        if (file == NULL)
-                               vm_abort_errno("options_xx: fopen failed");
+#warning Use below method instead!
+                               //os::abort_errno("options_xx: fopen failed");
+                               vm_abort("options_xx: fopen failed");
 
                        opt_ProfileMemoryUsageGNUPlot = file;
                        break;