コード例 #1
0
 public DeoptimizationReason convertDeoptReason(int reason) {
   HotSpotVMConfig config = runtime.getConfig();
   if (reason == config.deoptReasonNone) {
     return DeoptimizationReason.None;
   }
   if (reason == config.deoptReasonNullCheck) {
     return DeoptimizationReason.NullCheckException;
   }
   if (reason == config.deoptReasonRangeCheck) {
     return DeoptimizationReason.BoundsCheckException;
   }
   if (reason == config.deoptReasonClassCheck) {
     return DeoptimizationReason.ClassCastException;
   }
   if (reason == config.deoptReasonArrayCheck) {
     return DeoptimizationReason.ArrayStoreException;
   }
   if (reason == config.deoptReasonUnreached0) {
     return DeoptimizationReason.UnreachedCode;
   }
   if (reason == config.deoptReasonTypeCheckInlining) {
     return DeoptimizationReason.TypeCheckedInliningViolated;
   }
   if (reason == config.deoptReasonOptimizedTypeCheck) {
     return DeoptimizationReason.OptimizedTypeCheckViolated;
   }
   if (reason == config.deoptReasonNotCompiledExceptionHandler) {
     return DeoptimizationReason.NotCompiledExceptionHandler;
   }
   if (reason == config.deoptReasonUnresolved) {
     return DeoptimizationReason.Unresolved;
   }
   if (reason == config.deoptReasonJsrMismatch) {
     return DeoptimizationReason.JavaSubroutineMismatch;
   }
   if (reason == config.deoptReasonDiv0Check) {
     return DeoptimizationReason.ArithmeticException;
   }
   if (reason == config.deoptReasonConstraint) {
     return DeoptimizationReason.RuntimeConstraint;
   }
   if (reason == config.deoptReasonLoopLimitCheck) {
     return DeoptimizationReason.LoopLimitCheck;
   }
   if (reason == config.deoptReasonAliasing) {
     return DeoptimizationReason.Aliasing;
   }
   if (reason == config.deoptReasonTransferToInterpreter) {
     return DeoptimizationReason.TransferToInterpreter;
   }
   throw GraalInternalError.shouldNotReachHere(Integer.toHexString(reason));
 }
コード例 #2
0
 public int convertDeoptAction(DeoptimizationAction action) {
   HotSpotVMConfig config = runtime.getConfig();
   switch (action) {
     case None:
       return config.deoptActionNone;
     case RecompileIfTooManyDeopts:
       return config.deoptActionMaybeRecompile;
     case InvalidateReprofile:
       return config.deoptActionReinterpret;
     case InvalidateRecompile:
       return config.deoptActionMakeNotEntrant;
     case InvalidateStopCompiling:
       return config.deoptActionMakeNotCompilable;
     default:
       throw GraalInternalError.shouldNotReachHere();
   }
 }
コード例 #3
0
 public DeoptimizationAction convertDeoptAction(int action) {
   HotSpotVMConfig config = runtime.getConfig();
   if (action == config.deoptActionNone) {
     return DeoptimizationAction.None;
   }
   if (action == config.deoptActionMaybeRecompile) {
     return DeoptimizationAction.RecompileIfTooManyDeopts;
   }
   if (action == config.deoptActionReinterpret) {
     return DeoptimizationAction.InvalidateReprofile;
   }
   if (action == config.deoptActionMakeNotEntrant) {
     return DeoptimizationAction.InvalidateRecompile;
   }
   if (action == config.deoptActionMakeNotCompilable) {
     return DeoptimizationAction.InvalidateStopCompiling;
   }
   throw GraalInternalError.shouldNotReachHere();
 }
コード例 #4
0
 public int convertDeoptReason(DeoptimizationReason reason) {
   HotSpotVMConfig config = runtime.getConfig();
   switch (reason) {
     case None:
       return config.deoptReasonNone;
     case NullCheckException:
       return config.deoptReasonNullCheck;
     case BoundsCheckException:
       return config.deoptReasonRangeCheck;
     case ClassCastException:
       return config.deoptReasonClassCheck;
     case ArrayStoreException:
       return config.deoptReasonArrayCheck;
     case UnreachedCode:
       return config.deoptReasonUnreached0;
     case TypeCheckedInliningViolated:
       return config.deoptReasonTypeCheckInlining;
     case OptimizedTypeCheckViolated:
       return config.deoptReasonOptimizedTypeCheck;
     case NotCompiledExceptionHandler:
       return config.deoptReasonNotCompiledExceptionHandler;
     case Unresolved:
       return config.deoptReasonUnresolved;
     case JavaSubroutineMismatch:
       return config.deoptReasonJsrMismatch;
     case ArithmeticException:
       return config.deoptReasonDiv0Check;
     case RuntimeConstraint:
       return config.deoptReasonConstraint;
     case LoopLimitCheck:
       return config.deoptReasonLoopLimitCheck;
     case Aliasing:
       return config.deoptReasonAliasing;
     case TransferToInterpreter:
       return config.deoptReasonTransferToInterpreter;
     default:
       throw GraalInternalError.shouldNotReachHere();
   }
 }
コード例 #5
0
  public ResolvedJavaField lookupJavaField(Field reflectionField) {
    String name = reflectionField.getName();
    Class<?> fieldHolder = reflectionField.getDeclaringClass();
    Class<?> fieldType = reflectionField.getType();
    // java.lang.reflect.Field's modifiers should be enough here since VM internal modifier bits
    // are not used (yet).
    final int modifiers = reflectionField.getModifiers();
    final long offset =
        Modifier.isStatic(modifiers)
            ? unsafe.staticFieldOffset(reflectionField)
            : unsafe.objectFieldOffset(reflectionField);

    ResolvedJavaType holder = HotSpotResolvedObjectType.fromClass(fieldHolder);
    ResolvedJavaType type = HotSpotResolvedObjectType.fromClass(fieldType);

    if (offset != -1) {
      HotSpotResolvedObjectType resolved = (HotSpotResolvedObjectType) holder;
      return resolved.createField(name, type, offset, modifiers);
    } else {
      throw GraalInternalError.shouldNotReachHere("unresolved field " + reflectionField);
    }
  }