/** * Remembers to place the given instruction right before the instruction * at the given offset. */ private void insertBeforeInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.insertBeforeInstruction(instructionOffset, instruction); }
/** * Remembers to place the given instruction right before the instruction * at the given offset. */ private void insertBeforeInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.insertBeforeInstruction(instructionOffset, instruction); }
/** * Remembers to place the given instruction right before the instruction * at the given offset. */ private void insertBeforeInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.insertBeforeInstruction(instructionOffset, instruction); }
/** * Remembers to place the given instruction right before the instruction * at the given offset. */ private void insertBeforeInstruction(int instructionOffset, Instruction instruction) { ensureCodeAttributeEditor(); // Replace the instruction. codeAttributeEditor.insertBeforeInstruction(instructionOffset, instruction); }
new SimpleInstruction(InstructionConstants.OP_POP); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; new SimpleInstruction(InstructionConstants.OP_POP2); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; codeAttributeEditor.insertBeforeInstruction(offset, popInstructions); break;
new SimpleInstruction(InstructionConstants.OP_POP); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; new SimpleInstruction(InstructionConstants.OP_POP2); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; codeAttributeEditor.insertBeforeInstruction(offset, popInstructions); break;
new SimpleInstruction(InstructionConstants.OP_POP); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; new SimpleInstruction(InstructionConstants.OP_POP2); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; codeAttributeEditor.insertBeforeInstruction(offset, popInstructions); break;
new SimpleInstruction(InstructionConstants.OP_POP); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; new SimpleInstruction(InstructionConstants.OP_POP2); codeAttributeEditor.insertBeforeInstruction(offset, popInstruction); break; codeAttributeEditor.insertBeforeInstruction(offset, popInstructions); break;
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL) { hasBeenFixed = false; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (hasBeenFixed) { Instruction extraInstruction = new SimpleInstruction(InstructionConstants.OP_ICONST_0); codeAttributeEditor.insertBeforeInstruction(offset, extraInstruction); if (DEBUG) { System.out.println("DuplicateInitializerInvocationFixer:"); System.out.println(" Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset)); } if (extraAddedInstructionVisitor != null) { extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor); } } } }
/** * Pushes a specified type of stack entry before or at the given offset. * The instruction is marked as necessary. */ private void insertPushInstructions(int offset, boolean replace, int computationalType) { // Mark this instruction. markInstruction(offset); // Create a simple push instrucion. Instruction replacementInstruction = new SimpleInstruction(pushOpcode(computationalType)); if (DEBUG) System.out.println(": "+replacementInstruction.toString(offset)); // Replace or insert the push instruction. if (replace) { // Replace the push instruction. codeAttributeEditor.replaceInstruction(offset, replacementInstruction); } else { // Insert the push instruction. codeAttributeEditor.insertBeforeInstruction(offset, replacementInstruction); if (extraAddedInstructionVisitor != null) { replacementInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor); } } }
codeAttributeEditor.insertBeforeInstruction(offset, instruction);
codeAttributeEditor.insertBeforeInstruction(offset, instruction);
codeAttributeEditor.insertBeforeInstruction(offset, instruction);
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL) { descriptorLengthDelta = 0; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (descriptorLengthDelta > 0) { Instruction extraInstruction = new SimpleInstruction(descriptorLengthDelta == 1 ? InstructionConstants.OP_ICONST_0 : InstructionConstants.OP_ACONST_NULL); codeAttributeEditor.insertBeforeInstruction(offset, extraInstruction); if (DEBUG) { System.out.println(" ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset)); } if (extraAddedInstructionVisitor != null) { extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor); } } } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL) { descriptorLengthDelta = 0; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (descriptorLengthDelta > 0) { Instruction extraInstruction = new SimpleInstruction(descriptorLengthDelta == 1 ? InstructionConstants.OP_ICONST_0 : InstructionConstants.OP_ACONST_NULL); codeAttributeEditor.insertBeforeInstruction(offset, extraInstruction); if (DEBUG) { System.out.println(" ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset)); } if (extraAddedInstructionVisitor != null) { extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor); } } } }
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction) { if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL) { descriptorLengthDelta = 0; clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this); if (descriptorLengthDelta > 0) { Instruction extraInstruction = new SimpleInstruction(descriptorLengthDelta == 1 ? InstructionConstants.OP_ICONST_0 : InstructionConstants.OP_ACONST_NULL); codeAttributeEditor.insertBeforeInstruction(offset, extraInstruction); if (DEBUG) { System.out.println(" ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset)); } if (extraAddedInstructionVisitor != null) { extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor); } } } }
codeAttributeEditor.insertBeforeInstruction(offset, instructions);
codeAttributeEditor.insertBeforeInstruction(offset, instructions);
codeAttributeEditor.insertBeforeInstruction(offset, instructions);
codeAttributeEditor.insertBeforeInstruction(deleteOffset, (Instruction)null); codeAttributeEditor.insertAfterInstruction( deleteOffset, (Instruction)null);