From 1dfa421a6c119fe0c2bb9d5c660b190fa99c20d0 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 17 Sep 2009 18:28:42 -0600 Subject: [PATCH 1/5] fix argument mixup in Runtime.exit --- src/builtin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index 5a44a6a260..a59ac44da9 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -731,7 +731,7 @@ Avian_java_lang_Runtime_exit { shutDown(t); - t->m->system->exit(*arguments); + t->m->system->exit(arguments[1]); } extern "C" JNIEXPORT int64_t JNICALL From fcc4ff93e00e4cdbf4c2c1172a7f00bcd6eb1548 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 17 Sep 2009 21:22:47 -0600 Subject: [PATCH 2/5] remove debug logging --- src/machine.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index a0ce673f92..783ecb1aaf 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3698,8 +3698,6 @@ runJavaThread(Thread* t) void runFinalizeThread(Thread* t) { - fprintf(stderr, "run finalize thread\n"); - setDaemon(t, t->javaThread, true); object list = 0; @@ -3714,8 +3712,6 @@ runFinalizeThread(Thread* t) } if (t->m->finalizeThread == 0) { - fprintf(stderr, "exit finalize thread\n"); - return; } else { list = t->m->objectsToFinalize; From b645c284b5d38003bd5619372233e7272916a132 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 17 Sep 2009 21:36:52 -0600 Subject: [PATCH 3/5] fix memory leak in debug build --- src/machine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 783ecb1aaf..a39931d413 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -68,9 +68,8 @@ dispose(Thread* t, Thread* o, bool remove) expect(t, find(t->m->rootThread, o)); unsigned c = count(t->m->rootThread, o); - Thread** threads = static_cast - (allocate(t->m->system, c * sizeof(Thread*))); - fill(t->m->rootThread, o, threads); + RUNTIME_ARRAY(Thread*, threads, c); + fill(t->m->rootThread, o, RUNTIME_ARRAY_BODY(threads)); #endif if (o->parent) { @@ -115,7 +114,7 @@ dispose(Thread* t, Thread* o, bool remove) expect(t, not find(t->m->rootThread, o)); for (unsigned i = 0; i < c; ++i) { - expect(t, find(t->m->rootThread, threads[i])); + expect(t, find(t->m->rootThread, RUNTIME_ARRAY_BODY(threads)[i])); } #endif } From d0f8889e271dbe637a10daf786f442cc1825cfe3 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 18 Sep 2009 12:20:35 -0600 Subject: [PATCH 4/5] fix GC safety bugs in parseMethodTable and makeArrayClass --- src/machine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/machine.cpp b/src/machine.cpp index a39931d413..570550f3bd 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1540,6 +1540,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool) } if (abstractVirtuals) { + PROTECT(t, vtable); PROTECT(t, abstractVirtuals); unsigned oldLength = arrayLength(t, classMethodTable(t, class_)); @@ -1713,6 +1714,7 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec, object makeArrayClass(Thread* t, object loader, object spec) { + PROTECT(t, loader); PROTECT(t, spec); const char* s = reinterpret_cast(&byteArrayBody(t, spec, 0)); From 6fa25f992c36f12e7a1d6d6e0265da5cc8863419 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 18 Sep 2009 17:51:05 -0600 Subject: [PATCH 5/5] Properties.setProperty should return an Object --- classpath/java/util/Properties.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classpath/java/util/Properties.java b/classpath/java/util/Properties.java index 310665567f..c591eb714b 100644 --- a/classpath/java/util/Properties.java +++ b/classpath/java/util/Properties.java @@ -45,8 +45,8 @@ public class Properties extends Hashtable { return value; } - public void setProperty(String key, String value) { - put(key, value); + public Object setProperty(String key, String value) { + return put(key, value); } private static class Parser {