[kaffe] CVS kaffe (guilhem): Fixed NPE problem on StackTraceElement.
Kaffe CVS
cvs-commits at kaffe.org
Mon Jun 13 08:51:16 PDT 2005
PatchSet 6643
Date: 2005/06/13 15:44:41
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Fixed NPE problem on StackTraceElement.
* kaffe/kaffevm/baseClasses.c
(stateCompleteClass): New array to store classes that should be in
complete state at the end of the first initialization procedure.
(initBaseClasses): Push all classes in stateCompleteClass to the
COMPLETE state.
* kaffe/kaffevm/gcFuncs.c
(walkRefArray): Added some debug printing.
(newArrayChecked): Removed unused condition.
* kaffe/kaffevm/jni/jni.c: Cleaned up style.
Members:
ChangeLog:1.4169->1.4170
kaffe/kaffevm/baseClasses.c:1.66->1.67
kaffe/kaffevm/gcFuncs.c:1.75->1.76
kaffe/kaffevm/object.c:1.35->1.36
kaffe/kaffevm/jni/jni.c:1.33->1.34
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4169 kaffe/ChangeLog:1.4170
--- kaffe/ChangeLog:1.4169 Mon Jun 13 13:13:10 2005
+++ kaffe/ChangeLog Mon Jun 13 15:44:41 2005
@@ -1,5 +1,19 @@
2005-06-13 Guilhem Lavaux <guilhem at kaffe.org>
+ * kaffe/kaffevm/baseClasses.c
+ (stateCompleteClass): New array to store classes that should be in
+ complete state at the end of the first initialization procedure.
+ (initBaseClasses): Push all classes in stateCompleteClass to the
+ COMPLETE state.
+
+ * kaffe/kaffevm/gcFuncs.c
+ (walkRefArray): Added some debug printing.
+ (newArrayChecked): Removed unused condition.
+
+ * kaffe/kaffevm/jni/jni.c: Cleaned up style.
+
+2005-06-13 Guilhem Lavaux <guilhem at kaffe.org>
+
* test/regression/Preempt.java: Added a 'yield' for Solaris.
2005-06-13 Guilhem Lavaux <guilhem at kaffe.org>
Index: kaffe/kaffe/kaffevm/baseClasses.c
diff -u kaffe/kaffe/kaffevm/baseClasses.c:1.66 kaffe/kaffe/kaffevm/baseClasses.c:1.67
--- kaffe/kaffe/kaffevm/baseClasses.c:1.66 Mon May 30 21:16:02 2005
+++ kaffe/kaffe/kaffevm/baseClasses.c Mon Jun 13 15:44:44 2005
@@ -97,6 +97,21 @@
/* Let's not load this if we can't open Klasses.jar */
Hjava_lang_Class* javaIoIOException;
+static Hjava_lang_Class** stateCompleteClass[] = {
+ &StringClass,
+ &javaLangThrowable,
+ &javaLangVMThrowable,
+ &javaLangStackTraceElement,
+ &javaLangException,
+ &javaLangArrayIndexOutOfBoundsException,
+ &javaLangNullPointerException,
+ &javaLangArithmeticException,
+ &javaLangClassNotFoundException,
+ &javaLangNoClassDefFoundError,
+ &javaLangStackOverflowError,
+ NULL
+};
+
#define RUNTIMECLASS "java/lang/Runtime"
#define SYSTEMCLASS "java/lang/System"
#define SERIALCLASS "java/io/Serializable"
@@ -294,6 +309,7 @@
initBaseClasses(void)
{
errorInfo einfo;
+ int i;
DBG(INIT, dprintf("initBaseClasses()\n"); );
@@ -352,7 +368,9 @@
DBG(INIT, dprintf("initBaseClasses() done\n"); );
- if (!processClass(StringClass, CSTATE_COMPLETE, &einfo))
- abortWithEarlyClassFailure(&einfo);
+ for (i = 0; stateCompleteClass[i] != NULL; i++) {
+ if (!processClass(*stateCompleteClass[i], CSTATE_COMPLETE, &einfo))
+ abortWithEarlyClassFailure(&einfo);
+ }
}
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.75 kaffe/kaffe/kaffevm/gcFuncs.c:1.76
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.75 Mon May 30 21:16:03 2005
+++ kaffe/kaffe/kaffevm/gcFuncs.c Mon Jun 13 15:44:44 2005
@@ -496,6 +496,10 @@
if (lk != NULL && KGC_getObjectIndex(collector, lk) == KGC_ALLOC_LOCK)
KGC_markObject(collector, gc_info, lk);
+DBG(GCPRECISE,
+ dprintf("walkRefArray `%s' (num=%d)\n", CLASS_CNAME(arr->vtable->class), ARRAY_SIZE(arr));
+ );
+
ptr = OBJARRAY_DATA(arr);
/* mark class only if not a system class (which would be anchored
* anyway.) */
@@ -503,7 +507,7 @@
KGC_markObject(collector, gc_info, arr->vtable->class);
}
- for (i = ARRAY_SIZE(arr); --i>= 0; ) {
+ for (i = ARRAY_SIZE(arr); i > 0; i--) {
Hjava_lang_Object* el = *ptr++;
/*
* NB: This would break if some objects (i.e. class objects)
Index: kaffe/kaffe/kaffevm/object.c
diff -u kaffe/kaffe/kaffevm/object.c:1.35 kaffe/kaffe/kaffevm/object.c:1.36
--- kaffe/kaffe/kaffevm/object.c:1.35 Mon May 30 21:16:03 2005
+++ kaffe/kaffe/kaffevm/object.c Mon Jun 13 15:44:44 2005
@@ -143,18 +143,15 @@
if (CLASS_IS_PRIMITIVE(elclass) || elclass == PtrClass) {
total_count = (TYPE_SIZE(elclass) * count) +
ARRAY_DATA_OFFSET;
- if (total_count > count) {
- obj = gc_malloc(total_count,
- KGC_ALLOC_PRIMARRAY);
- }
+ obj = gc_malloc(total_count,
+ KGC_ALLOC_PRIMARRAY);
}
else {
total_count = (PTR_TYPE_SIZE * count) +
ARRAY_DATA_OFFSET;
- if (total_count > count) {
- obj = gc_malloc(total_count,
- KGC_ALLOC_REFARRAY);
- }
+
+ obj = gc_malloc(total_count,
+ KGC_ALLOC_REFARRAY);
}
if (obj != NULL) {
KaffeVM_setFinalizer(obj, KGC_DEFAULT_FINALIZER);
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.33 kaffe/kaffe/kaffevm/jni/jni.c:1.34
--- kaffe/kaffe/kaffevm/jni/jni.c:1.33 Sun Jun 12 07:37:34 2005
+++ kaffe/kaffe/kaffevm/jni/jni.c Mon Jun 13 15:44:44 2005
@@ -558,8 +558,7 @@
printStackTrace (eobj, NULL, true);
- if (eobj->cause != eobj)
- {
+ if (eobj->cause != eobj) {
eobj = eobj->cause;
kprintf(stderr, "caused by: ");
} else
More information about the kaffe
mailing list