List of usage examples for org.objectweb.asm Opcodes IF_ICMPLT
int IF_ICMPLT
To view the source code for org.objectweb.asm Opcodes IF_ICMPLT.
Click Source Link
From source file:de.tuberlin.uebb.jbop.optimizer.controlflow.ConstantIfInlinerTest.java
License:Open Source License
/** * Tests that localVarInlinerLoop() of the Testobject is working correctly. * /*from ww w.j a v a 2 s . com*/ * @throws JBOPClassException * the jBOP class exception */ @Test public void testLocalVarInlinerLoop() throws JBOPClassException { // INIT final LabelNode label1 = new LabelNode(); final LabelNode label2 = new LabelNode(); builder.add(DCONST_0).// add(DSTORE, 2).// add(ICONST_1).// add(ISTORE, 1).// add(GOTO, label1).// addInsn(label2).// add(DCONST_0).// add(DLOAD, 2).// add(DADD).// add(DSTORE, 2).// add(IINC, 1, 1).// addInsn(label1).// addInsn(NodeHelper.getInsnNodeFor(3)).// add(ILOAD, 1).// add(Opcodes.IF_ICMPLT, label2).// add(DLOAD, 2).// addReturn(); // RUN constantIfInliner.optimize(method.instructions, method); // ASSERT assertFalse(constantIfInliner.isOptimized()); }
From source file:de.tuberlin.uebb.jbop.optimizer.loop.ForLoop.java
License:Open Source License
private boolean eval(final int i, final int loopCount, final int ifNode) { if (ifNode == Opcodes.IF_ICMPLE) { return i <= loopCount; }/*from w w w . j a va 2s . c om*/ if (ifNode == Opcodes.IF_ICMPEQ) { return i == loopCount; } if (ifNode == Opcodes.IF_ICMPGE) { return i >= loopCount; } if (ifNode == Opcodes.IF_ICMPGT) { return i > loopCount; } if (ifNode == Opcodes.IF_ICMPLT) { return i < loopCount; } if (ifNode == Opcodes.IF_ICMPNE) { return i != loopCount; } if (ifNode == Opcodes.IFGE) { return i >= 0; } if (ifNode == Opcodes.IFEQ) { return i == 0; } if (ifNode == Opcodes.IFGT) { return i > 0; } if (ifNode == Opcodes.IFLE) { return i <= 0; } if (ifNode == Opcodes.IFLT) { return i < 0; } if (ifNode == Opcodes.IFNE) { return i != 0; } return false; }
From source file:de.tuberlin.uebb.jbop.optimizer.loop.ForLoopUnrollerTest.java
License:Open Source License
/** * Tests that ForLoopUnroller is working correctly. * //w w w.j av a 2 s .c o m * Used is a loop of the kind: * * for(int i=0; i< 3; ++i) */ @Test public void testForLoopUnrollerStrictForward() { // INIT final LabelNode label1 = new LabelNode(); final LabelNode label2 = new LabelNode(); builder.addInsn(new InsnNode(Opcodes.ICONST_0)).// addInsn(new VarInsnNode(Opcodes.ISTORE, 1)).// addInsn(new JumpInsnNode(Opcodes.GOTO, label1)).// addInsn(label2).// addInsn(new VarInsnNode(Opcodes.ILOAD, 1)).// addInsn(new VarInsnNode(Opcodes.ILOAD, 1)).// addInsn(new InsnNode(Opcodes.IADD)).// addInsn(new IincInsnNode(1, 1)).// addInsn(label1).// addInsn(NodeHelper.getInsnNodeFor(3)).// addInsn(new VarInsnNode(Opcodes.ILOAD, 1)).// addInsn(new JumpInsnNode(Opcodes.IF_ICMPLT, label2)).// addInsn(new InsnNode(Opcodes.RETURN)); // RUN assertEquals(13, method.instructions.size()); final InsnList optimized = optimizer.optimize(method.instructions, method); // ASSERT assertEquals(19, optimized.size()); int node = 0; for (int i = 0; i < 3; ++i) { assertEquals(i, NodeHelper.getNumberValue(optimized.get(node)).intValue()); node++; assertEquals(Opcodes.ISTORE, optimized.get(node).getOpcode()); node++; assertEquals(Opcodes.ILOAD, optimized.get(node).getOpcode()); node++; assertEquals(Opcodes.ILOAD, optimized.get(node).getOpcode()); node++; assertEquals(Opcodes.IADD, optimized.get(node).getOpcode()); node++; assertEquals(Opcodes.NOP, optimized.get(node).getOpcode()); // this is the SkipMarkNode node++; } }
From source file:de.tuberlin.uebb.jbop.optimizer.utils.NodeHelper.java
License:Open Source License
/** * Checks if node is if cmp lt./*from w w w . j a va2s.c om*/ * * @param node * the node * @return true if node is if cmp lt */ public static boolean isIfCmpLt(final AbstractInsnNode node) { if (node == null) { return false; } return node.getOpcode() == Opcodes.IF_ICMPLT; }
From source file:de.tuberlin.uebb.jbop.optimizer.var.LocalVarInlinerTest.java
License:Open Source License
@Test public void testLocalVarInlinerLoop() { // INIT//www . j av a2 s. com final LabelNode label1 = new LabelNode(); final LabelNode label2 = new LabelNode(); builder.add(DCONST_0).// add(DSTORE, 2).// add(ICONST_1).// add(ISTORE, 1).// add(GOTO, label1).// addInsn(label2).// add(DCONST_0).// add(DLOAD, 2).// add(DADD).// add(DSTORE, 2).// add(IINC, 1, 1).// addInsn(label1).// addInsn(NodeHelper.getInsnNodeFor(3)).// add(ILOAD, 1).// add(Opcodes.IF_ICMPLT, label2).// add(DLOAD, 2).// addReturn(); // RUN optimizer.optimize(methodNode.instructions, methodNode); // ASSERT assertFalse(optimizer.isOptimized()); }
From source file:de.tuberlin.uebb.jbop.optimizer.var.LocalVarInlinerTest.java
License:Open Source License
@Test public void testLocalVarInlinerLoopOverArray() { // INIT/* ww w . j ava 2 s .c o m*/ final LabelNode label1 = new LabelNode(); final LabelNode label2 = new LabelNode(); builder.add(ICONST_0).// add(ISTORE, 1).// add(GOTO, label1).// addInsn(label2).// add(IINC, 1, 1).// addInsn(label1).// add(ALOAD, 2).// add(ARRAYLENGTH).// add(ILOAD, 1).// add(Opcodes.IF_ICMPLT, label2).// add(DLOAD, 2).// addReturn(); // RUN optimizer.optimize(methodNode.instructions, methodNode); // ASSERT assertFalse(optimizer.isOptimized()); }
From source file:de.tuberlin.uebb.jbop.optimizer.var.LocalVarInlinerTest.java
License:Open Source License
@Test public void testLocalVarInlinerEmptyLoop() { // INIT/* w w w .ja va2 s . c o m*/ final LabelNode label1 = new LabelNode(); final LabelNode label2 = new LabelNode(); builder.add(ICONST_1).// add(ISTORE, 1).// add(GOTO, label1).// addInsn(label2).// add(IINC, 1, 1).// addInsn(label1).// add(ICONST_3).// add(ILOAD, 1).// add(Opcodes.IF_ICMPLT, label2).// addReturn(); // RUN optimizer.optimize(methodNode.instructions, methodNode); // ASSERT assertFalse(optimizer.isOptimized()); }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.JumpInstruction.java
License:Open Source License
@Override public String toString() { String condition;/*from w w w. ja v a2 s .com*/ switch (getOpcode()) { case Opcodes.IFEQ: condition = "IFEQ"; break; case Opcodes.IFNE: condition = "IFNE"; break; case Opcodes.IFLT: condition = "IFLT"; break; case Opcodes.IFGE: condition = "IFGE"; break; case Opcodes.IFGT: condition = "IFGT"; break; case Opcodes.IFLE: condition = "IFLE"; break; case Opcodes.IF_ICMPEQ: condition = "IF_ICMPEQ"; break; case Opcodes.IF_ICMPNE: condition = "IF_ICMPNE"; break; case Opcodes.IF_ICMPLT: condition = "IF_ICMPLT"; break; case Opcodes.IF_ICMPGE: condition = "IF_ICMPGE"; break; case Opcodes.IF_ICMPGT: condition = "IF_ICMPGT"; break; case Opcodes.IF_ICMPLE: condition = "IF_ICMPLE"; break; case Opcodes.IF_ACMPEQ: condition = "IF_ACMPEQ"; break; case Opcodes.IF_ACMPNE: condition = "IF_ACMPNE"; break; case Opcodes.GOTO: condition = "GOTO"; break; case Opcodes.JSR: condition = "JSR"; break; case Opcodes.IFNULL: condition = "IFNULL"; break; case Opcodes.IFNONNULL: condition = "IFNONNULL"; break; default: assert false; condition = "--ERROR--"; break; } return condition + " " + this.label; }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.JumpInstruction2.java
License:Open Source License
@Override public String toString() { String condition;/*from www .j ava 2 s. c om*/ switch (getOpcode()) { case Opcodes.IFEQ: condition = "IFEQ"; break; case Opcodes.IFNE: condition = "IFNE"; break; case Opcodes.IFLT: condition = "IFLT"; break; case Opcodes.IFGE: condition = "IFGE"; break; case Opcodes.IFGT: condition = "IFGT"; break; case Opcodes.IFLE: condition = "IFLE"; break; case Opcodes.IF_ICMPEQ: condition = "IF_ICMPEQ"; break; case Opcodes.IF_ICMPNE: condition = "IF_ICMPNE"; break; case Opcodes.IF_ICMPLT: condition = "IF_ICMPLT"; break; case Opcodes.IF_ICMPGE: condition = "IF_ICMPGE"; break; case Opcodes.IF_ICMPGT: condition = "IF_ICMPGT"; break; case Opcodes.IF_ICMPLE: condition = "IF_ICMPLE"; break; case Opcodes.IF_ACMPEQ: condition = "IF_ACMPEQ"; break; case Opcodes.IF_ACMPNE: condition = "IF_ACMPNE"; break; case Opcodes.GOTO: condition = "GOTO"; break; case Opcodes.JSR: condition = "JSR"; break; case Opcodes.IFNULL: condition = "IFNULL"; break; case Opcodes.IFNONNULL: condition = "IFNONNULL"; break; default: assert false; condition = "--ERROR--"; break; } return condition + " " + this.target; }
From source file:de.zib.sfs.instrument.FileChannelImplAdapter.java
License:BSD License
protected void wrapFileChannelImplMethod(int access, String name, Type returnType, Type[] argumentTypes, String signature, String[] exceptions, String callbackName, String oppositeCallbackName, Type additionalCallbackArgumentType, int bufferArgumentTypeIndex, boolean isTransferMethod) { String methodDescriptor = Type.getMethodDescriptor(returnType, argumentTypes); // <access> <returnType> <name>(<argumentTypes> arguments) throws // <exceptions> { MethodVisitor mv = this.cv.visitMethod(access, name, methodDescriptor, signature, exceptions); mv.visitCode();// w w w . j av a 2 s.c o m // if (isInstrumentationActive()) { isInstrumentationActive(mv); Label instrumentationActiveLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, instrumentationActiveLabel); // return methodPrefix<name>(arguments); mv.visitVarInsn(Opcodes.ALOAD, 0); int argumentIndex = 1; for (Type argument : argumentTypes) { mv.visitVarInsn(argument.getOpcode(Opcodes.ILOAD), argumentIndex); argumentIndex += argument.getSize(); } mv.visitMethodInsn(Opcodes.INVOKESPECIAL, this.instrumentedTypeInternalName, this.methodPrefix + name, methodDescriptor, false); mv.visitInsn(returnType.getOpcode(Opcodes.IRETURN)); // } mv.visitLabel(instrumentationActiveLabel); // setInstrumentationActive(true); setInstrumentationActive(mv, true); // we need to set the instrumentation flag for the source/destination // buffer(s) as well // boolean bufferInstrumentationActive = false; int bufferInstrumentationActiveIndex = 1; for (Type argument : argumentTypes) { bufferInstrumentationActiveIndex += argument.getSize(); } mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(Opcodes.ISTORE, bufferInstrumentationActiveIndex); // obtain actual index of the buffer(s) in the argument list int bufferArgumentIndex = 1; for (int i = 0; i < bufferArgumentTypeIndex; ++i) { bufferArgumentIndex += argumentTypes[i].getSize(); } if (argumentTypes[bufferArgumentTypeIndex].getSort() == Type.ARRAY) { // If the first buffer in the array is a MappedByteBuffer, assume // they all are. If not, this will crash the users' program. // if (<buffers>[0] instanceof MappedByteBuffer) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ICONST_0); mv.visitInsn(Opcodes.AALOAD); mv.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(MappedByteBuffer.class)); Label bufferInstanceofMappedByteBufferLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, bufferInstanceofMappedByteBufferLabel); // only trace mmapped file channels if desired if (this.traceMmap) { // if (<buffers>[0].isFromFileChannel()) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ICONST_0); mv.visitInsn(Opcodes.AALOAD); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "isFromFileChannel", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), false); Label fromFileChannelLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, fromFileChannelLabel); int iIndex = bufferInstrumentationActiveIndex + 1; // for (int i = 0; i < <buffers>.length; ++i) { // <buffers>[i].setInstrumentationActive(true); // } mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(Opcodes.ISTORE, iIndex); Label loopConditionLabel = new Label(); mv.visitJumpInsn(Opcodes.GOTO, loopConditionLabel); Label loopStartLabel = new Label(); mv.visitLabel(loopStartLabel); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitVarInsn(Opcodes.ILOAD, iIndex); mv.visitInsn(Opcodes.AALOAD); mv.visitInsn(Opcodes.ICONST_1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); mv.visitIincInsn(iIndex, 1); mv.visitLabel(loopConditionLabel); mv.visitVarInsn(Opcodes.ILOAD, iIndex); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ARRAYLENGTH); mv.visitJumpInsn(Opcodes.IF_ICMPLT, loopStartLabel); // bufferInstrumentationActive = true; mv.visitInsn(Opcodes.ICONST_1); mv.visitVarInsn(Opcodes.ISTORE, bufferInstrumentationActiveIndex); // } mv.visitLabel(fromFileChannelLabel); } // } mv.visitLabel(bufferInstanceofMappedByteBufferLabel); } else { // We need to handle the transferFrom/transferTo methods a little // differently. Their "buffers" only need to be FileChannelImpls, // the rest remains the same. // if (buffer instanceof MappedByteBuffer) { // if (buffer instanceof FileChannelImpl) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); if (!isTransferMethod) { mv.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(MappedByteBuffer.class)); } else { mv.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(FileChannelImpl.class)); } Label bufferInstanceofMappedByteBufferLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, bufferInstanceofMappedByteBufferLabel); // additional check required if the buffer is a MappedByteBuffer, // and we want to trace those Label fromFileChannelLabel = new Label(); if (!isTransferMethod && this.traceMmap) { // if (buffer.isFromFileChannel()) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "isFromFileChannel", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), false); mv.visitJumpInsn(Opcodes.IFEQ, fromFileChannelLabel); } // either we're dealing with a FileChannelImpl (in a // transferTo/transferFrom method), or this is a regular read or // write and we want to count in mmapped buffers if (isTransferMethod || this.traceMmap) { // buffer.setInstrumentationActive(true); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ICONST_1); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, !isTransferMethod ? Type.getInternalName(MappedByteBuffer.class) : Type.getInternalName(FileChannelImpl.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); // bufferInstrumentationActive = true; mv.visitInsn(Opcodes.ICONST_1); mv.visitVarInsn(Opcodes.ISTORE, bufferInstrumentationActiveIndex); } if (!isTransferMethod && this.traceMmap) { // } mv.visitLabel(fromFileChannelLabel); } // } mv.visitLabel(bufferInstanceofMappedByteBufferLabel); } // long startTime = System.nanoTime(); int startTimeIndex = bufferInstrumentationActiveIndex + 1; storeTime(mv, startTimeIndex); // <returnType> result = methodPrefix<name>(arguments); mv.visitVarInsn(Opcodes.ALOAD, 0); argumentIndex = 1; for (Type argument : argumentTypes) { mv.visitVarInsn(argument.getOpcode(Opcodes.ILOAD), argumentIndex); argumentIndex += argument.getSize(); } mv.visitMethodInsn(Opcodes.INVOKESPECIAL, this.instrumentedTypeInternalName, this.methodPrefix + name, methodDescriptor, false); int resultIndex = startTimeIndex + 2; mv.visitVarInsn(returnType.getOpcode(Opcodes.ISTORE), resultIndex); int endTimeIndex = resultIndex + returnType.getSize(); // long endTime = System.nanoTime(); storeTime(mv, endTimeIndex); // if map(...) was involved in this, then it may have reset the // instrumentationActive flag if we don't trace mmap calls, so we need // to check again whether instrumentation is still active, and only // report the data then // if (isInstrumentationActive()) { isInstrumentationActive(mv); Label instrumentationStillActiveLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, instrumentationStillActiveLabel); // callback.<callbackName>(startTime, endTime, result); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, this.instrumentedTypeInternalName, "callback", this.callbackTypeDescriptor); mv.visitVarInsn(Opcodes.LLOAD, startTimeIndex); mv.visitVarInsn(Opcodes.LLOAD, endTimeIndex); mv.visitVarInsn(returnType.getOpcode(Opcodes.ILOAD), resultIndex); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, this.callbackTypeInternalName, callbackName, Type.getMethodDescriptor(Type.VOID_TYPE, Type.LONG_TYPE, Type.LONG_TYPE, additionalCallbackArgumentType), false); // } mv.visitLabel(instrumentationStillActiveLabel); // same for the buffer if (argumentTypes[bufferArgumentTypeIndex].getSort() != Type.ARRAY) { // if (buffer instanceof MappedByteBuffer) { // if (buffer instanceof FileChannelImpl) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); if (!isTransferMethod) { mv.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(MappedByteBuffer.class)); } else { mv.visitTypeInsn(Opcodes.INSTANCEOF, Type.getInternalName(FileChannelImpl.class)); } Label bufferInstanceofMappedByteBufferLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, bufferInstanceofMappedByteBufferLabel); // additional check required if the buffer is a MappedByteBuffer, // and we want to trace those Label fromFileChannelLabel = new Label(); if (!isTransferMethod && this.traceMmap) { // if (buffer.isFromFileChannel()) { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "isFromFileChannel", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), false); mv.visitJumpInsn(Opcodes.IFEQ, fromFileChannelLabel); } // either we're dealing with a FileChannelImpl (in a // transferTo/transferFrom method), which might have flipped its // instrumentationActive flag because mmap was used, or this is a // regular read or write and we want to count in mmapped buffers if (isTransferMethod || this.traceMmap) { // if traceMmap is true, then we could actually just set // bufferInstrumentationActive to true // bufferInstrumentationActive = // buffer.isInstrumentationActive(); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, !isTransferMethod ? Type.getInternalName(MappedByteBuffer.class) : Type.getInternalName(FileChannelImpl.class), "isInstrumentationActive", Type.getMethodDescriptor(Type.BOOLEAN_TYPE), false); mv.visitVarInsn(Opcodes.ISTORE, bufferInstrumentationActiveIndex); } if (!isTransferMethod && this.traceMmap) { // } mv.visitLabel(fromFileChannelLabel); } // } mv.visitLabel(bufferInstanceofMappedByteBufferLabel); } // if (bufferInstrumentationActive) { mv.visitVarInsn(Opcodes.ILOAD, bufferInstrumentationActiveIndex); Label bufferInstrumentationActiveLabel = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, bufferInstrumentationActiveLabel); // callback.<oppositeCallbackName>(buffer.getFileDescriptor(), // startTime, endTime, result); if (!isTransferMethod) { if (argumentTypes[bufferArgumentTypeIndex].getSort() == Type.ARRAY) { // TODO this calls the opposite callback only on the first // element in the buffer array, but there is not really a way to // tell which buffer has received how many bytes, and thus which // file mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ICONST_0); mv.visitInsn(Opcodes.AALOAD); } else { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); } mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "getFileDescriptor", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), false); } else { mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(FileChannelImpl.class), "getFileDescriptor", Type.getMethodDescriptor(Type.getType(FileDescriptor.class)), false); } mv.visitVarInsn(Opcodes.LLOAD, startTimeIndex); mv.visitVarInsn(Opcodes.LLOAD, endTimeIndex); mv.visitVarInsn(returnType.getOpcode(Opcodes.ILOAD), resultIndex); mv.visitMethodInsn(Opcodes.INVOKESTATIC, this.callbackTypeInternalName, oppositeCallbackName, Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(FileDescriptor.class), Type.LONG_TYPE, Type.LONG_TYPE, additionalCallbackArgumentType), false); // revert the active instrumentation flag for the buffer if (argumentTypes[bufferArgumentTypeIndex].getSort() == Type.ARRAY) { int iIndex = bufferInstrumentationActiveIndex + 1; // for (int i = 0; i < <buffers>.length; ++i) { // <buffers>[i].setInstrumentationActive(false); // } mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(Opcodes.ISTORE, iIndex); Label loopConditionLabel = new Label(); mv.visitJumpInsn(Opcodes.GOTO, loopConditionLabel); Label loopStartLabel = new Label(); mv.visitLabel(loopStartLabel); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitVarInsn(Opcodes.ILOAD, iIndex); mv.visitInsn(Opcodes.AALOAD); mv.visitInsn(Opcodes.ICONST_0); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(MappedByteBuffer.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); mv.visitIincInsn(iIndex, 1); mv.visitLabel(loopConditionLabel); mv.visitVarInsn(Opcodes.ILOAD, iIndex); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ARRAYLENGTH); mv.visitJumpInsn(Opcodes.IF_ICMPLT, loopStartLabel); } else { // buffer.setInstrumentationActive(false); mv.visitVarInsn(Opcodes.ALOAD, bufferArgumentIndex); mv.visitInsn(Opcodes.ICONST_0); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, !isTransferMethod ? Type.getInternalName(MappedByteBuffer.class) : Type.getInternalName(FileChannelImpl.class), "setInstrumentationActive", Type.getMethodDescriptor(Type.VOID_TYPE, Type.BOOLEAN_TYPE), false); } // } mv.visitLabel(bufferInstrumentationActiveLabel); // setInstrumentationActive(false); setInstrumentationActive(mv, false); // return result; // } mv.visitVarInsn(returnType.getOpcode(Opcodes.ILOAD), resultIndex); mv.visitInsn(returnType.getOpcode(Opcodes.IRETURN)); mv.visitMaxs(0, 0); mv.visitEnd(); }