This patch adds a "-Xgc" command line option that enables the
work-in-progress GC infrastructure.

Cc: Vegard Nossum <vegard.nos...@gmail.com>
Signed-off-by: Pekka Enberg <penb...@cs.helsinki.fi>
---
 include/vm/gc.h |    1 +
 vm/gc.c         |    3 +++
 vm/jato.c       |    6 ++++++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/vm/gc.h b/include/vm/gc.h
index 8cc7994..343e04d 100644
--- a/include/vm/gc.h
+++ b/include/vm/gc.h
@@ -5,6 +5,7 @@
 
 extern void *gc_safepoint_page;
 extern bool verbose_gc;
+extern bool gc_enabled;
 
 void gc_init(void);
 
diff --git a/vm/gc.c b/vm/gc.c
index c248b09..78c692d 100644
--- a/vm/gc.c
+++ b/vm/gc.c
@@ -33,6 +33,9 @@ void gc_init(void)
 
 void *gc_alloc(size_t size)
 {
+       if (gc_enabled)
+               gc_start();
+
        return zalloc(size);
 }
 
diff --git a/vm/jato.c b/vm/jato.c
index b8af5d0..e90412f 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -949,6 +949,11 @@ static void handle_jar(const char *arg)
        classloader_add_to_classpath(arg);
 }
 
+static void handle_gc(void)
+{
+       gc_enabled = true;
+}
+
 static void handle_perf(void)
 {
        perf_enabled = true;
@@ -1109,6 +1114,7 @@ const struct option options[] = {
        DEFINE_OPTION_ARG("jar",        handle_jar),
        DEFINE_OPTION("verbose:gc",     handle_verbose_gc),
 
+       DEFINE_OPTION("Xgc",                    handle_gc),
        DEFINE_OPTION("Xperf",                  handle_perf),
 
        DEFINE_OPTION_ARG("Xtrace:method",      handle_trace_method),
-- 
1.5.6.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to