public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) { // Is it a traced but unmarked backward branch, without an unmarked // straddling forward branch? Note that this is still a heuristic. if (isAllSmallerThanOrEqual(instructionUsageMarker.branchTargets(offset), offset) && !isAnyUnnecessaryInstructionBranchingOver(lastNecessaryInstructionOffset(offset), offset)) { replaceByInfiniteLoop(clazz, offset); if (DEBUG) System.out.println(" Setting infinite loop instead of "+instruction.toString(offset)); } }
/** * Creates a new LivenessAnalyzer. */ public LivenessAnalyzer() { this(new PartialEvaluator()); }
protected void setMethodReturnValue(Clazz clazz, Method method, Value value) { if (storeMethodReturnValues) { generalizeMethodReturnValue(method, value); } }
/** * Returns whether the specified stack entry is initialized. */ public boolean isInitializedBefore(int offset, int stackEntryIndexBottom) { InstructionOffsetValue creationOffsetValue = creationOffsetValue(offset, stackEntryIndexBottom); return isInitializedBefore(offset, creationOffsetValue); }
/** * Returns whether the instruction at the given offset is the special * invocation of an instance initializer. */ public boolean isInitializer(int offset) { return partialEvaluator.isInitializer(offset); }
private boolean shouldVisit(int offset) { return isTraced(offset) == traced; } }
public ReferenceValue cast(String type, Clazz referencedClass, ValueFactory valueFactory, boolean alwaysCast) { // We're letting the value factory do the cast (either preserving the // trace value or setting a new one). return ((ReferenceTracingValueFactory)valueFactory).cast(this, type, referencedClass, alwaysCast); }
/** * Returns whether the instruction at the given offset is popping exactly * the reference type of the specified class constant. */ private boolean isPoppingExpectedType(int offset, Clazz clazz, int constantIndex) { return isPoppingExpectedType(offset, 0, clazz, constantIndex); }
/** * Returns whether the instruction at the given offset is popping a simple * enum class. */ private boolean isPoppingSimpleEnum(int offset) { return isPoppingSimpleEnum(offset, 0); }
/** * Creates a new ParameterEscapeMarker. */ public ParameterEscapeMarker(MutableBoolean repeatTrigger, ValueFactory valueFactory) { this(repeatTrigger, valueFactory, new ReferenceTracingValueFactory(valueFactory)); }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Special case: variable 0 ('this') in an initializer has to be alive // as long as it hasn't been initialized. if (offset == initializationFinder.superInitializationOffset()) { alive |= 1L; } }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Does the constant refer to a simple enum type? isSimpleEnum = isSimpleEnum(classConstant.referencedClass); }
/** * Returns the minimum offset from the given instruction offsets. */ private int minOffset(Value instructionOffsets) { return minOffset(instructionOffsets, Integer.MAX_VALUE); }
private void markInstruction(int instructionOffset) { if (!isInstructionNecessary(instructionOffset)) { if (DEBUG) System.out.print(instructionOffset+","); instructionsNecessary[instructionOffset] = true; if (maxMarkedOffset < instructionOffset) { maxMarkedOffset = instructionOffset; } } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Special case: variable 0 ('this') in an initializer has to be alive // as long as it hasn't been initialized. if (offset == partialEvaluator.superInitializationOffset()) { alive |= 1L; } }
/** * Returns the maximum offset from the given instruction offsets. */ private int maxOffset(Value instructionOffsets) { return maxOffset(instructionOffsets, Integer.MIN_VALUE); }
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) { // Is it a traced but unmarked backward branch, without an unmarked // straddling forward branch? Note that this is still a heuristic. if (isAllSmallerThanOrEqual(instructionUsageMarker.branchTargets(offset), offset) && !isAnyUnnecessaryInstructionBranchingOver(lastNecessaryInstructionOffset(offset), offset)) { replaceByInfiniteLoop(clazz, offset); if (DEBUG) System.out.println(" Setting infinite loop instead of "+instruction.toString(offset)); } }
/** * Creates a new EvaluationSimplifier. */ public EvaluationSimplifier() { this(new PartialEvaluator(), null); }
/** * Returns whether the instruction at the given offset is the special * invocation of an instance initializer. */ public boolean isInitializer(int offset) { return partialEvaluator.isInitializer(offset); }
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) { // Is it a traced but unmarked backward branch, without an unmarked // straddling forward branch? Note that this is still a heuristic. if (isAllSmallerThanOrEqual(instructionUsageMarker.branchTargets(offset), offset) && !isAnyUnnecessaryInstructionBranchingOver(lastNecessaryInstructionOffset(offset), offset)) { replaceByInfiniteLoop(clazz, offset); if (DEBUG) System.out.println(" Setting infinite loop instead of "+instruction.toString(offset)); } }