Changes:
- $Id: asmpart.c 4559 2006-03-05 23:24:50Z twisti $
+ $Id: asmpart.c 5668 2006-10-04 16:01:53Z edwin $
*/
case TYPE_INT:
case TYPE_FLT:
case TYPE_ADR:
- *(--sp) = vmargs[i].data;
+ *(--sp) = (Cell) vmargs[i].data.l;
break;
case TYPE_LNG:
case TYPE_DBL:
sp -= 2;
- *((u8 *) sp) = vmargs[i].data;
+ *((u8 *) sp) = vmargs[i].data.l;
break;
}
}
Inst *intrp_asm_handle_exception(Inst *ip, java_objectheader *o, Cell *fp, Cell **new_spp, Cell **new_fpp)
{
- classinfo *c;
- s4 framesize;
- exceptionentry *ex;
- s4 exceptiontablelength;
- s4 i;
+ classinfo *c;
+ classref_or_classinfo cr;
+ s4 framesize;
+ exceptionentry *ex;
+ s4 exceptiontablelength;
+ s4 i;
/* for a description of the stack see IRETURN in java.vmg */
for (; fp != NULL; ) {
- u1 *f = codegen_findmethod((u1 *) (ip - 1));
+ u1 *f = codegen_get_pv_from_pc((u1 *) (ip - 1));
/* get methodinfo pointer from method header */
- methodinfo *m = *(methodinfo **) (((u1 *) f) + MethodPointer);
+ codeinfo *code = *((codeinfo **) ((u1 *)f + CodeinfoPointer));
+ methodinfo *m = code->m;
- framesize = (*((s4 *) (((u1 *) f) + FrameSize)));
- ex = (exceptionentry *) (((u1 *) f) + ExTableStart);
- exceptiontablelength = *((s4 *) (((u1 *) f) + ExTableSize));
+ framesize = *((s4 *) (((u1 *) f) + FrameSize));
+ ex = (exceptionentry *) (((u1 *) f) + ExTableStart);
+ exceptiontablelength = *((s4 *) (((u1 *) f) + ExTableSize));
+#if !defined(NDEBUG)
if (opt_verbose || opt_verbosecall || opt_verboseexception)
builtin_trace_exception(o, m, ip, 1);
+#endif
for (i = 0; i < exceptiontablelength; i++) {
ex--;
- c = ex->catchtype.cls;
- if (c != NULL) {
- if (!(c->state & CLASS_LOADED))
- /* XXX fix me! */
- if (!load_class_bootstrap(c->name))
- assert(0);
+ cr = ex->catchtype;
+
+ if (cr.any != NULL) {
+ 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. */
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
+ c = resolve_classref_eager(cr.ref);
+
+ if (c == NULL) {
+ /* Exception resolving the exception class, argh! */
+ /* XXX how to report that error? */
assert(0);
+ }
+
+ /* 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;
+
+ /* If the class is not linked, the exception object cannot */
+ /* be an instance of it. */
+ if (!(c->state & CLASS_LINKED))
+ continue;
+ }
}
if (ip-1 >= (Inst *) ex->startpc && ip-1 < (Inst *) ex->endpc &&
{
s4 sbv, sdv, sv;
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
compiler_lock();
-#else
- intsDisable();
-#endif
#endif
sbv = super->baseval;
sdv = super->diffval;
sv = sub->baseval;
-#if defined(USE_THREADS)
-#if defined(NATIVE_THREADS)
+#if defined(ENABLE_THREADS)
compiler_unlock();
-#else
- intsRestore();
-#endif
#endif
out->super_baseval = sbv;