proguard.classfile.instruction.visitor.InstructionVisitor Java Examples
The following examples show how to use
proguard.classfile.instruction.visitor.InstructionVisitor.
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: InstructionSequencesReplacer.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Creates an array of InstructionSequenceReplacer instances. * @param patternConstants any constants referenced by the pattern * instruction. * @param instructionSequences the instruction sequences to be replaced, * with subsequently the sequence pair index, * the from/to index (0 or 1), and the * instruction index in the sequence. * @param branchTargetFinder a branch target finder that has been * initialized to indicate branch targets * in the visited code. * @param codeAttributeEditor a code editor that can be used for * accumulating changes to the code. * @param extraInstructionVisitor an optional extra visitor for all deleted * load instructions. */ private static InstructionVisitor[] createInstructionSequenceReplacers(Constant[] patternConstants, Instruction[][][] instructionSequences, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor) { InstructionVisitor[] instructionSequenceReplacers = new InstructionSequenceReplacer[instructionSequences.length]; for (int index = 0; index < instructionSequenceReplacers.length; index++) { Instruction[][] instructionSequencePair = instructionSequences[index]; instructionSequenceReplacers[index] = new InstructionSequenceReplacer(patternConstants, instructionSequencePair[PATTERN_INDEX], instructionSequencePair[REPLACEMENT_INDEX], branchTargetFinder, codeAttributeEditor, extraInstructionVisitor); } return instructionSequenceReplacers; }
Example #2
Source File: CodeAttributeEditor.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { if (instructionVisitor != CodeAttributeEditor.this) { throw new UnsupportedOperationException("Unexpected visitor ["+instructionVisitor+"]"); } for (int index = 0; index < instructions.length; index++) { Instruction instruction = instructions[index]; instruction.accept(clazz, method, codeAttribute, offset, CodeAttributeEditor.this); offset += instruction.length(offset); } }
Example #3
Source File: ConfigurationLoggingInstructionSequenceReplacer.java From proguard with GNU General Public License v2.0 | 6 votes |
public ConfigurationLoggingInstructionSequenceReplacer(InstructionSequenceMatcher instructionSequenceMatcher, Constant[] patternConstants, Instruction[] patternInstructions, Constant[] replacementConstants, Instruction[] replacementInstructions, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor ) { super(instructionSequenceMatcher, patternConstants, patternInstructions, replacementConstants, replacementInstructions, branchTargetFinder, codeAttributeEditor, extraInstructionVisitor ); }
Example #4
Source File: ConfigurationLoggingInstructionSequenceReplacer.java From proguard with GNU General Public License v2.0 | 6 votes |
public ConfigurationLoggingInstructionSequenceReplacer(Constant[] patternConstants, Instruction[] patternInstructions, Constant[] replacementConstants, Instruction[] replacementInstructions, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor ) { super(patternConstants, patternInstructions, replacementConstants, replacementInstructions, branchTargetFinder, codeAttributeEditor, extraInstructionVisitor ); }
Example #5
Source File: CodeAttributeEditor.java From proguard with GNU General Public License v2.0 | 6 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { if (instructionVisitor != CodeAttributeEditor.this) { throw new UnsupportedOperationException("Unexpected visitor ["+instructionVisitor+"]"); } for (int index = 0; index < instructions.length; index++) { Instruction instruction = instructions[index]; instruction.accept(clazz, method, codeAttribute, offset, CodeAttributeEditor.this); offset += instruction.length(offset); } }
Example #6
Source File: InstructionSequenceReplacer.java From proguard with GNU General Public License v2.0 | 5 votes |
/** * Creates a new InstructionSequenceReplacer. * @param patternConstants any constants referenced by the pattern * instruction. * @param branchTargetFinder a branch target finder that has been * initialized to indicate branch targets * in the visited code. * @param codeAttributeEditor a code editor that can be used for * accumulating changes to the code. * @param extraInstructionVisitor an optional extra visitor for all deleted * load instructions. */ public InstructionSequenceReplacer(Constant[] patternConstants, Instruction[] patternInstructions, Instruction[] replacementInstructions, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor) { this.instructionSequenceMatcher = new InstructionSequenceMatcher(patternConstants, patternInstructions); this.patternConstants = patternConstants; this.replacementInstructions = replacementInstructions; this.branchTargetFinder = branchTargetFinder; this.codeAttributeEditor = codeAttributeEditor; this.extraInstructionVisitor = extraInstructionVisitor; }
Example #7
Source File: InstructionSequenceReplacer.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Creates a new InstructionSequenceReplacer. * @param patternConstants any constants referenced by the pattern * instruction. * @param branchTargetFinder a branch target finder that has been * initialized to indicate branch targets * in the visited code. * @param codeAttributeEditor a code editor that can be used for * accumulating changes to the code. * @param extraInstructionVisitor an optional extra visitor for all deleted * load instructions. */ public InstructionSequenceReplacer(Constant[] patternConstants, Instruction[] patternInstructions, Instruction[] replacementInstructions, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor) { this.instructionSequenceMatcher = new InstructionSequenceMatcher(patternConstants, patternInstructions); this.replacementInstructions = replacementInstructions; this.branchTargetFinder = branchTargetFinder; this.codeAttributeEditor = codeAttributeEditor; this.extraInstructionVisitor = extraInstructionVisitor; }
Example #8
Source File: CodeAttribute.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Applies the given instruction visitor to all instructions in the * specified range of offsets. */ public void instructionsAccept(Clazz clazz, Method method, int startOffset, int endOffset, InstructionVisitor instructionVisitor) { int offset = startOffset; while (offset < endOffset) { // Note that the instruction is only volatile. Instruction instruction = InstructionFactory.create(code, offset); int instructionLength = instruction.length(offset); instruction.accept(clazz, method, this, offset, instructionVisitor); offset += instructionLength; } }
Example #9
Source File: AbstractAPIConverter.java From proguard with GNU General Public License v2.0 | 5 votes |
/** * Create a new AbstractAPIConverter instance. */ AbstractAPIConverter(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter warningPrinter, ClassVisitor modifiedClassVisitor, InstructionVisitor extraInstructionVisitor) { this.programClassPool = programClassPool; this.libraryClassPool = libraryClassPool; this.warningPrinter = warningPrinter; this.modifiedClassVisitor = modifiedClassVisitor; this.extraInstructionVisitor = extraInstructionVisitor; }
Example #10
Source File: JSR310Converter.java From proguard with GNU General Public License v2.0 | 5 votes |
/** * Create a new JSR310Converter instance. */ public JSR310Converter(ClassPool programClassPool, ClassPool libraryClassPool, WarningPrinter warningPrinter, ClassVisitor modifiedClassVisitor, InstructionVisitor extraInstructionVisitor) { super(programClassPool, libraryClassPool, warningPrinter, modifiedClassVisitor, extraInstructionVisitor); TypeReplacement[] typeReplacements = new TypeReplacement[] { // java.time package has been added in Java 8 replace("java/time/**", "org/threeten/bp/<1>"), }; MethodReplacement[] methodReplacements = new MethodReplacement[] { // all classes in java.time.** are converted to // org.threeeten.bp.**. replace("java/time/**", "**", "**", "org/threeten/bp/<1>", "<1>", "<1>"), }; setTypeReplacements(typeReplacements); setMethodReplacements(methodReplacements); }
Example #11
Source File: InstructionSequenceReplacer.java From bazel with Apache License 2.0 | 5 votes |
/** * Creates a new InstructionSequenceReplacer. * @param patternConstants any constants referenced by the pattern * instruction. * @param branchTargetFinder a branch target finder that has been * initialized to indicate branch targets * in the visited code. * @param codeAttributeEditor a code editor that can be used for * accumulating changes to the code. * @param extraInstructionVisitor an optional extra visitor for all deleted * load instructions. */ public InstructionSequenceReplacer(Constant[] patternConstants, Instruction[] patternInstructions, Instruction[] replacementInstructions, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor) { this.instructionSequenceMatcher = new InstructionSequenceMatcher(patternConstants, patternInstructions); this.patternConstants = patternConstants; this.replacementInstructions = replacementInstructions; this.branchTargetFinder = branchTargetFinder; this.codeAttributeEditor = codeAttributeEditor; this.extraInstructionVisitor = extraInstructionVisitor; }
Example #12
Source File: CodeAttribute.java From bazel with Apache License 2.0 | 5 votes |
/** * Applies the given instruction visitor to all instructions in the * specified range of offsets. */ public void instructionsAccept(Clazz clazz, Method method, int startOffset, int endOffset, InstructionVisitor instructionVisitor) { int offset = startOffset; while (offset < endOffset) { // Note that the instruction is only volatile. Instruction instruction = InstructionFactory.create(code, offset); int instructionLength = instruction.length(offset); instruction.accept(clazz, method, this, offset, instructionVisitor); offset += instructionLength; } }
Example #13
Source File: LookUpSwitchInstruction.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitLookUpSwitchInstruction(clazz, method, codeAttribute, offset, this); }
Example #14
Source File: BranchInstruction.java From proguard with GNU General Public License v2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitBranchInstruction(clazz, method, codeAttribute, offset, this); }
Example #15
Source File: TableSwitchInstruction.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitTableSwitchInstruction(clazz, method, codeAttribute, offset, this); }
Example #16
Source File: SimpleInstruction.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitSimpleInstruction(clazz, method, codeAttribute, offset, this); }
Example #17
Source File: ConstantInstruction.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, this); }
Example #18
Source File: VariableInstruction.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitVariableInstruction(clazz, method, codeAttribute, offset, this); }
Example #19
Source File: InstructionUsageMarker.java From proguard with GNU General Public License v2.0 | 4 votes |
/** * Returns a filtering version of the given instruction visitor that only * visits necessary instructions. */ public InstructionVisitor necessaryInstructionFilter(InstructionVisitor instructionVisitor) { return necessaryInstructionFilter(true, instructionVisitor); }
Example #20
Source File: CodeAttribute.java From proguard with GNU General Public License v2.0 | 4 votes |
/** * Applies the given instruction visitor to all instructions. */ public void instructionsAccept(Clazz clazz, Method method, InstructionVisitor instructionVisitor) { instructionsAccept(clazz, method, 0, u4codeLength, instructionVisitor); }
Example #21
Source File: CodeAttribute.java From proguard with GNU General Public License v2.0 | 4 votes |
/** * Applies the given instruction visitor to the instruction at the specified * offset. */ public void instructionAccept(Clazz clazz, Method method, int offset, InstructionVisitor instructionVisitor) { Instruction instruction = InstructionFactory.create(code, offset); instruction.accept(clazz, method, this, offset, instructionVisitor); }
Example #22
Source File: InstructionUsageMarker.java From proguard with GNU General Public License v2.0 | 4 votes |
/** * Returns a filtering version of the given instruction visitor that only * visits traced or untraced instructions. */ public InstructionVisitor tracedInstructionFilter(boolean traced, InstructionVisitor instructionVisitor) { return partialEvaluator.tracedInstructionFilter(traced, instructionVisitor); }
Example #23
Source File: VariableInstruction.java From proguard with GNU General Public License v2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitVariableInstruction(clazz, method, codeAttribute, offset, this); }
Example #24
Source File: ConstantInstruction.java From proguard with GNU General Public License v2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, this); }
Example #25
Source File: LookUpSwitchInstruction.java From proguard with GNU General Public License v2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitLookUpSwitchInstruction(clazz, method, codeAttribute, offset, this); }
Example #26
Source File: TableSwitchInstruction.java From proguard with GNU General Public License v2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitTableSwitchInstruction(clazz, method, codeAttribute, offset, this); }
Example #27
Source File: SimpleInstruction.java From bazel with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitSimpleInstruction(clazz, method, codeAttribute, offset, this); }
Example #28
Source File: BranchInstruction.java From bazel with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitBranchInstruction(clazz, method, codeAttribute, offset, this); }
Example #29
Source File: VariableInstruction.java From bazel with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitVariableInstruction(clazz, method, codeAttribute, offset, this); }
Example #30
Source File: ConstantInstruction.java From bazel with Apache License 2.0 | 4 votes |
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) { instructionVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, this); }