/** * Returns whether the given method accesses package visible classes or class * members. */ public static boolean accessesPackageCode(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.accessesPackageCode(); }
/** * Returns whether the given method accesses private class members. */ public static boolean accessesPrivateCode(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.accessesPrivateCode(); }
/** * Returns whether the given method accesses protected class members. */ public static boolean accessesProtectedCode(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).accessesProtectedCode(); } }
/** * Returns the total size of the parameters. */ public static int getParameterSize(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info != null ? info.getParameterSize() : 0; }
private static void setAccessesPrivateCode(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); if (info != null) { info.setAccessesPrivateCode(); } }
public synchronized void merge(MethodOptimizationInfo other) { this.catchesExceptions |= other.catchesExceptions(); this.branchesBackward |= other.branchesBackward(); this.invokesSuperMethods |= other.invokesSuperMethods(); this.invokesDynamically |= other.invokesDynamically(); this.accessesPrivateCode |= other.accessesPrivateCode(); this.accessesPackageCode |= other.accessesPackageCode(); this.accessesProtectedCode |= other.accessesProtectedCode(); this.hasSynchronizedBlock |= other.hasSynchronizedBlock(); // Some of these should actually be recomputed, since these are // relative to the method: // this.invokesSuperMethods // this.accessesPrivateCode // this.accessesPackageCode // this.accessesProtectedCode }
/** * Returns whether the given method can be made private. */ public static boolean canBeMadePrivate(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info != null && info.canBeMadePrivate(); } }
public static boolean catchesExceptions(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.catchesExceptions(); } }
public static boolean branchesBackward(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.branchesBackward(); } }
/** * Returns the number of times the given method was invoked by the * instructions that were visited. */ public static int getInvocationCount(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info != null ? info.getInvocationCount() : Integer.MAX_VALUE; } }
/** * Returns whether the given parameter is being used. */ public static boolean isParameterUsed(Method method, int variableIndex) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).isParameterUsed(variableIndex); }
public static Value getMethodReturnValue(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).getReturnValue(); } }
public static boolean hasSideEffects(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.hasSideEffects(); } }
/** * Marks the given parameters as being used. */ public static void markUsedParameters(Method method, long usedParameters) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); if (info != null) { info.setUsedParameters(info.getUsedParameters() | usedParameters); } }
public static boolean returnsWithNonEmptyStack(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).returnsWithNonEmptyStack(); } }
/** * Returns whether the given parameter is modified by the given method. */ public static boolean isParameterModified(Method method, int parameterIndex) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).isParameterModified(parameterIndex); }
public static boolean hasNoExternalSideEffects(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).hasNoExternalSideEffects(); } }
/** * Returns which parameters are being used. */ public static long getUsedParameters(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).getUsedParameters(); } }
public static boolean hasNoSideEffects(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).hasNoSideEffects(); } }
public static boolean invokesSuperMethods(Method method) { MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method); return info == null || info.invokesSuperMethods(); } }