Signed-off-by: Vegard Nossum <[email protected]>
---
include/vm/gc.h | 1 +
vm/gc.c | 4 ++++
vm/signal.c | 21 +++++++++++++++++----
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/include/vm/gc.h b/include/vm/gc.h
index 6c39996..82766ca 100644
--- a/include/vm/gc.h
+++ b/include/vm/gc.h
@@ -4,5 +4,6 @@
extern void *gc_safepoint_page;
void gc_init(void);
+void gc_safepoint(void);
#endif
diff --git a/vm/gc.c b/vm/gc.c
index a8bf589..c1e6f42 100644
--- a/vm/gc.c
+++ b/vm/gc.c
@@ -10,3 +10,7 @@ void gc_init(void)
if (!gc_safepoint_page)
die("Couldn't allocate GC safepoint guard page");
}
+
+void gc_safepoint(void)
+{
+}
diff --git a/vm/signal.c b/vm/signal.c
index 3e59480..094fec6 100644
--- a/vm/signal.c
+++ b/vm/signal.c
@@ -26,14 +26,15 @@
#include "jit/exception.h"
-#include "vm/preload.h"
#include "vm/backtrace.h"
-#include "vm/signal.h"
-#include "vm/stack-trace.h"
#include "vm/call.h"
#include "vm/class.h"
-#include "vm/object.h"
+#include "vm/gc.h"
#include "vm/jni.h"
+#include "vm/object.h"
+#include "vm/preload.h"
+#include "vm/signal.h"
+#include "vm/stack-trace.h"
#include "arch/signal.h"
@@ -73,6 +74,12 @@ static unsigned long rethrow_bh(unsigned long src_addr)
return throw_from_signal_bh(src_addr);
}
+static unsigned long gc_safepoint_bh(unsigned long addr)
+{
+ gc_safepoint();
+ return addr;
+}
+
static void sigfpe_handler(int sig, siginfo_t *si, void *ctx)
{
if (signal_from_native(ctx))
@@ -109,6 +116,12 @@ static void sigsegv_handler(int sig, siginfo_t *si, void
*ctx)
goto exit;
}
+ /* Garbage collection safepoint */
+ if (si->si_addr == gc_safepoint_page) {
+ install_signal_bh(ctx, gc_safepoint_bh);
+ return;
+ }
+
/* Check if exception was triggered by exception guard */
if (si->si_addr == exceptions_guard_page ||
si->si_addr == trampoline_exceptions_guard_page) {
--
1.6.0.6
------------------------------------------------------------------------------
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