* src/vm/jit/allocator/simplereg.c: Respects opt_RegallocSpillAll flag now.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Mon, 20 Apr 2009 14:10:14 +0000 (16:10 +0200)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Mon, 20 Apr 2009 14:10:14 +0000 (16:10 +0200)
* src/vm/options.c (opt_RegallocSpillAll): Added.
* src/vm/options.h: Likewise.

src/vm/jit/allocator/simplereg.c
src/vm/options.c
src/vm/options.h

index f3390ba045c9e96125824b126f2ad9b2ab5b3900..ed0b5736e245501b8ec1f3c83188304c7a06ee3b 100644 (file)
@@ -2,6 +2,7 @@
 
    Copyright (C) 1996-2005, 2007, 2008
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+   Copyright (C) 2009 Theobroma Systems Ltd.
 
    This file is part of CACAO.
 
@@ -78,15 +79,25 @@ static void simplereg_allocate_temporaries(jitdata *jd);
 
 /* macros for handling register stacks ****************************************/
 
-#define AVAIL_FRONT(cnt, limit)   ((cnt) < (limit))
-#define AVAIL_BACK(cnt)           ((cnt) > 0)
+#if !defined(NDEBUG)
+# define AVAIL_FRONT(cnt, limit)   (!opt_RegallocSpillAll && ((cnt) < (limit)))
+# define AVAIL_BACK(cnt)           (!opt_RegallocSpillAll && ((cnt) > 0))
+#else
+# define AVAIL_FRONT(cnt, limit)   ((cnt) < (limit))
+# define AVAIL_BACK(cnt)           ((cnt) > 0)
+#endif
 
 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-#define AVAIL_FRONT_INT(cnt, limit)   ((cnt) < (limit) - intregsneeded)
-#define AVAIL_BACK_INT(cnt)           ((cnt) > intregsneeded)
+# if !defined(NDEBUG)
+#  define AVAIL_FRONT_INT(cnt, limit)   (!opt_RegallocSpillAll && ((cnt) < (limit) - intregsneeded))
+#  define AVAIL_BACK_INT(cnt)           (!opt_RegallocSpillAll && ((cnt) > intregsneeded))
+# else
+#  define AVAIL_FRONT_INT(cnt, limit)   ((cnt) < (limit) - intregsneeded)
+#  define AVAIL_BACK_INT(cnt)           ((cnt) > intregsneeded)
+# endif
 #else
-#define AVAIL_FRONT_INT(cnt, limit)   AVAIL_FRONT(cnt, limit)
-#define AVAIL_BACK_INT(cnt)           AVAIL_BACK(cnt)
+# define AVAIL_FRONT_INT(cnt, limit)   AVAIL_FRONT(cnt, limit)
+# define AVAIL_BACK_INT(cnt)           AVAIL_BACK(cnt)
 #endif
 
 #define POP_FRONT(stk, cnt, reg)   do {  reg = stk[cnt++];    } while (0)
index cc94d11cd966cd7907fa403f4359e72b6296eaac..cd38e8a71bce928bf11d3a28e4f15e3ce3fe15e0 100644 (file)
@@ -194,6 +194,7 @@ int      opt_PrintWarnings                = 0;
 int      opt_ProfileGCMemoryUsage         = 0;
 int      opt_ProfileMemoryUsage           = 0;
 FILE    *opt_ProfileMemoryUsageGNUPlot    = NULL;
+int      opt_RegallocSpillAll             = 0;
 #if defined(ENABLE_REPLACEMENT)
 int      opt_TestReplacement              = 0;
 #endif
@@ -259,6 +260,7 @@ enum {
        OPT_ProfileGCMemoryUsage,
        OPT_ProfileMemoryUsage,
        OPT_ProfileMemoryUsageGNUPlot,
+       OPT_RegallocSpillAll,
        OPT_TestReplacement,
        OPT_TraceCompilerCalls,
        OPT_TraceExceptions,
@@ -327,6 +329,7 @@ option_t options_XX[] = {
        { "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" },
+       { "RegallocSpillAll",             OPT_RegallocSpillAll,             OPT_TYPE_BOOLEAN, "spill all variables to the stack" },
 #if defined(ENABLE_REPLACEMENT)
        { "TestReplacement",              OPT_TestReplacement,              OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
 #endif
@@ -778,6 +781,10 @@ void options_xx(JavaVMInitArgs *vm_args)
                        opt_ProfileMemoryUsageGNUPlot = file;
                        break;
 
+               case OPT_RegallocSpillAll:
+                       opt_RegallocSpillAll = enable;
+                       break;
+
 #if defined(ENABLE_REPLACEMENT)
                case OPT_TestReplacement:
                        opt_TestReplacement = enable;
index a5b6932703867c9b4877f9a7c3795167cc4007e6..1c653351e8c7cf650371099384409dee36c81348 100644 (file)
@@ -216,6 +216,7 @@ extern int      opt_PrintWarnings;
 extern int      opt_ProfileGCMemoryUsage;
 extern int      opt_ProfileMemoryUsage;
 extern FILE    *opt_ProfileMemoryUsageGNUPlot;
+extern int      opt_RegallocSpillAll;
 #if defined(ENABLE_REPLACEMENT)
 extern int      opt_TestReplacement;
 #endif