Factor out class names from throw statements.
Most exception throwing now happens via purpose-built wrapper
functions, each of which encapsulates the actual exception class name,
reducing one source of error (examples of which I fixed during this
exercise) and generally tidying things up.
This change doesn't fix all uses of exception class names, nor even
all throws, because (a) there were classes I didn't get to; (b)
because I didn't make wrappers for all the possible throw function
variants (e.g. the one that takes a cause, the one that takes varargs
for string formatting, etc.); and (c) there are uses of exception
classes in contexts other than throwing. But this change at least makes
a dent in the problem.
Change-Id: I6586ddd3e66ac0fc32c23181b17600ded0b914b2
diff --git a/vm/CheckJni.c b/vm/CheckJni.c
index d73b661..c6e3e42 100644
--- a/vm/CheckJni.c
+++ b/vm/CheckJni.c
@@ -350,8 +350,7 @@
printWarn = true;
/* this is a bad idea -- need to throw as we exit, or abort func */
- //dvmThrowException("Ljava/lang/RuntimeException;",
- // "invalid use of JNI env ptr");
+ //dvmThrowRuntimeException("invalid use of JNI env ptr");
} else if (((JNIEnvExt*) env)->self != dvmThreadSelf()) {
/* correct JNIEnv*; make sure the "self" pointer is correct */
LOGE("JNI ERROR: env->self != thread-self (%p vs. %p)",
diff --git a/vm/Ddm.c b/vm/Ddm.c
index ee3e9b2..528072e 100644
--- a/vm/Ddm.c
+++ b/vm/Ddm.c
@@ -509,7 +509,7 @@
if (!dvmGenerateTrackedAllocationReport(&data, &len)) {
/* assume OOM */
- dvmThrowException("Ljava/lang/OutOfMemoryError;","recent alloc native");
+ dvmThrowOutOfMemoryError("recent alloc native");
return NULL;
}
diff --git a/vm/Exception.c b/vm/Exception.c
index deb399e..4e852bd 100644
--- a/vm/Exception.c
+++ b/vm/Exception.c
@@ -330,8 +330,8 @@
}
/*
- * Like dvmThrowExceptionWithMessageFromDescriptor, but take a
- * class object instead of a name.
+ * Like dvmThrowException, but take a class object instead of a name
+ * and turn the given message into the human-readable form for a descriptor.
*/
void dvmThrowExceptionByClassWithClassMessage(ClassObject* exceptionClass,
const char* messageDescriptor)
@@ -1360,6 +1360,14 @@
"index=%d length=%d", index, length);
}
+void dvmThrowAbstractMethodError(const char* msg) {
+ dvmThrowException("Ljava/lang/AbstractMethodError;", msg);
+}
+
+void dvmThrowArithmeticException(const char* msg) {
+ dvmThrowException("Ljava/lang/ArithmeticException;", msg);
+}
+
static void dvmThrowTypeError(const char* exceptionClassName, const char* fmt,
ClassObject* actual, ClassObject* desired)
{
@@ -1383,3 +1391,88 @@
dvmThrowTypeError("Ljava/lang/ClassCastException;",
"%s cannot be cast to %s", actual, desired);
}
+
+void dvmThrowClassNotFoundException(const char* msg) {
+ dvmThrowException("Ljava/lang/ClassNotFoundException;", msg);
+}
+
+void dvmThrowFileNotFoundException(const char* msg) {
+ dvmThrowException("Ljava/io/FileNotFoundException;", msg);
+}
+
+void dvmThrowIOException(const char* msg) {
+ dvmThrowException("Ljava/io/IOException;", msg);
+}
+
+void dvmThrowIllegalAccessException(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalAccessException;", msg);
+}
+
+void dvmThrowIllegalAccessError(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalAccessError;", msg);
+}
+
+void dvmThrowIllegalArgumentException(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalArgumentException;", msg);
+}
+
+void dvmThrowIllegalMonitorStateException(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalMonitorStateException;", msg);
+}
+
+void dvmThrowIllegalStateException(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalStateException;", msg);
+}
+
+void dvmThrowIllegalThreadStateException(const char* msg) {
+ dvmThrowException("Ljava/lang/IllegalThreadStateException;", msg);
+}
+
+void dvmThrowInternalError(const char* msg) {
+ dvmThrowException("Ljava/lang/InternalError;", msg);
+}
+
+void dvmThrowInterruptedException(const char* msg) {
+ dvmThrowException("Ljava/lang/InterruptedException;", msg);
+}
+
+void dvmThrowNegativeArraySizeException(const char* msg) {
+ dvmThrowException("Ljava/lang/NegativeArraySizeException;", msg);
+}
+
+void dvmThrowNoClassDefFoundError(const char* descriptor) {
+ dvmThrowExceptionWithClassMessage("Ljava/lang/NoClassDefFoundError;",
+ descriptor);
+}
+
+void dvmThrowNoSuchFieldError(const char* msg) {
+ dvmThrowException("Ljava/lang/NoSuchFieldError;", msg);
+}
+
+void dvmThrowNoSuchFieldException(const char* msg) {
+ dvmThrowException("Ljava/lang/NoSuchFieldException;", msg);
+}
+
+void dvmThrowNoSuchMethodError(const char* msg) {
+ dvmThrowException("Ljava/lang/NoSuchMethodError;", msg);
+}
+
+void dvmThrowNullPointerException(const char* msg) {
+ dvmThrowException("Ljava/lang/NullPointerException;", msg);
+}
+
+void dvmThrowOutOfMemoryError(const char* msg) {
+ dvmThrowException("Ljava/lang/OutOfMemoryError;", msg);
+}
+
+void dvmThrowRuntimeException(const char* msg) {
+ dvmThrowException("Ljava/lang/RuntimeException;", msg);
+}
+
+void dvmThrowStringIndexOutOfBoundsException(const char* msg) {
+ dvmThrowException("Ljava/lang/StringIndexOutOfBoundsException;", msg);
+}
+
+void dvmThrowUnsupportedOperationException(const char* msg) {
+ dvmThrowException("Ljava/lang/UnsupportedOperationException;", msg);
+}
diff --git a/vm/Exception.h b/vm/Exception.h
index 6d05b09..7f02b90 100644
--- a/vm/Exception.h
+++ b/vm/Exception.h
@@ -40,6 +40,19 @@
* index and array length in the detail message.
*/
void dvmThrowAIOOBE(int index, int length);
+
+/**
+ * Throw an AbstractMethodError in the current thread, with the given detail
+ * message.
+ */
+void dvmThrowAbstractMethodError(const char* msg);
+
+/**
+ * Throw an ArithmeticException in the current thread, with the given detail
+ * message.
+ */
+void dvmThrowArithmeticException(const char* msg);
+
/*
* Throw an ArrayStoreException in the current thread, using the given classes'
* names in the detail message.
@@ -52,6 +65,132 @@
*/
void dvmThrowClassCastException(ClassObject* actual, ClassObject* desired);
+/**
+ * Throw a ClassNotFoundException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowClassNotFoundException(const char* msg);
+
+/**
+ * Throw a FileNotFoundException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowFileNotFoundException(const char* msg);
+
+/**
+ * Throw an IOException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowIOException(const char* msg);
+
+/**
+ * Throw an IllegalAccessError in the current thread, with the
+ * given detail message.
+ */
+void dvmThrowIllegalAccessError(const char* msg);
+
+/**
+ * Throw an IllegalAccessException in the current thread, with the
+ * given detail message.
+ */
+void dvmThrowIllegalAccessException(const char* msg);
+
+/**
+ * Throw an IllegalArgumentException in the current thread, with the
+ * given detail message.
+ */
+void dvmThrowIllegalArgumentException(const char* msg);
+
+/**
+ * Throw an IllegalMonitorStateException in the current thread, with
+ * the given detail message.
+ */
+void dvmThrowIllegalMonitorStateException(const char* msg);
+
+/**
+ * Throw an IllegalStateException in the current thread, with
+ * the given detail message.
+ */
+void dvmThrowIllegalStateException(const char* msg);
+
+/**
+ * Throw an IllegalThreadStateException in the current thread, with
+ * the given detail message.
+ */
+void dvmThrowIllegalThreadStateException(const char* msg);
+
+/**
+ * Throw an InternalError in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowInternalError(const char* msg);
+
+/**
+ * Throw an InterruptedException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowInterruptedException(const char* msg);
+
+/**
+ * Throw a NegativeArraySizeException in the current thread, with the
+ * given detail message.
+ */
+void dvmThrowNegativeArraySizeException(const char* msg);
+
+/**
+ * Throw a NoClassDefFoundError in the current thread, with the
+ * human-readable form of the given descriptor as the detail message.
+ */
+void dvmThrowNoClassDefFoundError(const char* descriptor);
+
+/**
+ * Throw a NoSuchFieldError in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowNoSuchFieldError(const char* msg);
+
+/**
+ * Throw a NoSuchFieldException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowNoSuchFieldException(const char* msg);
+
+/**
+ * Throw a NoSuchMethodError in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowNoSuchMethodError(const char* msg);
+
+/**
+ * Throw a NullPointerException in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowNullPointerException(const char* msg);
+
+/**
+ * Throw an OutOfMemoryError in the current thread, with the given
+ * detail message.
+ */
+void dvmThrowOutOfMemoryError(const char* msg);
+
+/**
+ * Throw a RuntimeException in the current thread, with the given detail
+ * message.
+ */
+void dvmThrowRuntimeException(const char* msg);
+
+/**
+ * Throw a StringIndexOutOfBoundsException in the current thread, with
+ * the given detail message.
+ */
+void dvmThrowStringIndexOutOfBoundsException(const char* msg);
+
+/**
+ * Throw an UnsupportedOperationException in the current thread, with
+ * the given detail message.
+ */
+void dvmThrowUnsupportedOperationException(const char* msg);
+
/*
* Like dvmThrowChainedException, but takes printf-style args for the message.
*/
@@ -83,8 +222,8 @@
}
/*
- * Throw the named exception using the name of a class as the exception
- * message.
+ * Throw the named exception using the human-readable form of the class
+ * descriptor as the exception message, and with the specified cause.
*/
void dvmThrowChainedExceptionWithClassMessage(const char* exceptionDescriptor,
const char* messageDescriptor, Object* cause);
@@ -96,8 +235,8 @@
}
/*
- * Like dvmThrowExceptionWithMessageFromDescriptor, but take a
- * class object instead of a name.
+ * Like dvmThrowException, but take a class object instead of a name
+ * and turn the given message into the human-readable form for a descriptor.
*/
void dvmThrowExceptionByClassWithClassMessage(ClassObject* exceptionClass,
const char* messageDescriptor);
diff --git a/vm/InlineNative.c b/vm/InlineNative.c
index ddd3e30..1cc86ea 100644
--- a/vm/InlineNative.c
+++ b/vm/InlineNative.c
@@ -132,7 +132,7 @@
/* null reference check on "this" */
if ((Object*) arg0 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
@@ -207,7 +207,7 @@
* which must also be non-null.
*/
if ((Object*) arg0 == NULL || (Object*) arg1 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
@@ -299,7 +299,7 @@
* Null reference check on "this".
*/
if ((Object*) arg0 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
@@ -408,7 +408,7 @@
/* null reference check on "this" */
if ((Object*) arg0 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
@@ -426,7 +426,7 @@
/* null reference check on "this" */
if ((Object*) arg0 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
@@ -497,7 +497,7 @@
{
/* null reference check on "this" */
if ((Object*) arg0 == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
diff --git a/vm/Jni.c b/vm/Jni.c
index 4011659..ae9f514 100644
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -2069,8 +2069,7 @@
{
/* yes, OutOfMemoryError, not StackOverflowError */
dvmClearException(_self);
- dvmThrowException("Ljava/lang/OutOfMemoryError;",
- "out of stack in JNI PushLocalFrame");
+ dvmThrowOutOfMemoryError("out of stack in JNI PushLocalFrame");
result = JNI_ERR;
}
JNI_EXIT();
@@ -2088,8 +2087,7 @@
if (!dvmPopLocalFrame(_self /*dvmThreadSelf()*/)) {
LOGW("JNI WARNING: too many PopLocalFrame calls\n");
dvmClearException(_self);
- dvmThrowException("Ljava/lang/RuntimeException;",
- "too many PopLocalFrame calls");
+ dvmThrowRuntimeException("too many PopLocalFrame calls");
}
jresult = addLocalReference(env, result);
JNI_EXIT();
@@ -2160,8 +2158,7 @@
JNI_ENTER();
bool okay = ensureLocalCapacity(env, capacity);
if (!okay) {
- dvmThrowException("Ljava/lang/OutOfMemoryError;",
- "can't ensure local reference capacity");
+ dvmThrowOutOfMemoryError("can't ensure local reference capacity");
}
JNI_EXIT();
if (okay)
@@ -3010,8 +3007,7 @@
newStr = dvmCreateCstrFromString(strObj);
if (newStr == NULL) {
/* assume memory failure */
- dvmThrowException("Ljava/lang/OutOfMemoryError;",
- "native heap string alloc failed");
+ dvmThrowOutOfMemoryError("native heap string alloc failed");
}
}
@@ -3056,8 +3052,7 @@
(ClassObject*) dvmDecodeIndirectRef(env, jelementClass);
if (elemClassObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;",
- "JNI NewObjectArray");
+ dvmThrowNullPointerException("JNI NewObjectArray");
goto bail;
}
@@ -3419,7 +3414,7 @@
JNI_ENTER();
StringObject* strObj = (StringObject*) dvmDecodeIndirectRef(env, jstr);
if (start + len > dvmStringLen(strObj))
- dvmThrowException("Ljava/lang/StringIndexOutOfBoundsException;", NULL);
+ dvmThrowStringIndexOutOfBoundsException(NULL);
else
memcpy(buf, dvmStringChars(strObj) + start, len * sizeof(u2));
JNI_EXIT();
@@ -3435,7 +3430,7 @@
JNI_ENTER();
StringObject* strObj = (StringObject*) dvmDecodeIndirectRef(env, jstr);
if (start + len > dvmStringLen(strObj))
- dvmThrowException("Ljava/lang/StringIndexOutOfBoundsException;", NULL);
+ dvmThrowStringIndexOutOfBoundsException(NULL);
else
dvmCreateCstrFromStringRegion(strObj, start, len, buf);
JNI_EXIT();
diff --git a/vm/Profile.c b/vm/Profile.c
index d1f5b23..ff3fc56 100644
--- a/vm/Profile.c
+++ b/vm/Profile.c
@@ -346,7 +346,7 @@
*/
state->buf = (u1*) malloc(bufferSize);
if (state->buf == NULL) {
- dvmThrowException("Ljava/lang/InternalError;", "buffer alloc failed");
+ dvmThrowInternalError("buffer alloc failed");
goto fail;
}
if (!directToDdms) {
diff --git a/vm/Sync.c b/vm/Sync.c
index bfde9c1..387cdd1 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -455,8 +455,7 @@
* The JNI spec says that we should throw IllegalMonitorStateException
* in this case.
*/
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
- "unlock of unowned monitor");
+ dvmThrowIllegalMonitorStateException("unlock of unowned monitor");
return false;
}
return true;
@@ -626,7 +625,7 @@
/* Make sure that we hold the lock. */
if (mon->owner != self) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before wait()");
return;
}
@@ -635,8 +634,7 @@
* Enforce the timeout range.
*/
if (msec < 0 || nsec < 0 || nsec > 999999) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "timeout arguments out of range");
+ dvmThrowIllegalArgumentException("timeout arguments out of range");
return;
}
@@ -754,8 +752,9 @@
* cleared when this exception is thrown."
*/
self->interrupted = false;
- if (interruptShouldThrow)
- dvmThrowException("Ljava/lang/InterruptedException;", NULL);
+ if (interruptShouldThrow) {
+ dvmThrowInterruptedException(NULL);
+ }
}
}
@@ -771,7 +770,7 @@
/* Make sure that we hold the lock. */
if (mon->owner != self) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before notify()");
return;
}
@@ -803,7 +802,7 @@
/* Make sure that we hold the lock. */
if (mon->owner != self) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before notifyAll()");
return;
}
@@ -1039,8 +1038,7 @@
* We do not own the lock. The JVM spec requires that we
* throw an exception in this case.
*/
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
- "unlock of unowned monitor");
+ dvmThrowIllegalMonitorStateException("unlock of unowned monitor");
return false;
}
} else {
@@ -1074,7 +1072,7 @@
/* Make sure that 'self' holds the lock.
*/
if (LW_LOCK_OWNER(thin) != self->threadId) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before wait()");
return;
}
@@ -1105,7 +1103,7 @@
/* Make sure that 'self' holds the lock.
*/
if (LW_LOCK_OWNER(thin) != self->threadId) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before notify()");
return;
}
@@ -1133,7 +1131,7 @@
/* Make sure that 'self' holds the lock.
*/
if (LW_LOCK_OWNER(thin) != self->threadId) {
- dvmThrowException("Ljava/lang/IllegalMonitorStateException;",
+ dvmThrowIllegalMonitorStateException(
"object not locked by thread before notifyAll()");
return;
}
diff --git a/vm/Thread.c b/vm/Thread.c
index 6745dae..cdc9f4f 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -1467,7 +1467,7 @@
if (dvmGetFieldObject(threadObj, gDvm.offJavaLangThread_vmThread) != NULL) {
dvmUnlockThreadList();
- dvmThrowException("Ljava/lang/IllegalThreadStateException;",
+ dvmThrowIllegalThreadStateException(
"thread has already been started");
goto fail;
}
@@ -1503,8 +1503,7 @@
dvmSetFieldObject(threadObj, gDvm.offJavaLangThread_vmThread, NULL);
- dvmThrowException("Ljava/lang/OutOfMemoryError;",
- "thread creation failed");
+ dvmThrowOutOfMemoryError("thread creation failed");
goto fail;
}
@@ -2097,7 +2096,7 @@
*/
if (dvmGetFieldObject(threadObj, gDvm.offJavaLangThread_vmThread) != NULL) {
LOGW("WOW: thread start hijack\n");
- dvmThrowException("Ljava/lang/IllegalThreadStateException;",
+ dvmThrowIllegalThreadStateException(
"thread has already been started");
/* We don't want to free anything associated with the thread
* because someone is obviously interested in it. Just let
@@ -3208,7 +3207,7 @@
groupObj = dvmGetStaticFieldObject(groupField);
if (groupObj == NULL) {
LOGE("java.lang.ThreadGroup.%s not initialized\n", fieldName);
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
return NULL;
}
diff --git a/vm/alloc/Heap.c b/vm/alloc/Heap.c
index 7eb3ff2..6438216 100644
--- a/vm/alloc/Heap.c
+++ b/vm/alloc/Heap.c
@@ -369,7 +369,7 @@
/* Don't include a description string;
* one fewer allocation.
*/
- dvmThrowException("Ljava/lang/OutOfMemoryError;", NULL);
+ dvmThrowOutOfMemoryError(NULL);
} else {
/*
* This thread has already tried to throw an OutOfMemoryError,
diff --git a/vm/interp/Interp.c b/vm/interp/Interp.c
index ef11547..b0c73ba 100644
--- a/vm/interp/Interp.c
+++ b/vm/interp/Interp.c
@@ -749,8 +749,7 @@
*/
if (*switchData++ != kPackedSwitchSignature) {
/* should have been caught by verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad packed switch magic");
+ dvmThrowInternalError("bad packed switch magic");
return kInstrLen;
}
@@ -804,8 +803,7 @@
if (*switchData++ != kSparseSwitchSignature) {
/* should have been caught by verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad sparse switch magic");
+ dvmThrowInternalError("bad sparse switch magic");
return kInstrLen;
}
@@ -917,7 +915,7 @@
u4 size;
if (arrayObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
assert (!IS_CLASS_FLAG_SET(((Object *)arrayObj)->clazz,
@@ -934,7 +932,7 @@
* Total size is 4+(width * size + 1)/2 16-bit code units.
*/
if (arrayData[0] != kArrayDataSignature) {
- dvmThrowException("Ljava/lang/InternalError;", "bad array data magic");
+ dvmThrowInternalError("bad array data magic");
return false;
}
@@ -1010,8 +1008,7 @@
#if 0
/* this can happen when there's a stale class file */
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "interface method not implemented");
+ dvmThrowAbstractMethodError("interface method not implemented");
return NULL;
}
#else
diff --git a/vm/interp/Stack.c b/vm/interp/Stack.c
index 54be90e..14696a7 100644
--- a/vm/interp/Stack.c
+++ b/vm/interp/Stack.c
@@ -392,8 +392,7 @@
method))
{
/* note this throws IAException, not IAError */
- dvmThrowException("Ljava/lang/IllegalAccessException;",
- "access to method denied");
+ dvmThrowIllegalAccessException("access to method denied");
return NULL;
}
}
diff --git a/vm/mterp/c/OP_FILL_ARRAY_DATA.c b/vm/mterp/c/OP_FILL_ARRAY_DATA.c
index 095b465..678bb32 100644
--- a/vm/mterp/c/OP_FILL_ARRAY_DATA.c
+++ b/vm/mterp/c/OP_FILL_ARRAY_DATA.c
@@ -14,8 +14,7 @@
arrayData >= curMethod->insns + dvmGetMethodInsnsSize(curMethod))
{
/* should have been caught in verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad fill array data");
+ dvmThrowInternalError("bad fill array data");
GOTO_exceptionThrown();
}
#endif
diff --git a/vm/mterp/c/OP_NEW_ARRAY.c b/vm/mterp/c/OP_NEW_ARRAY.c
index 525c43b..d77c4d5 100644
--- a/vm/mterp/c/OP_NEW_ARRAY.c
+++ b/vm/mterp/c/OP_NEW_ARRAY.c
@@ -13,7 +13,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
diff --git a/vm/mterp/c/OP_NEW_ARRAY_JUMBO.c b/vm/mterp/c/OP_NEW_ARRAY_JUMBO.c
index 5ef5e49..46905cf 100644
--- a/vm/mterp/c/OP_NEW_ARRAY_JUMBO.c
+++ b/vm/mterp/c/OP_NEW_ARRAY_JUMBO.c
@@ -13,7 +13,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
diff --git a/vm/mterp/c/OP_PACKED_SWITCH.c b/vm/mterp/c/OP_PACKED_SWITCH.c
index d0986dc..cca9a7c 100644
--- a/vm/mterp/c/OP_PACKED_SWITCH.c
+++ b/vm/mterp/c/OP_PACKED_SWITCH.c
@@ -14,7 +14,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad packed switch");
+ dvmThrowInternalError("bad packed switch");
GOTO_exceptionThrown();
}
#endif
diff --git a/vm/mterp/c/OP_SPARSE_SWITCH.c b/vm/mterp/c/OP_SPARSE_SWITCH.c
index 7f3648a..e4e04ba 100644
--- a/vm/mterp/c/OP_SPARSE_SWITCH.c
+++ b/vm/mterp/c/OP_SPARSE_SWITCH.c
@@ -14,7 +14,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad sparse switch");
+ dvmThrowInternalError("bad sparse switch");
GOTO_exceptionThrown();
}
#endif
diff --git a/vm/mterp/c/gotoTargets.c b/vm/mterp/c/gotoTargets.c
index 3739af2..39e74b9 100644
--- a/vm/mterp/c/gotoTargets.c
+++ b/vm/mterp/c/gotoTargets.c
@@ -54,7 +54,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -70,8 +70,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -192,8 +191,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -288,15 +286,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -505,8 +501,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -547,7 +542,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -567,8 +562,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/mterp/c/header.c b/vm/mterp/c/header.c
index 41388b6..bd86362 100644
--- a/vm/mterp/c/header.c
+++ b/vm/mterp/c/header.c
@@ -352,7 +352,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -384,7 +384,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
diff --git a/vm/mterp/c/opcommon.c b/vm/mterp/c/opcommon.c
index 30abc72..562c039 100644
--- a/vm/mterp/c/opcommon.c
+++ b/vm/mterp/c/opcommon.c
@@ -149,8 +149,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -196,9 +195,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -231,8 +229,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -277,8 +274,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -320,8 +316,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -367,8 +362,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index eda4f69..c4c6fba 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -1835,7 +1829,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -1883,8 +1877,7 @@
arrayData >= curMethod->insns + dvmGetMethodInsnsSize(curMethod))
{
/* should have been caught in verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad fill array data");
+ dvmThrowInternalError("bad fill array data");
GOTO_exceptionThrown();
}
#endif
@@ -1985,7 +1978,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad packed switch");
+ dvmThrowInternalError("bad packed switch");
GOTO_exceptionThrown();
}
#endif
@@ -2016,7 +2009,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad sparse switch");
+ dvmThrowInternalError("bad sparse switch");
GOTO_exceptionThrown();
}
#endif
@@ -3309,7 +3302,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -4501,7 +4494,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -4517,8 +4510,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -4639,8 +4631,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -4735,15 +4726,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -4952,8 +4941,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -4994,7 +4982,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -5014,8 +5002,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/mterp/out/InterpC-armv5te-vfp.c b/vm/mterp/out/InterpC-armv5te-vfp.c
index 8fc5605..47f2282 100644
--- a/vm/mterp/out/InterpC-armv5te-vfp.c
+++ b/vm/mterp/out/InterpC-armv5te-vfp.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
diff --git a/vm/mterp/out/InterpC-armv5te.c b/vm/mterp/out/InterpC-armv5te.c
index 261891e..b2f0eea 100644
--- a/vm/mterp/out/InterpC-armv5te.c
+++ b/vm/mterp/out/InterpC-armv5te.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
diff --git a/vm/mterp/out/InterpC-armv7-a-neon.c b/vm/mterp/out/InterpC-armv7-a-neon.c
index 28603ef..ee40af8a 100644
--- a/vm/mterp/out/InterpC-armv7-a-neon.c
+++ b/vm/mterp/out/InterpC-armv7-a-neon.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
diff --git a/vm/mterp/out/InterpC-armv7-a.c b/vm/mterp/out/InterpC-armv7-a.c
index 0d0c8c4..c53f4fc 100644
--- a/vm/mterp/out/InterpC-armv7-a.c
+++ b/vm/mterp/out/InterpC-armv7-a.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c
index 9cd97eb..f9629dd 100644
--- a/vm/mterp/out/InterpC-portdbg.c
+++ b/vm/mterp/out/InterpC-portdbg.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -684,8 +684,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -731,9 +730,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -766,8 +764,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -812,8 +809,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -855,8 +851,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -902,8 +897,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -2197,7 +2191,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -2245,8 +2239,7 @@
arrayData >= curMethod->insns + dvmGetMethodInsnsSize(curMethod))
{
/* should have been caught in verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad fill array data");
+ dvmThrowInternalError("bad fill array data");
GOTO_exceptionThrown();
}
#endif
@@ -2347,7 +2340,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad packed switch");
+ dvmThrowInternalError("bad packed switch");
GOTO_exceptionThrown();
}
#endif
@@ -2378,7 +2371,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad sparse switch");
+ dvmThrowInternalError("bad sparse switch");
GOTO_exceptionThrown();
}
#endif
@@ -3671,7 +3664,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -4781,7 +4774,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -4797,8 +4790,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -4919,8 +4911,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -5015,15 +5006,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -5232,8 +5221,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -5274,7 +5262,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -5294,8 +5282,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c
index 43bcb44..83c6128 100644
--- a/vm/mterp/out/InterpC-portstd.c
+++ b/vm/mterp/out/InterpC-portstd.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -675,8 +675,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -722,9 +721,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -757,8 +755,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -803,8 +800,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -846,8 +842,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -893,8 +888,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -1947,7 +1941,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -1995,8 +1989,7 @@
arrayData >= curMethod->insns + dvmGetMethodInsnsSize(curMethod))
{
/* should have been caught in verifier */
- dvmThrowException("Ljava/lang/InternalError;",
- "bad fill array data");
+ dvmThrowInternalError("bad fill array data");
GOTO_exceptionThrown();
}
#endif
@@ -2097,7 +2090,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad packed switch");
+ dvmThrowInternalError("bad packed switch");
GOTO_exceptionThrown();
}
#endif
@@ -2128,7 +2121,7 @@
{
/* should have been caught in verifier */
EXPORT_PC();
- dvmThrowException("Ljava/lang/InternalError;", "bad sparse switch");
+ dvmThrowInternalError("bad sparse switch");
GOTO_exceptionThrown();
}
#endif
@@ -3421,7 +3414,7 @@
vdst, vsrc1, ref, (s4) GET_REGISTER(vsrc1));
length = (s4) GET_REGISTER(vsrc1);
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
GOTO_exceptionThrown();
}
arrayClass = dvmDexGetResolvedClass(methodClassDex, ref);
@@ -4531,7 +4524,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -4547,8 +4540,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -4669,8 +4661,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -4765,15 +4756,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -4982,8 +4971,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -5024,7 +5012,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -5044,8 +5032,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/mterp/out/InterpC-x86-atom.c b/vm/mterp/out/InterpC-x86-atom.c
index f98969a..71fc150 100644
--- a/vm/mterp/out/InterpC-x86-atom.c
+++ b/vm/mterp/out/InterpC-x86-atom.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -1449,7 +1443,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -1465,8 +1459,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -1587,8 +1580,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1683,15 +1675,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1900,8 +1890,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1942,7 +1931,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -1962,8 +1951,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c
index 7445ad4..b86dc7f 100644
--- a/vm/mterp/out/InterpC-x86.c
+++ b/vm/mterp/out/InterpC-x86.c
@@ -359,7 +359,7 @@
static inline bool checkForNull(Object* obj)
{
if (obj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -391,7 +391,7 @@
{
if (obj == NULL) {
EXPORT_PC();
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
@@ -693,8 +693,7 @@
secondVal = GET_REGISTER(vsrc2); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -740,9 +739,8 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s2) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
- GOTO_exceptionThrown(); \
+ dvmThrowArithmeticException("divide by zero"); \
+ GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s2) vsrc2) == -1) { \
/* won't generate /lit16 instr for this; check anyway */ \
@@ -775,8 +773,7 @@
firstVal = GET_REGISTER(vsrc1); \
if ((s1) vsrc2 == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && ((s1) vsrc2) == -1) { \
@@ -821,8 +818,7 @@
secondVal = GET_REGISTER(vsrc1); \
if (secondVal == 0) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u4)firstVal == 0x80000000 && secondVal == -1) { \
@@ -864,8 +860,7 @@
secondVal = GET_REGISTER_WIDE(vsrc2); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -911,8 +906,7 @@
secondVal = GET_REGISTER_WIDE(vsrc1); \
if (secondVal == 0LL) { \
EXPORT_PC(); \
- dvmThrowException("Ljava/lang/ArithmeticException;", \
- "divide by zero"); \
+ dvmThrowArithmeticException("divide by zero"); \
GOTO_exceptionThrown(); \
} \
if ((u8)firstVal == 0x8000000000000000ULL && \
@@ -1462,7 +1456,7 @@
}
/*
if (!dvmIsArrayClass(arrayClass)) {
- dvmThrowException("Ljava/lang/RuntimeError;",
+ dvmThrowRuntimeException(
"filled-new-array needs array class");
GOTO_exceptionThrown();
}
@@ -1478,8 +1472,7 @@
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
- dvmThrowException("Ljava/lang/RuntimeError;",
- "bad filled array req");
+ dvmThrowRuntimeException("bad filled array req");
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
@@ -1600,8 +1593,7 @@
* Works fine unless Sub stops providing an implementation of
* the method.
*/
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1696,15 +1688,13 @@
* Method does not exist in the superclass. Could happen if
* superclass gets updated.
*/
- dvmThrowException("Ljava/lang/NoSuchMethodError;",
- baseMethod->name);
+ dvmThrowNoSuchMethodError(baseMethod->name);
GOTO_exceptionThrown();
}
methodToCall = curMethod->clazz->super->vtable[baseMethod->methodIndex];
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1913,8 +1903,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
@@ -1955,7 +1944,7 @@
#if 0 /* impossible in optimized + verified code */
if (ref >= curMethod->clazz->super->vtableCount) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", NULL);
+ dvmThrowNoSuchMethodError(NULL);
GOTO_exceptionThrown();
}
#else
@@ -1975,8 +1964,7 @@
#if 0
if (dvmIsAbstractMethod(methodToCall)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
GOTO_exceptionThrown();
}
#else
diff --git a/vm/native/InternalNative.c b/vm/native/InternalNative.c
index c37f0bc..1376c31 100644
--- a/vm/native/InternalNative.c
+++ b/vm/native/InternalNative.c
@@ -144,8 +144,7 @@
void dvmAbstractMethodStub(const u4* args, JValue* pResult)
{
LOGD("--- called into dvmAbstractMethodStub\n");
- dvmThrowException("Ljava/lang/AbstractMethodError;",
- "abstract method not implemented");
+ dvmThrowAbstractMethodError("abstract method not implemented");
}
@@ -223,7 +222,7 @@
char* descriptor = NULL;
if (nameObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
goto bail;
}
name = dvmCreateCstrFromString(nameObj);
@@ -235,7 +234,7 @@
*/
if (!validateClassName(name)) {
LOGW("dvmFindClassByName rejecting '%s'\n", name);
- dvmThrowException("Ljava/lang/ClassNotFoundException;", name);
+ dvmThrowClassNotFoundException(name);
goto bail;
}
diff --git a/vm/native/dalvik_system_DexFile.c b/vm/native/dalvik_system_DexFile.c
index e15b432..cee7d17 100644
--- a/vm/native/dalvik_system_DexFile.c
+++ b/vm/native/dalvik_system_DexFile.c
@@ -93,8 +93,7 @@
hashcmpDexOrJar, false);
dvmHashTableUnlock(gDvm.userDexFiles);
if (result == NULL) {
- dvmThrowException("Ljava/lang/RuntimeException;",
- "invalid DexFile cookie");
+ dvmThrowRuntimeException("invalid DexFile cookie");
return false;
}
@@ -161,7 +160,7 @@
char* outputName;
if (sourceNameObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
@@ -194,7 +193,7 @@
*/
if (dvmClassPathContains(gDvm.bootClassPath, sourceName)) {
LOGW("Refusing to reopen boot DEX '%s'\n", sourceName);
- dvmThrowException("Ljava/io/IOException;",
+ dvmThrowIOException(
"Re-opening BOOTCLASSPATH DEX files is not allowed");
free(sourceName);
free(outputName);
@@ -223,7 +222,7 @@
pDexOrJar->pDexMemory = NULL;
} else {
LOGV("Unable to open DEX file '%s'\n", sourceName);
- dvmThrowException("Ljava/io/IOException;", "unable to open DEX file");
+ dvmThrowIOException("unable to open DEX file");
}
if (pDexOrJar != NULL) {
@@ -256,7 +255,7 @@
DexOrJar* pDexOrJar = NULL;
if (fileContentsObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
@@ -265,8 +264,7 @@
pBytes = (u1*) malloc(length);
if (pBytes == NULL) {
- dvmThrowException("Ljava/lang/RuntimeException;",
- "unable to allocate DEX memory");
+ dvmThrowRuntimeException("unable to allocate DEX memory");
RETURN_VOID();
}
@@ -275,8 +273,7 @@
if (dvmRawDexFileOpenArray(pBytes, length, &pRawDexFile) != 0) {
LOGV("Unable to open in-memory DEX file\n");
free(pBytes);
- dvmThrowException("Ljava/io/RuntimeException;",
- "unable to open in-memory DEX file");
+ dvmThrowRuntimeException("unable to open in-memory DEX file");
RETURN_VOID();
}
@@ -491,11 +488,11 @@
name = dvmCreateCstrFromString(nameObj);
if (name == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
if (access(name, R_OK) != 0) {
- dvmThrowException("Ljava/io/FileNotFoundException;", name);
+ dvmThrowFileNotFoundException(name);
free(name);
RETURN_VOID();
}
@@ -506,7 +503,7 @@
switch (status) {
default: //FALLTHROUGH
case DEX_CACHE_BAD_ARCHIVE:
- dvmThrowException("Ljava/io/IOException;", name);
+ dvmThrowIOException(name);
result = -1;
break;
case DEX_CACHE_OK:
diff --git a/vm/native/dalvik_system_VMDebug.c b/vm/native/dalvik_system_VMDebug.c
index 59fcb4c..78c12f8 100644
--- a/vm/native/dalvik_system_VMDebug.c
+++ b/vm/native/dalvik_system_VMDebug.c
@@ -40,15 +40,13 @@
InstField* field = dvmFindInstanceField(obj->clazz, "descriptor", "I");
if (field == NULL) {
- dvmThrowException("Ljava/lang/NoSuchFieldException;",
- "No FileDescriptor.descriptor field");
+ dvmThrowNoSuchFieldException("No FileDescriptor.descriptor field");
return -1;
}
int fd = dvmGetFieldInt(obj, field->byteOffset);
if (fd < 0) {
- dvmThrowExceptionFmt("Ljava/lang/RuntimeException;",
- "Invalid file descriptor");
+ dvmThrowRuntimeException("Invalid file descriptor");
return -1;
}
@@ -266,7 +264,7 @@
}
if (bufferSize < 1024) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;", NULL);
+ dvmThrowIllegalArgumentException(NULL);
RETURN_VOID();
}
@@ -525,7 +523,7 @@
* Only one of these may be NULL.
*/
if (fileNameStr == NULL && fileDescriptor == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
@@ -533,7 +531,7 @@
fileName = dvmCreateCstrFromString(fileNameStr);
if (fileName == NULL) {
/* unexpected -- malloc failure? */
- dvmThrowException("Ljava/lang/RuntimeException;", "malloc failure?");
+ dvmThrowRuntimeException("malloc failure?");
RETURN_VOID();
}
} else {
@@ -554,8 +552,8 @@
if (result != 0) {
/* ideally we'd throw something more specific based on actual failure */
- dvmThrowException("Ljava/lang/RuntimeException;",
- "Failure during heap dump -- check log output for details");
+ dvmThrowRuntimeException(
+ "Failure during heap dump; check log output for details");
RETURN_VOID();
}
@@ -576,8 +574,8 @@
if (result != 0) {
/* ideally we'd throw something more specific based on actual failure */
- dvmThrowException("Ljava/lang/RuntimeException;",
- "Failure during heap dump -- check log output for details");
+ dvmThrowRuntimeException(
+ "Failure during heap dump; check log output for details");
RETURN_VOID();
}
@@ -608,7 +606,7 @@
bool result = false;
if (classAndMethodDescStr == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
@@ -622,16 +620,14 @@
char* methodName = strchr(classAndMethodDesc, '.');
if (methodName == NULL) {
- dvmThrowException("Ljava/lang/RuntimeException;",
- "method name not found in string");
+ dvmThrowRuntimeException("method name not found in string");
RETURN_VOID();
}
*methodName++ = '\0';
char* methodDescr = strchr(methodName, ':');
if (methodDescr == NULL) {
- dvmThrowException("Ljava/lang/RuntimeException;",
- "method descriptor not found in string");
+ dvmThrowRuntimeException("method descriptor not found in string");
RETURN_VOID();
}
*methodDescr++ = '\0';
diff --git a/vm/native/dalvik_system_VMRuntime.c b/vm/native/dalvik_system_VMRuntime.c
index da529e4..402d607 100644
--- a/vm/native/dalvik_system_VMRuntime.c
+++ b/vm/native/dalvik_system_VMRuntime.c
@@ -118,11 +118,11 @@
ArrayObject* newArray;
if (elementClass == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
RETURN_VOID();
}
@@ -144,7 +144,7 @@
{
ArrayObject* array = (ArrayObject*) args[1];
if (!dvmIsArray(array)) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;", NULL);
+ dvmThrowIllegalArgumentException(NULL);
RETURN_VOID();
}
// TODO: we should also check that this is a non-movable array.
diff --git a/vm/native/dalvik_system_VMStack.c b/vm/native/dalvik_system_VMStack.c
index 8db4a6b..746970f 100644
--- a/vm/native/dalvik_system_VMStack.c
+++ b/vm/native/dalvik_system_VMStack.c
@@ -95,7 +95,7 @@
&methodCount))
{
LOGE("Failed to create stack trace array\n");
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
RETURN_VOID();
}
diff --git a/vm/native/dalvik_system_Zygote.c b/vm/native/dalvik_system_Zygote.c
index 0747376..905eb9a 100644
--- a/vm/native/dalvik_system_Zygote.c
+++ b/vm/native/dalvik_system_Zygote.c
@@ -227,7 +227,7 @@
pid_t pid;
if (!gDvm.zygote) {
- dvmThrowException("Ljava/lang/IllegalStateException;",
+ dvmThrowIllegalStateException(
"VM instance not started with -Xzygote");
RETURN_VOID();
@@ -380,7 +380,7 @@
}
if (!gDvm.zygote) {
- dvmThrowException("Ljava/lang/IllegalStateException;",
+ dvmThrowIllegalStateException(
"VM instance not started with -Xzygote");
return -1;
diff --git a/vm/native/java_lang_Class.c b/vm/native/java_lang_Class.c
index 3bb6885..bf9c1cb 100644
--- a/vm/native/java_lang_Class.c
+++ b/vm/native/java_lang_Class.c
@@ -409,7 +409,7 @@
ClassObject* testClass = (ClassObject*) args[1];
if (testClass == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_INT(false);
}
RETURN_INT(dvmInstanceof(testClass, thisPtr));
@@ -512,15 +512,13 @@
if (!dvmCheckClassAccess(callerClass, clazz)) {
LOGD("newInstance failed: %s not accessible to %s\n",
clazz->descriptor, callerClass->descriptor);
- dvmThrowException("Ljava/lang/IllegalAccessException;",
- "access to class not allowed");
+ dvmThrowIllegalAccessException("access to class not allowed");
RETURN_VOID();
}
if (!dvmCheckMethodAccess(callerClass, init)) {
LOGD("newInstance failed: %s.<init>() not accessible to %s\n",
clazz->descriptor, callerClass->descriptor);
- dvmThrowException("Ljava/lang/IllegalAccessException;",
- "access to constructor not allowed");
+ dvmThrowIllegalAccessException("access to constructor not allowed");
RETURN_VOID();
}
@@ -625,8 +623,7 @@
static void Dalvik_java_lang_Class_getGenericInterfaces(const u4* args,
JValue* pResult)
{
- dvmThrowException("Ljava/lang/UnsupportedOperationException;",
- "native method not implemented");
+ dvmThrowUnsupportedOperationException("native method not implemented");
RETURN_PTR(NULL);
}
@@ -634,8 +631,7 @@
static void Dalvik_java_lang_Class_getGenericSuperclass(const u4* args,
JValue* pResult)
{
- dvmThrowException("Ljava/lang/UnsupportedOperationException;",
- "native method not implemented");
+ dvmThrowUnsupportedOperationException("native method not implemented");
RETURN_PTR(NULL);
}
@@ -643,8 +639,7 @@
static void Dalvik_java_lang_Class_getTypeParameters(const u4* args,
JValue* pResult)
{
- dvmThrowException("Ljava/lang/UnsupportedOperationException;",
- "native method not implemented");
+ dvmThrowUnsupportedOperationException("native method not implemented");
RETURN_PTR(NULL);
}
diff --git a/vm/native/java_lang_System.c b/vm/native/java_lang_System.c
index e9d8a48..369caf1 100644
--- a/vm/native/java_lang_System.c
+++ b/vm/native/java_lang_System.c
@@ -129,7 +129,7 @@
/* check for null pointer */
if ((Object*)srcArray == NULL || (Object*)dstArray == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
assert(dvmCheckException(dvmThreadSelf()));
RETURN_VOID();
}
@@ -355,7 +355,7 @@
char* mappedName;
if (nameObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
diff --git a/vm/native/java_lang_VMClassLoader.c b/vm/native/java_lang_VMClassLoader.c
index e8dbc6e..1cbe6e2 100644
--- a/vm/native/java_lang_VMClassLoader.c
+++ b/vm/native/java_lang_VMClassLoader.c
@@ -42,7 +42,7 @@
name = dvmCreateCstrFromString(nameObj);
LOGE("ERROR: defineClass(%p, %s, %p, %d, %d, %p)\n",
loader, name, data, offset, len, pd);
- dvmThrowException("Ljava/lang/UnsupportedOperationException;",
+ dvmThrowUnsupportedOperationException(
"can't load this type of class file");
free(name);
@@ -68,7 +68,7 @@
LOGE("ERROR: defineClass(%p, %p, %d, %d, %p)\n",
loader, data, offset, len, pd);
- dvmThrowException("Ljava/lang/UnsupportedOperationException;",
+ dvmThrowUnsupportedOperationException(
"can't load this type of class file");
RETURN_VOID();
@@ -87,7 +87,7 @@
char* descriptor = NULL;
if (nameObj == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
goto bail;
}
diff --git a/vm/native/java_lang_VMThread.c b/vm/native/java_lang_VMThread.c
index 3b7331b..0a02020 100644
--- a/vm/native/java_lang_VMThread.c
+++ b/vm/native/java_lang_VMThread.c
@@ -85,7 +85,7 @@
Thread* thread;
if (object == NULL) {
- dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ dvmThrowNullPointerException(NULL);
RETURN_VOID();
}
diff --git a/vm/native/java_lang_reflect_Array.c b/vm/native/java_lang_reflect_Array.c
index e7713f6..275e826 100644
--- a/vm/native/java_lang_reflect_Array.c
+++ b/vm/native/java_lang_reflect_Array.c
@@ -36,7 +36,7 @@
assert(elementClass != NULL); // tested by caller
if (length < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
RETURN_VOID();
}
@@ -91,7 +91,7 @@
dimensions = (int*) dimArray->contents;
for (i = 0; i < numDim; i++) {
if (dimensions[i] < 0) {
- dvmThrowException("Ljava/lang/NegativeArraySizeException;", NULL);
+ dvmThrowNegativeArraySizeException(NULL);
RETURN_VOID();
}
LOGVV("DIM %d: %d\n", i, dimensions[i]);
diff --git a/vm/native/java_lang_reflect_Field.c b/vm/native/java_lang_reflect_Field.c
index 9b368ce..2713d8c 100644
--- a/vm/native/java_lang_reflect_Field.c
+++ b/vm/native/java_lang_reflect_Field.c
@@ -66,8 +66,7 @@
/* verify access */
if (!noAccessCheck) {
if (isSetOperation && dvmIsFinalField(field)) {
- dvmThrowException("Ljava/lang/IllegalAccessException;",
- "field is marked 'final'");
+ dvmThrowIllegalAccessException("field is marked 'final'");
return NULL;
}
@@ -86,8 +85,7 @@
* in arbitrary Foo objects from other packages.
*/
if (!dvmCheckFieldAccess(callerClass, field)) {
- dvmThrowException("Ljava/lang/IllegalAccessException;",
- "access to field not allowed");
+ dvmThrowIllegalAccessException("access to field not allowed");
return NULL;
}
if (dvmIsProtectedField(field)) {
@@ -100,7 +98,7 @@
samePackage = dvmInSamePackage(declaringClass, callerClass);
if (!isInstance && !samePackage) {
- dvmThrowException("Ljava/lang/IllegalAccessException;",
+ dvmThrowIllegalAccessException(
"access to protected field not allowed");
return NULL;
}
@@ -503,8 +501,7 @@
/* unbox primitive, or verify object type */
if (!dvmUnboxPrimitive(valueObj, fieldType, &value)) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "invalid value for field");
+ dvmThrowIllegalArgumentException("invalid value for field");
RETURN_VOID();
}
@@ -554,8 +551,7 @@
JValue value;
if (!dvmIsPrimitiveClass(fieldType)) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "not a primitive field");
+ dvmThrowIllegalArgumentException("not a primitive field");
RETURN_VOID();
}
@@ -570,8 +566,7 @@
if (dvmConvertPrimitiveValue(fieldType->primitiveType, targetType,
&(value.i), &(pResult->i)) < 0)
{
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "invalid primitive conversion");
+ dvmThrowIllegalArgumentException("invalid primitive conversion");
RETURN_VOID();
}
}
@@ -599,8 +594,7 @@
JValue value;
if (!dvmIsPrimitiveClass(fieldType)) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "not a primitive field");
+ dvmThrowIllegalArgumentException("not a primitive field");
RETURN_VOID();
}
@@ -608,8 +602,7 @@
if (dvmConvertPrimitiveValue(srcType, fieldType->primitiveType,
valuePtr, &(value.i)) < 0)
{
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "invalid primitive conversion");
+ dvmThrowIllegalArgumentException("invalid primitive conversion");
RETURN_VOID();
}
diff --git a/vm/native/java_security_AccessController.c b/vm/native/java_security_AccessController.c
index 378fb94..af7d5d0 100644
--- a/vm/native/java_security_AccessController.c
+++ b/vm/native/java_security_AccessController.c
@@ -42,7 +42,7 @@
if (!dvmCreateStackTraceArray(dvmThreadSelf()->curFrame, &methods, &length))
{
LOGE("Failed to create stack trace array\n");
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
RETURN_VOID();
}
@@ -70,7 +70,7 @@
if (subSet == NULL) {
LOGE("Failed to allocate subSet (length=%d)\n", length);
free(methods);
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
RETURN_VOID();
}
int idx, subIdx = 0;
diff --git a/vm/oo/Array.c b/vm/oo/Array.c
index 18b6581..0fa0f80 100644
--- a/vm/oo/Array.c
+++ b/vm/oo/Array.c
@@ -462,7 +462,7 @@
LOGE("Unable to create array class '%s': missing interfaces\n",
descriptor);
dvmFreeClassInnards(newClass);
- dvmThrowException("Ljava/lang/InternalError;", "missing array ifaces");
+ dvmThrowInternalError("missing array ifaces");
dvmReleaseTrackedAlloc((Object*) newClass, NULL);
return NULL;
}
diff --git a/vm/oo/Class.c b/vm/oo/Class.c
index 2455e41..82d41c6 100644
--- a/vm/oo/Class.c
+++ b/vm/oo/Class.c
@@ -1262,7 +1262,7 @@
/* convert "Landroid/debug/Stuff;" to "android.debug.Stuff" */
dotName = dvmDescriptorToDot(descriptor);
if (dotName == NULL) {
- dvmThrowException("Ljava/lang/OutOfMemoryError;", NULL);
+ dvmThrowOutOfMemoryError(NULL);
goto bail;
}
nameObj = dvmCreateStringFromCstr(dotName);
@@ -1303,8 +1303,7 @@
goto bail;
} else if (clazz == NULL) {
LOGW("ClassLoader returned NULL w/o exception pending\n");
- dvmThrowException("Ljava/lang/NullPointerException;",
- "ClassLoader returned null");
+ dvmThrowNullPointerException("ClassLoader returned null");
goto bail;
}
@@ -1441,8 +1440,7 @@
dvmSetException(self, gDvm.noClassDefFoundErrorObj);
} else {
/* dexopt case -- can't guarantee prefab (core.jar) */
- dvmThrowExceptionWithClassMessage(
- "Ljava/lang/NoClassDefFoundError;", descriptor);
+ dvmThrowNoClassDefFoundError(descriptor);
}
goto bail;
}
@@ -2565,8 +2563,7 @@
dvmLinearReadOnly(clazz->classLoader, clazz->interfaces);
LOGW("Interface '%s' is not accessible to '%s'\n",
clazz->interfaces[i]->descriptor, clazz->descriptor);
- dvmThrowException("Ljava/lang/IllegalAccessError;",
- "interface not accessible");
+ dvmThrowIllegalAccessError("interface not accessible");
goto bail;
}
LOGVV("+++ found interface '%s'\n",
@@ -2622,8 +2619,7 @@
} else if (!dvmCheckClassAccess(clazz, clazz->super)) {
LOGW("Superclass of '%s' (%s) is not accessible\n",
clazz->descriptor, clazz->super->descriptor);
- dvmThrowException("Ljava/lang/IllegalAccessError;",
- "superclass not accessible");
+ dvmThrowIllegalAccessError("superclass not accessible");
goto bail;
}
@@ -2746,7 +2742,7 @@
if (strcmp(clazz->descriptor, "Ljava/lang/ref/Reference;") == 0) {
if (!precacheReferenceOffsets(clazz)) {
LOGE("failed pre-caching Reference offsets\n");
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
goto bail;
}
} else if (clazz == gDvm.classJavaLangClass) {
@@ -3191,7 +3187,7 @@
if (!dvmIsPublicMethod(clazz->vtable[j])) {
LOGW("Implementation of %s.%s is not public\n",
clazz->descriptor, clazz->vtable[j]->name);
- dvmThrowException("Ljava/lang/IllegalAccessError;",
+ dvmThrowIllegalAccessError(
"interface implementation not public");
goto bail;
}
@@ -3207,7 +3203,7 @@
imeth->name, desc, clazz->descriptor);
free(desc);
}
- //dvmThrowException("Ljava/lang/RuntimeException;", "Miranda!");
+ //dvmThrowRuntimeException("Miranda!");
//return false;
if (mirandaCount == mirandaAlloc) {
@@ -3785,8 +3781,7 @@
clazz->descriptor, clazz->verifyErrorClass);
if (clazz->verifyErrorClass == NULL) {
- dvmThrowExceptionWithClassMessage("Ljava/lang/NoClassDefFoundError;",
- clazz->descriptor);
+ dvmThrowNoClassDefFoundError(clazz->descriptor);
} else {
dvmThrowExceptionByClassWithClassMessage(clazz->verifyErrorClass,
clazz->descriptor);
diff --git a/vm/oo/Object.c b/vm/oo/Object.c
index cca6806..96fdc1b 100644
--- a/vm/oo/Object.c
+++ b/vm/oo/Object.c
@@ -713,7 +713,7 @@
* Make sure there's code to execute.
*/
if (dvmIsAbstractMethod(actualMeth)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;", NULL);
+ dvmThrowAbstractMethodError(NULL);
return NULL;
}
assert(!dvmIsMirandaMethod(actualMeth));
diff --git a/vm/oo/Resolve.c b/vm/oo/Resolve.c
index b277576..f3efb69 100644
--- a/vm/oo/Resolve.c
+++ b/vm/oo/Resolve.c
@@ -133,7 +133,7 @@
resClassCheck->classLoader, resClassCheck->pDvmDex);
LOGW("(%s had used a different %s during pre-verification)\n",
referrer->descriptor, resClass->descriptor);
- dvmThrowException("Ljava/lang/IllegalAccessError;",
+ dvmThrowIllegalAccessError(
"Class ref in pre-verified class resolved to unexpected "
"implementation");
return NULL;
@@ -220,7 +220,7 @@
}
if (resMethod == NULL) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", name);
+ dvmThrowNoSuchMethodError(name);
return NULL;
}
@@ -229,7 +229,7 @@
/* see if this is a pure-abstract method */
if (dvmIsAbstractMethod(resMethod) && !dvmIsAbstractClass(resClass)) {
- dvmThrowException("Ljava/lang/AbstractMethodError;", name);
+ dvmThrowAbstractMethodError(name);
return NULL;
}
@@ -339,7 +339,7 @@
methodName, methodSig, resClass->descriptor);
resMethod = dvmFindInterfaceMethodHier(resClass, methodName, &proto);
if (resMethod == NULL) {
- dvmThrowException("Ljava/lang/NoSuchMethodError;", methodName);
+ dvmThrowNoSuchMethodError(methodName);
return NULL;
}
@@ -406,7 +406,7 @@
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
- dvmThrowException("Ljava/lang/NoSuchFieldError;",
+ dvmThrowNoSuchFieldError(
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
return NULL;
}
@@ -465,7 +465,7 @@
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
- dvmThrowException("Ljava/lang/NoSuchFieldError;",
+ dvmThrowNoSuchFieldError(
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
return NULL;
}
diff --git a/vm/reflect/Annotation.c b/vm/reflect/Annotation.c
index 54d92a2..3cfd479 100644
--- a/vm/reflect/Annotation.c
+++ b/vm/reflect/Annotation.c
@@ -875,8 +875,7 @@
*pPtr = ptr;
if (newAnno == NULL && !dvmCheckException(self)) {
/* make sure an exception is raised */
- dvmThrowException("Ljava/lang/RuntimeException;",
- "failure in processEncodedAnnotation");
+ dvmThrowRuntimeException("failure in processEncodedAnnotation");
}
return newAnno;
}
diff --git a/vm/reflect/Proxy.c b/vm/reflect/Proxy.c
index 03c9982..3dfc3ea 100644
--- a/vm/reflect/Proxy.c
+++ b/vm/reflect/Proxy.c
@@ -139,8 +139,7 @@
nameStr = dvmCreateCstrFromString(str);
if (nameStr == NULL) {
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
- "missing name");
+ dvmThrowIllegalArgumentException("missing name");
goto bail;
}
@@ -274,7 +273,7 @@
newClass = NULL;
if (!dvmCheckException(dvmThreadSelf())) {
/* throw something */
- dvmThrowException("Ljava/lang/RuntimeException;", NULL);
+ dvmThrowRuntimeException(NULL);
}
}
@@ -603,7 +602,7 @@
if (allMethods[i] != NULL) {
LOGV("BAD DUPE: %d %s.%s\n", i,
allMethods[i]->clazz->descriptor, allMethods[i]->name);
- dvmThrowException("Ljava/lang/IllegalArgumentException;",
+ dvmThrowIllegalArgumentException(
"incompatible return types in proxied interfaces");
return -1;
}
@@ -1035,7 +1034,7 @@
LOGVV("+++ ignoring return to void\n");
} else if (invokeResult.l == NULL) {
if (dvmIsPrimitiveClass(returnType)) {
- dvmThrowException("Ljava/lang/NullPointerException;",
+ dvmThrowNullPointerException(
"null result when primitive expected");
goto bail;
}
diff --git a/vm/reflect/Reflect.c b/vm/reflect/Reflect.c
index c490b43..f0177a7 100644
--- a/vm/reflect/Reflect.c
+++ b/vm/reflect/Reflect.c
@@ -1152,7 +1152,7 @@
char* desc = dexProtoCopyMethodDescriptor(&meth->prototype);
LOGE("Bad return type in signature '%s'\n", desc);
free(desc);
- dvmThrowException("Ljava/lang/InternalError;", NULL);
+ dvmThrowInternalError(NULL);
return NULL;
}
}