public ClassVisitor createClassVisitor() { return new AllMethodVisitor( new OptimizationInfoMemberFilter( new ParameterUsageMarker(!methodMarkingStatic, !methodRemovalParameter))); } };
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Get the total size of the parameters. int parameterSize = ParameterUsageMarker.getParameterSize(programMethod); // Make the method invocation static, if possible. if ((programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) == 0 && !ParameterUsageMarker.isParameterUsed(programMethod, 0)) { replaceByStaticInvocation(programClass, invocationOffset, invocationInstruction); } // Remove unused parameters. for (int index = 0; index < parameterSize; index++) { if (!ParameterUsageMarker.isParameterUsed(programMethod, index)) { TracedStack stack = partialEvaluator.getStackBefore(invocationOffset); int stackIndex = stack.size() - parameterSize + index; if (DEBUG) { System.out.println(" ["+invocationOffset+"] Ignoring parameter #"+index+" of "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass)+"] (stack entry #"+stackIndex+" ["+stack.getBottom(stackIndex)+"])"); System.out.println(" Full stack: "+stack); } markStackSimplificationBefore(invocationOffset, stackIndex); } } } }
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod) { // Can the method have other implementations? if (libraryClass.mayHaveImplementations(libraryMethod)) { // All implementations must keep all parameters of this method, // including the 'this' parameter. markUsedParameters(libraryMethod, -1L); } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Get the total size of the parameters and the mask of the used // parameters. parameterSize = ParameterUsageMarker.getParameterSize(programMethod); usedParameters = ParameterUsageMarker.getUsedParameters(programMethod); } }
markParameterUsed(programMethod, 0); markUsedParameters(programMethod, (accessFlags & ClassConstants.ACC_STATIC) != 0 ? -1L : -2L); markUsedParameters(programMethod, -1L); markParameterUsed(programMethod, 0); markParameterUsed(programMethod, 0); setParameterSize(programMethod, parameterSize);
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Make the method invocation static, if possible. if ((programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) == 0 && !ParameterUsageMarker.isParameterUsed(programMethod, 0)) { replaceByStaticInvocation(programClass, invocationOffset, invocationInstruction); } } }
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction) { if (partialEvaluator.isTraced(offset) && variableInstruction.isLoad()) { int parameterIndex = variableInstruction.variableIndex; if (parameterIndex < codeAttribute.u2maxLocals) { Value producer = partialEvaluator.getVariablesBefore(offset).getProducerValue(parameterIndex); if (producer != null && producer.instructionOffsetValue().contains(PartialEvaluator.AT_METHOD_ENTRY)) { // Mark the variable. markParameterUsed(method, parameterIndex); // Account for Category 2 instructions, which take up two entries. if (variableInstruction.isCategory2()) { markParameterUsed(method, parameterIndex + 1); } } } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (ParameterUsageMarker.hasUnusedParameters(programMethod)) { memberVisitor.visitProgramMethod(programClass, programMethod); } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { usedParameters = ParameterUsageMarker.getUsedParameters(programMethod); } }
markParameterUsed(programMethod, 0); markUsedParameters(programMethod, (accessFlags & ClassConstants.ACC_STATIC) != 0 ? -1L : -2L); markUsedParameters(programMethod, -1L); markParameterUsed(programMethod, 0); markParameterUsed(programMethod, 0); setParameterSize(programMethod, parameterSize);
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Make the method invocation static, if possible. if ((programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) == 0 && !ParameterUsageMarker.isParameterUsed(programMethod, 0)) { replaceByStaticInvocation(programClass, invocationOffset, invocationInstruction); } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Get the total size of the parameters and the mask of the used // parameters. parameterSize = ParameterUsageMarker.getParameterSize(programMethod); usedParameters = ParameterUsageMarker.getUsedParameters(programMethod); } }
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction) { if (partialEvaluator.isTraced(offset) && variableInstruction.isLoad()) { int variableIndex = variableInstruction.variableIndex; if (variableIndex < codeAttribute.u2maxLocals) { // The parameter indices stored in the producer values are // parameter offsets, taking into account Category 2 types, // and therefore compatible with variable indices. Value producer = partialEvaluator.getVariablesBefore(offset).getProducerValue(variableIndex); if (producer != null && producer.instructionOffsetValue().contains(variableIndex | InstructionOffsetValue.METHOD_PARAMETER)) { // Mark the variable. markParameterUsed(method, variableIndex); // Account for Category 2 instructions, which take up two entries. if (variableInstruction.stackPopCount(clazz) == 2 || variableInstruction.stackPushCount(clazz) == 2) { markParameterUsed(method, variableIndex + 1); } } } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (ParameterUsageMarker.hasUnusedParameters(programMethod)) { memberVisitor.visitProgramMethod(programClass, programMethod); } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { usedParameters = ParameterUsageMarker.getUsedParameters(programMethod); } }
markParameterUsed(programMethod, 0); markUsedParameters(programMethod, (accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0 ? -1L : -2L); markUsedParameters(programMethod, -1L); markParameterUsed(programMethod, 0); markParameterUsed(programMethod, 0); setParameterSize(programMethod, parameterSize);
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Make the method invocation static, if possible. if ((programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) == 0 && !ParameterUsageMarker.isParameterUsed(programMethod, 0)) { replaceByStaticInvocation(programClass, invocationOffset, invocationInstruction); } } }
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute) int oldParameterSize = ParameterUsageMarker.getParameterSize(method); if (ParameterUsageMarker.isParameterUsed(method, parameterIndex))
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Get the total size of the parameters and the mask of the used // parameters. parameterSize = ParameterUsageMarker.getParameterSize(programMethod); usedParameters = ParameterUsageMarker.getUsedParameters(programMethod); } }
public ClassVisitor createClassVisitor() { return new AllMethodVisitor( new OptimizationInfoMemberFilter( new ParameterUsageMarker(!methodMarkingStatic, !methodRemovalParameter))); } };