From e3e9981031a13a560f2cb9868d3ce1fb118600c2 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 16 Jul 2007 19:55:49 -0600 Subject: [PATCH] more GC stress fixes --- makefile | 4 ++-- src/machine.cpp | 10 ++++++++-- src/run.cpp | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/makefile b/makefile index fe0763ec0f..1265b1ca4f 100644 --- a/makefile +++ b/makefile @@ -16,6 +16,8 @@ src = src classpath = classpath test = test +input = $(cls)/Exceptions.class + cxx = g++ cc = gcc vg = nice valgrind --leak-check=full --num-callers=32 --db-attach=yes \ @@ -119,8 +121,6 @@ classpath-objects = $(classpath-classes) $(jni-library) test-sources = $(shell find $(test) -name '*.java') test-classes = $(call java-classes,$(test-sources),$(test)) -input = $(cls)/Hello.class - classpath-objects = $(classpath-classes) $(jni-library) class-name = $(patsubst $(cls)/%.class,%,$(1)) diff --git a/src/machine.cpp b/src/machine.cpp index 32595d35ab..42111bbe02 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1358,12 +1358,18 @@ exit(Thread* t) joinAll(t, t->vm->rootThread); - for (object f = t->vm->finalizers; f; f = finalizerNext(t, f)) { + for (object* p = &(t->vm->finalizers); *p;) { + object f = *p; + *p = finalizerNext(t, *p); + reinterpret_cast(finalizerFinalize(t, f)) (t, finalizerTarget(t, f)); } - for (object f = t->vm->tenuredFinalizers; f; f = finalizerNext(t, f)) { + for (object* p = &(t->vm->tenuredFinalizers); *p;) { + object f = *p; + *p = finalizerNext(t, *p); + reinterpret_cast(finalizerFinalize(t, f)) (t, finalizerTarget(t, f)); } diff --git a/src/run.cpp b/src/run.cpp index bf2d2cb7af..7f450f8d1b 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -872,9 +872,7 @@ run(Thread* t) } goto loop; case getfield: { - object instance = popObject(t); - - if (LIKELY(instance)) { + if (LIKELY(peekObject(t, sp - 1))) { uint8_t index1 = codeBody(t, code, ip++); uint8_t index2 = codeBody(t, code, ip++); uint16_t index = (index1 << 8) | index2; @@ -882,6 +880,8 @@ run(Thread* t) object field = resolveField(t, codePool(t, code), index - 1); if (UNLIKELY(exception)) goto throw_; + object instance = popObject(t); + switch (fieldCode(t, field)) { case ByteField: case BooleanField: