proguard.optimize.evaluation.PartialEvaluator Java Examples
The following examples show how to use
proguard.optimize.evaluation.PartialEvaluator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParameterUsageMarker.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
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); } } } } }
Example #2
Source File: ParameterUsageMarker.java From proguard with GNU General Public License v2.0 | 6 votes |
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); } } } } }
Example #3
Source File: ParameterUsageMarker.java From bazel with Apache License 2.0 | 6 votes |
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); } } } } }
Example #4
Source File: CodePreverifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
/** * Creates and returns the verification type corresponding to the given * value. If necessary, a class constant is added to the constant pool of * the given class. */ private VerificationType correspondingVerificationType(ProgramClass programClass, ProgramMethod programMethod, CodeAttribute codeAttribute, int offset, boolean isVariable0, Value value, Value producerValue) { if (value == null) { return VerificationTypeFactory.createTopType(); } int type = value.computationalType(); switch (type) { case Value.TYPE_INSTRUCTION_OFFSET: case Value.TYPE_INTEGER: return VerificationTypeFactory.createIntegerType(); case Value.TYPE_LONG: return VerificationTypeFactory.createLongType(); case Value.TYPE_FLOAT: return VerificationTypeFactory.createFloatType(); case Value.TYPE_DOUBLE: return VerificationTypeFactory.createDoubleType(); case Value.TYPE_TOP: return VerificationTypeFactory.createTopType(); case Value.TYPE_REFERENCE: // Is it a Null type? ReferenceValue referenceValue = value.referenceValue(); if (referenceValue.isNull() == Value.ALWAYS) { return VerificationTypeFactory.createNullType(); } // Does the reference type have a single producer? if (offset != PartialEvaluator.AT_METHOD_ENTRY) { InstructionOffsetValue producers = producerValue.instructionOffsetValue(); if (producers.instructionOffsetCount() == 1) { int producerOffset = producers.instructionOffset(0); // Follow any dup or swap instructions. while (producerOffset != PartialEvaluator.AT_METHOD_ENTRY && isDupOrSwap(codeAttribute.code[producerOffset])) { producers = partialEvaluator.getStackBefore(producerOffset).getTopProducerValue(0).instructionOffsetValue(); producerOffset = producers.instructionOffset(0); } // Are we in an instance initialization method, // before the super initialization, loading "this"? if (partialEvaluator.isInitializer() && offset <= partialEvaluator.superInitializationOffset() && (isVariable0 || producerOffset > PartialEvaluator.AT_METHOD_ENTRY && codeAttribute.code[producerOffset] == InstructionConstants.OP_ALOAD_0)) { // It's an UninitializedThis type. return VerificationTypeFactory.createUninitializedThisType(); } // Is the reference type newly created and still // uninitialized? if (producerOffset > PartialEvaluator.AT_METHOD_ENTRY && offset <= partialEvaluator.initializationOffset(producerOffset)) { // It's an Uninitialized type. return VerificationTypeFactory.createUninitializedType(producerOffset); } } } // It's an ordinary Object type. return VerificationTypeFactory.createObjectType(createClassConstant(programClass, referenceValue)); } throw new IllegalArgumentException("Unknown computational type ["+type+"]"); }