Example #1
0
bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
    // bootstrapping check
    if (!Universe::is_fully_initialized()) {
        vm_exit_during_initialization(h_exception);
        ShouldNotReachHere();
    }

#ifdef ASSERT
    // Check for trying to throw stack overflow before initialization is complete
    // to prevent infinite recursion trying to initialize stack overflow without
    // adequate stack space.
    // This can happen with stress testing a large value of StackShadowPages
    if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
        InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
        assert(ik->is_initialized(),
               "need to increase min_stack_allowed calculation");
    }
#endif // ASSERT

    if (thread->is_VM_thread()
            || thread->is_Compiler_thread() ) {
        // We do not care what kind of exception we get for the vm-thread or a thread which
        // is compiling.  We just install a dummy exception object
        thread->set_pending_exception(Universe::vm_exception(), file, line);
        return true;
    }

    return false;
}
Example #2
0
void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) {
  assert(method->name() == vmSymbols::object_initializer_name(),    "Should only be called for default constructor");
  assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor");

  InstanceKlass* ik = method->method_holder();
  if (ik->is_initialized() && ik->has_vanilla_constructor()) {
    // safe to skip constructor call
  } else {
    static JavaValue result(T_VOID);
    JavaCallArguments args(receiver);
    call(&result, method, &args, CHECK);
  }
}