Changes:
- $Id: helper.c 2266 2005-04-11 10:00:51Z twisti $
+ $Id: helper.c 2284 2005-04-12 20:31:38Z twisti $
*/
/* resolve and load the class */
- if (!resolve_classref(NULL, cr, resolveEager, true, &c))
+ if (!resolve_classref(NULL, cr, resolveEager, true, &c)) {
+ java_objectheader *xptr;
+ java_objectheader *cause;
+
+ /* get the cause */
+
+ cause = *exceptionptr;
+
+ /* convert ClassNotFoundException's to NoClassDefFoundError's */
+
+ if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
+ /* clear exception, because we are calling jit code again */
+
+ *exceptionptr = NULL;
+
+ /* create new error */
+
+ xptr =
+ new_exception_javastring(string_java_lang_NoClassDefFoundError,
+ ((java_lang_Throwable *) cause)->detailMessage);
+
+ /* we had an exception while creating the error */
+
+ if (*exceptionptr)
+ return NULL;
+
+ /* set new exception */
+
+ *exceptionptr = xptr;
+ }
+
return NULL;
+ }
/* return the classinfo pointer */
/* resolve and load the class */
- if (!resolve_classref(NULL, cr, resolveEager, true, &c))
+ if (!(c = helper_resolve_classinfo(cr)))
return -1;
/* return the flags */
{
classinfo *c;
- /* resolve the method */
+ /* resolve and load the class */
- if (!resolve_classref(NULL, cr, resolveEager, true, &c))
+ if (!(c = helper_resolve_classinfo(cr)))
return NULL;
/* return the virtual function table pointer */
/* resolve and load the class */
- if (!resolve_classref(NULL, cr, resolveEager, true, &c))
+ if (!(c = helper_resolve_classinfo(cr)))
return -1;
/* return the class' index */
/* resolve the method */
- if (!resolve_method(um, resolveEager, &m))
+ if (!resolve_method(um, resolveEager, &m)) {
+ java_objectheader *xptr;
+ java_objectheader *cause;
+
+ /* get the cause */
+
+ cause = *exceptionptr;
+
+ /* convert ClassNotFoundException's to NoClassDefFoundError's */
+
+ if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
+ /* clear exception, because we are calling jit code again */
+
+ *exceptionptr = NULL;
+
+ /* create new error */
+
+ xptr =
+ new_exception_javastring(string_java_lang_NoClassDefFoundError,
+ ((java_lang_Throwable *) cause)->detailMessage);
+
+ /* we had an exception while creating the error */
+
+ if (*exceptionptr)
+ return NULL;
+
+ /* set new exception */
+
+ *exceptionptr = xptr;
+ }
+
return NULL;
+ }
/* return the methodinfo pointer */
/* resolve the method */
- if (!resolve_method(um, resolveEager, &m))
+ if (!(m = helper_resolve_methodinfo(um)))
return -1;
/* return the virtual function table index */
/* resolve the method */
- if (!resolve_method(um, resolveEager, &m))
+ if (!(m = helper_resolve_methodinfo(um)))
return NULL;
/* return the method pointer */
}
+/* helper_resolve_fieldinfo ****************************************************
+
+ This function returns the fieldinfo pointer of the passed field.
+
+*******************************************************************************/
+
+static void *helper_resolve_fieldinfo(unresolved_field *uf)
+{
+ fieldinfo *fi;
+
+ /* resolve the field */
+
+ if (!resolve_field(uf, resolveEager, &fi)) {
+ java_objectheader *xptr;
+ java_objectheader *cause;
+
+ /* get the cause */
+
+ cause = *exceptionptr;
+
+ /* convert ClassNotFoundException's to NoClassDefFoundError's */
+
+ if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
+ /* clear exception, because we are calling jit code again */
+
+ *exceptionptr = NULL;
+
+ /* create new error */
+
+ xptr =
+ new_exception_javastring(string_java_lang_NoClassDefFoundError,
+ ((java_lang_Throwable *) cause)->detailMessage);
+
+ /* we had an exception while creating the error */
+
+ if (*exceptionptr)
+ return NULL;
+
+ /* set new exception */
+
+ *exceptionptr = xptr;
+ }
+
+ return NULL;
+ }
+
+ /* return the fieldinfo pointer */
+
+ return fi;
+}
+
+
/* helper_resolve_fieldinfo_value_address **************************************
This function returns the value address of the passed field.
/* resolve the field */
- if (!resolve_field(uf, resolveEager, &fi))
+ if (!(fi = helper_resolve_fieldinfo(uf)))
return NULL;
/* check if class is initialized */
/* resolve the field */
- if (!resolve_field(uf, resolveEager, &fi))
+ if (!(fi = helper_resolve_fieldinfo(uf)))
return -1;
/* return the field value's offset */