Changes: Edwin Steiner
- $Id: exceptions.c 5088 2006-07-08 20:16:05Z twisti $
+ $Id: exceptions.c 5586 2006-09-29 14:21:42Z edwin $
*/
}
-/* new_verifyerror *************************************************************
+/* exceptions_new_verifyerror **************************************************
Generates a java.lang.VerifyError for the JIT compiler.
*******************************************************************************/
-java_objectheader *new_verifyerror(methodinfo *m, const char *message, ...)
+java_objectheader *exceptions_new_verifyerror(methodinfo *m,
+ const char *message, ...)
{
java_objectheader *o;
va_list ap;
}
+/* exceptions_throw_verifyerror ************************************************
+
+ Throws a java.lang.VerifyError for the VM system.
+
+*******************************************************************************/
+
+void exceptions_throw_verifyerror(methodinfo *m, const char *message, ...)
+{
+ *exceptionptr = exceptions_new_verifyerror(m, message);
+}
+
+
/* exceptions_throw_verifyerror_for_stack **************************************
throws a java.lang.VerifyError for an invalid stack slot type
case TYPE_FLT: typename = "float"; break;
case TYPE_DBL: typename = "double"; break;
case TYPE_ADR: typename = "object/array"; break;
+ case TYPE_RET: typename = "returnAddress"; break;
default: typename = "<INVALID>"; assert(0); break;
}
strcat(msg, typename);
}
-/* new_arraystoreexception *****************************************************
+/* exceptions_new_arraystoreexception ******************************************
- generates a java.lang.ArrayStoreException for the jit compiler
+ Generates a java.lang.ArrayStoreException for the VM compiler.
*******************************************************************************/
-java_objectheader *new_arraystoreexception(void)
+java_objectheader *exceptions_new_arraystoreexception(void)
{
java_objectheader *e;
}
+/* exceptions_throw_arraystoreexception ****************************************
+
+ Generates a java.lang.ArrayStoreException for the VM system and
+ throw it in the VM system.
+
+*******************************************************************************/
+
+void exceptions_throw_arraystoreexception(void)
+{
+ *exceptionptr = exceptions_new_arraystoreexception();
+}
+
+
/* exceptions_new_classcastexception *******************************************
Generates a java.lang.ClassCastException for the JIT compiler.
}
-/* new_illegalmonitorstateexception ********************************************
+/* exceptions_new_illegalmonitorstateexception *********************************
Generates a java.lang.IllegalMonitorStateException for the VM
thread system.
*******************************************************************************/
-java_objectheader *new_illegalmonitorstateexception(void)
+java_objectheader *exceptions_new_illegalmonitorstateexception(void)
{
java_objectheader *e;
e = native_new_and_init(class_java_lang_IllegalMonitorStateException);
- if (!e)
+ if (e == NULL)
return *exceptionptr;
return e;
}
+/* exceptions_throw_illegalmonitorstateexception *******************************
+
+ Generates a java.lang.IllegalMonitorStateException for the VM
+ system and throw it in the VM system.
+
+*******************************************************************************/
+
+void exceptions_throw_illegalmonitorstateexception(void)
+{
+ *exceptionptr = exceptions_new_illegalmonitorstateexception();
+}
+
+
/* exceptions_new_negativearraysizeexception ***********************************
Generates a java.lang.NegativeArraySizeException for the VM system.
/* resolve or load/link the exception class */
if (IS_CLASSREF(cr)) {
+ /* The exception class reference is unresolved. */
+ /* We have to do _eager_ resolving here. While the class of */
+ /* the exception object is guaranteed to be loaded, it may */
+ /* well have been loaded by a different loader than the */
+ /* defining loader of m's class, which is the one we must */
+ /* use to resolve the catch class. Thus lazy resolving */
+ /* might fail, even if the result of the resolution would */
+ /* be an already loaded class. */
+
c = resolve_classref_eager(cr.ref);
+ if (c == NULL) {
+ /* Exception resolving the exception class, argh! */
+ return NULL;
+ }
+
+ /* Ok, we resolved it. Enter it in the table, so we don't */
+ /* have to do this again. */
+ /* XXX this write should be atomic. Is it? */
+
+ ex->catchtype.cls = c;
} else {
c = cr.cls;
+ /* XXX I don't think this case can ever happen. -Edwin */
if (!(c->state & CLASS_LOADED))
/* use the methods' classloader */
if (!load_class_from_classloader(c->name,
m->class->classloader))
return NULL;
+ /* XXX I think, if it is not linked, we can be sure that */
+ /* the exception object is no (indirect) instance of it, no? */
+ /* -Edwin */
if (!(c->state & CLASS_LINKED))
if (!link_class(c))
return NULL;
assert(o != NULL);
- builtin_monitorexit(o);
+ lock_monitor_exit(o);
}
#endif