public final Object callDirect(Object... args) {
   compilationProfile.reportDirectCall();
   profileArguments(args);
   try {
     Object result = doInvoke(args);
     Class<?> klass = profiledReturnType;
     if (klass != null
         && CompilerDirectives.inCompiledCode()
         && profiledReturnTypeAssumption.isValid()) {
       result = unsafeCast(result, klass, true, true);
     }
     return result;
   } catch (Throwable t) {
     t = exceptionProfile.profile(t);
     if (t instanceof RuntimeException) {
       throw (RuntimeException) t;
     } else if (t instanceof Error) {
       throw (Error) t;
     } else {
       CompilerDirectives.transferToInterpreter();
       throw new RuntimeException(t);
     }
   }
 }