/** * Returns the instruction offsets to which the given instruction offset * branches in the most recently analyzed code attribute. */ public InstructionOffsetValue branchTargets(int instructionOffset) { return partialEvaluator.branchTargets(instructionOffset); }
/** * Returns the instruction offsets to which the given instruction offset * branches in the most recently analyzed code attribute. */ public InstructionOffsetValue branchTargets(int instructionOffset) { return partialEvaluator.branchTargets(instructionOffset); }
/** * Returns the instruction offsets to which the given instruction offset * branches in the most recently analyzed code attribute. */ public InstructionOffsetValue branchTargets(int instructionOffset) { return partialEvaluator.branchTargets(instructionOffset); }
/** * Returns whether any traced but unnecessary instruction between the two * given offsets is branching over the second given offset. */ private boolean isAnyUnnecessaryInstructionBranchingOver(int instructionOffset1, int instructionOffset2) { for (int offset = instructionOffset1; offset < instructionOffset2; offset++) { // Is it a traced but unmarked straddling branch? if (partialEvaluator.isTraced(offset) && !isInstructionNecessary(offset) && isAnyLargerThan(partialEvaluator.branchTargets(offset), instructionOffset2)) { return true; } } return false; }
/** * Deletes the given branch instruction, or replaces it by a simpler branch * instruction, if possible. */ private void replaceBranchInstruction(Clazz clazz, int offset, Instruction instruction) { InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); // Is there exactly one branch target (not from a goto or jsr)? if (branchTargets != null && branchTargets.instructionOffsetCount() == 1) { // Is it branching to the next instruction? int branchOffset = branchTargets.instructionOffset(0) - offset; if (branchOffset == instruction.length(offset)) { if (DEBUG) System.out.println(" Ignoring zero branch instruction at ["+offset+"]"); } else { // Replace the branch instruction by a simple branch instruction. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, branchOffset); replaceInstruction(clazz, offset, instruction, replacementInstruction); } } }
/** * Deletes the given branch instruction, or replaces it by a simpler branch * instruction, if possible. */ private void replaceBranchInstruction(Clazz clazz, int offset, Instruction instruction) { InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); // Is there exactly one branch target (not from a goto or jsr)? if (branchTargets != null && branchTargets.instructionOffsetCount() == 1) { // Is it branching to the next instruction? int branchOffset = branchTargets.instructionOffset(0) - offset; if (branchOffset == instruction.length(offset)) { if (DEBUG) System.out.println(" Ignoring zero branch instruction at ["+offset+"]"); } else { // Replace the branch instruction by a simple branch instruction. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, branchOffset); replaceInstruction(clazz, offset, instruction, replacementInstruction); } } }
/** * Deletes the given branch instruction, or replaces it by a simpler branch * instruction, if possible. */ private void replaceBranchInstruction(Clazz clazz, int offset, Instruction instruction) { InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); // Is there exactly one branch target (not from a goto or jsr)? if (branchTargets != null && branchTargets.instructionOffsetCount() == 1) { // Is it branching to the next instruction? int branchOffset = branchTargets.instructionOffset(0) - offset; if (branchOffset == instruction.length(offset)) { if (DEBUG) System.out.println(" Ignoring zero branch instruction at ["+offset+"]"); } else { // Replace the branch instruction by a simple branch instruction. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, branchOffset); replaceInstruction(clazz, offset, instruction, replacementInstruction); } } }
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset);
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset);
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset);
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset);
/** * Deletes the given branch instruction, or replaces it by a simpler branch * instruction, if possible. */ private void replaceBranchInstruction(Clazz clazz, int offset, Instruction instruction) { InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); // Is there exactly one branch target (not from a goto or jsr)? if (branchTargets != null && branchTargets.instructionOffsetCount() == 1) { // Is it branching to the next instruction? int branchOffset = branchTargets.instructionOffset(0) - offset; if (branchOffset == instruction.length(offset)) { if (DEBUG) System.out.println(" Ignoring zero branch instruction at ["+offset+"]"); } else { // Replace the branch instruction by a simple branch instruction. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO_W, branchOffset).shrink(); replaceInstruction(clazz, offset, instruction, replacementInstruction); } } }
partialEvaluator.branchTargets(offset), true); partialEvaluator.branchTargets(offset), true); partialEvaluator.branchTargets(offset), true);
partialEvaluator.branchTargets(offset), true); partialEvaluator.branchTargets(offset), true); partialEvaluator.branchTargets(offset), true);
partialEvaluator.branchTargets(offset);
partialEvaluator.branchTargets(offset);
partialEvaluator.branchTargets(offset);
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); if (branchTargets != null)
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); if (branchTargets != null)
InstructionOffsetValue branchTargets = partialEvaluator.branchTargets(offset); if (branchTargets != null)