From 527f46d53d017ee62948980183739a876d079d19 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 23 Jul 2007 21:31:28 -0600 Subject: [PATCH] bugfixes; add NullPointerException.java --- classpath/java/lang/NullPointerException.java | 19 +++++++++++++++ makefile | 2 +- src/machine.cpp | 24 +++++++++---------- src/run.cpp | 2 +- src/system.cpp | 2 +- 5 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 classpath/java/lang/NullPointerException.java diff --git a/classpath/java/lang/NullPointerException.java b/classpath/java/lang/NullPointerException.java new file mode 100644 index 0000000000..92e2eae934 --- /dev/null +++ b/classpath/java/lang/NullPointerException.java @@ -0,0 +1,19 @@ +package java.lang; + +public class NullPointerException extends RuntimeException { + public NullPointerException(String message, Throwable cause) { + super(message, cause); + } + + public NullPointerException(String message) { + this(message, null); + } + + public NullPointerException(Throwable cause) { + this(null, cause); + } + + public NullPointerException() { + this(null, null); + } +} diff --git a/makefile b/makefile index 9f6f301b94..d7b7654b52 100644 --- a/makefile +++ b/makefile @@ -16,7 +16,7 @@ src = src classpath = classpath test = test -input = $(cls)/Reflection.class +input = $(cls)/Threads.class cxx = g++ cc = gcc diff --git a/src/machine.cpp b/src/machine.cpp index 856594b89e..915760745f 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2048,27 +2048,27 @@ resolveClass(Thread* t, object spec) if (data) { if (Verbose) { - fprintf(stderr, "parsing %s\n", &byteArrayBody - (t, spec, 0)); + fprintf(stderr, "parsing %s\n", &byteArrayBody(t, spec, 0)); } // parse class file class_ = parseClass(t, data->start(), data->length()); data->dispose(); - if (Verbose) { - fprintf(stderr, "done parsing %s\n", &byteArrayBody - (t, className(t, class_), 0)); - } + if (LIKELY(t->exception == 0)) { + if (Verbose) { + fprintf(stderr, "done parsing %s\n", &byteArrayBody(t, spec, 0)); + } - object bootstrapClass = hashMapFind - (t, t->vm->bootstrapClassMap, spec, byteArrayHash, byteArrayEqual); + object bootstrapClass = hashMapFind + (t, t->vm->bootstrapClassMap, spec, byteArrayHash, byteArrayEqual); - if (bootstrapClass) { - PROTECT(t, bootstrapClass); + if (bootstrapClass) { + PROTECT(t, bootstrapClass); - updateBootstrapClass(t, bootstrapClass, class_); - class_ = bootstrapClass; + updateBootstrapClass(t, bootstrapClass, class_); + class_ = bootstrapClass; + } } } } diff --git a/src/run.cpp b/src/run.cpp index f8d4e11432..5f1cee20bc 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -2132,7 +2132,7 @@ run(Thread* t) pokeInt(t, t->frame + FrameIpOffset, t->ip); for (; frame >= 0; frame = frameNext(t, frame)) { - if (frame <= base) { + if (frame < base) { return 0; } diff --git a/src/system.cpp b/src/system.cpp index 83ecb0fb6c..ee872acb5d 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -212,7 +212,7 @@ class MySystem: public System { } virtual void dispose() { - assert(s, context == 0); + //assert(s, context == 0); pthread_mutex_destroy(&mutex); pthread_cond_destroy(&condition); s->free(this);