Ejemplo n.º 1
0
 private static void checkLimits(Object src, int srcPos, Object dest, int destPos, int length) {
   if (probability(SLOW_PATH_PROBABILITY, srcPos < 0)) {
     checkAIOOBECounter.inc();
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   if (probability(SLOW_PATH_PROBABILITY, destPos < 0)) {
     checkAIOOBECounter.inc();
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   if (probability(SLOW_PATH_PROBABILITY, length < 0)) {
     checkAIOOBECounter.inc();
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   if (probability(SLOW_PATH_PROBABILITY, srcPos > ArrayLengthNode.arrayLength(src) - length)) {
     checkAIOOBECounter.inc();
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   if (probability(SLOW_PATH_PROBABILITY, destPos > ArrayLengthNode.arrayLength(dest) - length)) {
     checkAIOOBECounter.inc();
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   checkSuccessCounter.inc();
 }
Ejemplo n.º 2
0
 public static int getLength(Object array) {
   if (!array.getClass().isArray()) {
     DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
   }
   return ArrayLengthNode.arrayLength(array);
 }