[kaffe] CVS kaffe (guilhem): JNI weak ref fix.
Kaffe CVS
cvs-commits at kaffe.org
Mon Sep 25 11:33:06 PDT 2006
PatchSet 7427
Date: 2006/09/25 18:24:14
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
JNI weak ref fix.
2006-09-25 Guilhem Lavaux <guilhem at kaffe.org>
* kaffe/kaffevm/jni/jni-refs.c
(KaffeJNI_NewWeakGlobalRef): Fixed allocation of the weak reference.
(KaffeJNI_DeleteWeakGlobalRef): Fixed deletion of the weak
reference.
* kaffe/kaffevm/kaffe-gc/gc-incremental.c:
(gc_heap_isobject): Consider FIXED object as a member of the heap.
Members:
ChangeLog:1.4927->1.4928
kaffe/kaffevm/jni/jni-refs.c:1.6->1.7
kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.36->1.37
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4927 kaffe/ChangeLog:1.4928
--- kaffe/ChangeLog:1.4927 Sun Sep 24 21:26:19 2006
+++ kaffe/ChangeLog Mon Sep 25 18:24:14 2006
@@ -1,3 +1,15 @@
+2006-09-25 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * kaffe/kaffevm/jni/jni-refs.c
+ (KaffeJNI_NewWeakGlobalRef): Fixed allocation of the weak reference.
+ (KaffeJNI_DeleteWeakGlobalRef): Fixed deletion of the weak
+ reference.
+
+ * kaffe/kaffevm/kaffe-gc/gc-incremental.c:
+ (gc_heap_isobject): Consider FIXED object as a member of the heap.
+
+ Reported by Tim Bevan <tim.bevan at laser-scan.com>
+
2006-09-24 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/external/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c:
Index: kaffe/kaffe/kaffevm/jni/jni-refs.c
diff -u kaffe/kaffe/kaffevm/jni/jni-refs.c:1.6 kaffe/kaffe/kaffevm/jni/jni-refs.c:1.7
--- kaffe/kaffe/kaffevm/jni/jni-refs.c:1.6 Mon Dec 26 22:35:56 2005
+++ kaffe/kaffe/kaffevm/jni/jni-refs.c Mon Sep 25 18:24:21 2006
@@ -258,7 +258,7 @@
obj_local = unveil(obj);
- ref = KGC_malloc(main_collector, KGC_ALLOC_VMWEAKREF, sizeof(jobject));
+ ref = KGC_malloc(main_collector, sizeof(jobject), KGC_ALLOC_VMWEAKREF);
*((jobject *)ref) = obj_local;
KGC_addWeakRef(main_collector, ref, obj_local);
@@ -287,7 +287,8 @@
BEGIN_EXCEPTION_HANDLING_VOID();
- assert(KGC_getObjectIndex(main_collector, ref) == KGC_ALLOC_VMWEAKREF);
+ void *ref2 = (void*)(((uintp)ref) & (~(uintp)1));
+ assert(KGC_getObjectIndex(main_collector, ref2) == KGC_ALLOC_VMWEAKREF);
#if defined(ENABLE_JVMPI)
if( JVMPI_EVENT_ISENABLED(JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE) )
@@ -302,8 +303,8 @@
obj = unveil(ref);
- KGC_rmWeakRef(main_collector, ref, obj);
- KFREE(obj);
+ KGC_rmWeakRef(main_collector, ref2, obj);
+ KFREE(ref2);
END_EXCEPTION_HANDLING();
}
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.36 kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.37
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.36 Mon Feb 6 21:09:57 2006
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c Mon Sep 25 18:24:21 2006
@@ -247,7 +247,7 @@
uint16 idx = GCMEM2IDX(info, unit);
if (idx < info->nr &&
GCBLOCK2MEM(info, idx) == unit &&
- (KGC_GET_COLOUR(info, idx) & KGC_COLOUR_INUSE) == KGC_COLOUR_INUSE) {
+ ((KGC_GET_COLOUR(info, idx) & KGC_COLOUR_INUSE) == KGC_COLOUR_INUSE || KGC_GET_COLOUR(info, idx) == KGC_COLOUR_FIXED)) {
return 1;
}
}
More information about the kaffe
mailing list