Cc: Vegard Nossum <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
---
include/vm/gc.h | 3 +++
vm/gc.c | 5 +++++
vm/jato.c | 6 ++++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/vm/gc.h b/include/vm/gc.h
index a9bfae9..8cc7994 100644
--- a/include/vm/gc.h
+++ b/include/vm/gc.h
@@ -1,7 +1,10 @@
#ifndef VM_GC_H
#define VM_GC_H
+#include <stdbool.h>
+
extern void *gc_safepoint_page;
+extern bool verbose_gc;
void gc_init(void);
diff --git a/vm/gc.c b/vm/gc.c
index 4ce194d..4cff058 100644
--- a/vm/gc.c
+++ b/vm/gc.c
@@ -22,6 +22,8 @@ static unsigned int nr_in_safepoint;
static pthread_cond_t can_continue_cond = PTHREAD_COND_INITIALIZER;
static bool can_continue = true;
+bool verbose_gc;
+
void gc_init(void)
{
gc_safepoint_page = alloc_guard_page(false);
@@ -54,6 +56,9 @@ static void unhide_safepoint_guard_page(void)
static void do_gc_reclaim(void)
{
+ if (verbose_gc)
+ fprintf(stderr, "[GC]\n");
+
/* TODO: Do main GC work here. */
}
diff --git a/vm/jato.c b/vm/jato.c
index b50ef52..b8af5d0 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -1072,6 +1072,11 @@ static void handle_define(const char *arg)
free(str);
}
+static void handle_verbose_gc(void)
+{
+ verbose_gc = true;
+}
+
struct option {
const char *name;
@@ -1102,6 +1107,7 @@ const struct option options[] = {
DEFINE_OPTION_ARG("classpath", handle_classpath),
DEFINE_OPTION_ARG("cp", handle_classpath),
DEFINE_OPTION_ARG("jar", handle_jar),
+ DEFINE_OPTION("verbose:gc", handle_verbose_gc),
DEFINE_OPTION("Xperf", handle_perf),
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel