/** * Remembers to replace the instruction at the given offset by the given * instruction. */ private void replaceInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.replaceInstruction(instructionOffset, instruction); }
/** * Remembers to replace the instruction at the given offset by the given * instruction. */ private void replaceInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.replaceInstruction(instructionOffset, instruction); }
/** * Remembers to replace the instruction at the given offset by the given * instruction. */ private void replaceInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.replaceInstruction(instructionOffset, instruction); }
/** * Remembers to replace the instruction at the given offset by the given * instruction. */ private void replaceInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.replaceInstruction(instructionOffset, instruction); }
/** * Replaces the instruction at a given offset by a static invocation. */ private void replaceByStaticInvocation(Clazz clazz, int offset, ConstantInstruction constantInstruction) { // Remember the replacement instruction. Instruction replacementInstruction = new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, constantInstruction.constantIndex); if (DEBUG) System.out.println(" Replacing by static invocation "+constantInstruction.toString(offset)+" -> "+replacementInstruction.toString()); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); }
/** * Replaces the instruction at a given offset by a static invocation. */ private void replaceByStaticInvocation(Clazz clazz, int offset, ConstantInstruction constantInstruction) { // Remember the replacement instruction. Instruction replacementInstruction = new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, constantInstruction.constantIndex); if (DEBUG) System.out.println(" Replacing by static invocation "+constantInstruction.toString(offset)+" -> "+replacementInstruction.toString()); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); }
/** * Replaces the given instruction by an infinite loop. */ private void replaceByInfiniteLoop(Clazz clazz, int offset) { if (DEBUG) System.out.println(" Inserting infinite loop at ["+offset+"]"); // We can edit an instruction without marking it. //markInstruction(offset); // Replace the instruction by an infinite loop. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, 0); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
/** * Replaces the instruction at a given offset by a static invocation. */ private void replaceByStaticInvocation(Clazz clazz, int offset, ConstantInstruction constantInstruction) { // Remember the replacement instruction. Instruction replacementInstruction = new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, constantInstruction.constantIndex); if (DEBUG) System.out.println(" Replacing by static invocation "+constantInstruction.toString(offset)+" -> "+replacementInstruction.toString()); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); }
/** * Replaces the given instruction by an infinite loop. */ private void replaceByInfiniteLoop(Clazz clazz, int offset) { if (DEBUG) System.out.println(" Inserting infinite loop at ["+offset+"]"); // We can edit an instruction without marking it. //markInstruction(offset); // Replace the instruction by an infinite loop. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, 0); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { builder = null; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (builder != null) { codeAttributeEditor.replaceInstruction(offset, builder.instructions()); classModified = true; } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { builder = null; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (builder != null) { codeAttributeEditor.replaceInstruction(offset, builder.instructions()); classModified = true; } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { builder = null; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (builder != null) { codeAttributeEditor.replaceInstruction(offset, builder.instructions()); classModified = true; } }
/** * Replaces the instruction at a given offset by a static invocation. */ private void replaceByStaticInvocation(Clazz clazz, int offset, ConstantInstruction constantInstruction) { // Remember the replacement instruction. Instruction replacementInstruction = new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, constantInstruction.constantIndex).shrink(); if (DEBUG) System.out.println(" Replacing by static invocation "+constantInstruction.toString(offset)+" -> "+replacementInstruction.toString()); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Is the new constant pool index different from the original one? int newConstantIndex = remapConstantIndex(constantInstruction.constantIndex); if (newConstantIndex != constantInstruction.constantIndex) { // Replace the instruction. Instruction replacementInstruction = new ConstantInstruction(constantInstruction.opcode, newConstantIndex, constantInstruction.constant); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Is the new constant pool index different from the original one? int newConstantIndex = remapConstantIndex(constantInstruction.constantIndex); if (newConstantIndex != constantInstruction.constantIndex) { // Replace the instruction. Instruction replacementInstruction = new ConstantInstruction(constantInstruction.opcode, newConstantIndex, constantInstruction.constant); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction) { // Is the new variable index different from the original one? int oldVariableIndex = variableInstruction.variableIndex; int newVariableIndex = remapVariable(oldVariableIndex); if (newVariableIndex != oldVariableIndex) { // Replace the instruction. Instruction replacementInstruction = new VariableInstruction(variableInstruction.opcode, newVariableIndex, variableInstruction.constant); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
/** * Replaces the given instruction by an infinite loop. */ private void replaceByInfiniteLoop(Clazz clazz, int offset) { if (DEBUG) System.out.println(" Inserting infinite loop at ["+offset+"]"); // Mark the instruction. markInstruction(offset); // Replace the instruction by an infinite loop. Instruction replacementInstruction = new BranchInstruction(InstructionConstants.OP_GOTO, 0); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Is the new constant pool index different from the original one? int newConstantIndex = remapConstantIndex(constantInstruction.constantIndex); if (newConstantIndex != constantInstruction.constantIndex) { // Replace the instruction. Instruction replacementInstruction = new ConstantInstruction(constantInstruction.opcode, newConstantIndex, constantInstruction.constant); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction) { // Is the new variable index different from the original one? int oldVariableIndex = variableInstruction.variableIndex; int newVariableIndex = remapVariable(oldVariableIndex); if (newVariableIndex != oldVariableIndex) { // Replace the instruction. Instruction replacementInstruction = new VariableInstruction(variableInstruction.opcode, newVariableIndex, variableInstruction.constant); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { // Is the new constant pool index different from the original one? int newConstantIndex = remapConstantIndex(constantInstruction.constantIndex); if (newConstantIndex != constantInstruction.constantIndex) { // Replace the instruction. Instruction replacementInstruction = new ConstantInstruction(constantInstruction.opcode, newConstantIndex, constantInstruction.constant).shrink(); codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } }