void clearException() { ExecEnv *ee = getExecEnv(); if(ee->overflow) { ee->overflow = FALSE; ee->stack_end -= STACK_RED_ZONE_SIZE; } ee->exception = NULL; }
Class *getCallerCallerClass() { Frame *last = getExecEnv()->last_frame->prev; if((last->mb == NULL && (last = last->prev)->prev == NULL) || (last = getCallerFrame(last)) == NULL) return NULL; return last->mb->class; }
void printException() { ExecEnv *ee = getExecEnv(); Object *exception = ee->exception; if(exception != NULL) { MethodBlock *mb = lookupMethod(exception->class, SYMBOL(printStackTrace), SYMBOL(___V)); clearException(); executeMethod(exception, mb); /* If we're really low on memory we might have been able to throw * OutOfMemory, but then been unable to print any part of it! In * this case the VM just seems to stop... */ if(ee->exception) { jam_fprintf(stderr, "Exception occurred while printing exception (%s)...\n", CLASS_CB(ee->exception->class)->name); jam_fprintf(stderr, "Original exception was %s\n", CLASS_CB(exception->class)->name); }
void setException(Object *exp) { getExecEnv()->exception = exp; }
Object *exceptionOccurred() { return getExecEnv()->exception; }