Example usage for org.objectweb.asm Opcodes ACONST_NULL

List of usage examples for org.objectweb.asm Opcodes ACONST_NULL

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ACONST_NULL.

Prototype

int ACONST_NULL

To view the source code for org.objectweb.asm Opcodes ACONST_NULL.

Click Source Link

Usage

From source file:org.formulacompiler.compiler.internal.bytecode.ExpressionCompiler.java

License:Open Source License

private final void compileInner(ExpressionNode _node) throws CompilerException {
    if (null == _node) {
        mv().visitInsn(Opcodes.ACONST_NULL);
        return;/*  w ww  .j  a  v a 2s  .  c o  m*/
    }

    final DataType nodeType = _node.getDataType();

    if (null == nodeType) {
        throw new CompilerException.UnsupportedDataType(
                "Internal error: Data type not set on node " + _node.describe() + ".");
    }

    else if (DataType.NULL != nodeType && dataType() != nodeType) {
        method().expressionCompiler(nodeType).compile(_node);
        compileConversionFrom(nodeType);
    }

    else if (_node instanceof ExpressionNodeForConstantValue) {
        compileConst(((ExpressionNodeForConstantValue) _node).value());
    }

    else if (_node instanceof ExpressionNodeForMinValue) {
        typeCompiler().compileMinValue(mv());
    }

    else if (_node instanceof ExpressionNodeForMaxValue) {
        typeCompiler().compileMaxValue(mv());
    }

    else if (_node instanceof ExpressionNodeForCellModel) {
        compileRef(((ExpressionNodeForCellModel) _node).getCellModel());
    }

    else if (_node instanceof ExpressionNodeForParentSectionModel) {
        compileRef((ExpressionNodeForParentSectionModel) _node);
    }

    else if (_node instanceof ExpressionNodeForSubSectionModel) {
        compileRef((ExpressionNodeForSubSectionModel) _node);
    }

    else if (_node instanceof ExpressionNodeForArrayReference) {
        compileRef((ExpressionNodeForArrayReference) _node);
    }

    else if (_node instanceof ExpressionNodeForOperator) {
        final ExpressionNodeForOperator node = (ExpressionNodeForOperator) _node;
        if (needsIf(node.getOperator())) {
            compileIf(node, ExpressionBuilder.TRUE, ExpressionBuilder.FALSE);
        } else {
            compileOperator(node);
        }
    }

    else if (_node instanceof ExpressionNodeForFunction) {
        final ExpressionNodeForFunction node = (ExpressionNodeForFunction) _node;
        switch (node.getFunction()) {

        case IF:
            compileIf(node);
            break;

        case NOT:
            compileIf(node, ExpressionBuilder.TRUE, ExpressionBuilder.FALSE);
            break;

        case AND:
        case OR:
            compileIf(node, ExpressionBuilder.TRUE, ExpressionBuilder.FALSE);
            break;

        default:
            compileFunction(node);
        }
    }

    else if (_node instanceof ExpressionNodeForSwitch) {
        compileSwitch((ExpressionNodeForSwitch) _node);
    }

    else if (_node instanceof ExpressionNodeForCount) {
        compileCount((ExpressionNodeForCount) _node);
    }

    else if (_node instanceof ExpressionNodeForLet) {
        compileLet((ExpressionNodeForLet) _node);
    }

    else if (_node instanceof ExpressionNodeForLetVar) {
        compileLetVar(((ExpressionNodeForLetVar) _node).varName());
    }

    else if (_node instanceof ExpressionNodeForFoldList) {
        compileFoldList((ExpressionNodeForFoldList) _node);
    }

    else if (_node instanceof ExpressionNodeForFoldVectors) {
        compileFoldVectors((ExpressionNodeForFoldVectors) _node);
    }

    else if (_node instanceof ExpressionNodeForFoldDatabase) {
        compileFoldDatabase((ExpressionNodeForFoldDatabase) _node);
    }

    else if (_node instanceof ExpressionNodeForLogging) {
        compileLogging((ExpressionNodeForLogging) _node);
    }

    else {
        throw new CompilerException.UnsupportedExpression(
                "Internal error: unsupported node type " + _node.describe() + ".");
    }
}

From source file:org.formulacompiler.compiler.internal.bytecode.MethodCompiler.java

License:Open Source License

private final void pushConstParam(Class _type, Object _constantValue) throws CompilerException {
    if (null == _constantValue) {
        mv().visitInsn(Opcodes.ACONST_NULL);
    }//  w  w  w  . j av a2 s .  c  om

    else if (_type == Byte.TYPE) {
        mv().push(((Number) _constantValue).byteValue());
    } else if (_type == Byte.class) {
        mv().push(((Number) _constantValue).byteValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;");
    }

    else if (_type == Short.TYPE) {
        mv().push(((Number) _constantValue).shortValue());
    } else if (_type == Short.class) {
        mv().push(((Number) _constantValue).shortValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;");
    }

    else if (_type == Integer.TYPE) {
        mv().push(((Number) _constantValue).intValue());
    } else if (_type == Integer.class) {
        mv().push(((Number) _constantValue).intValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
    }

    else if (_type == Long.TYPE) {
        mv().push(((Number) _constantValue).longValue());
    } else if (_type == Long.class) {
        mv().push(((Number) _constantValue).longValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;");
    }

    else if (_type == Double.TYPE) {
        mv().push(((Number) _constantValue).doubleValue());
    } else if (_type == Double.class) {
        mv().push(((Number) _constantValue).doubleValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;");
    }

    else if (_type == Float.TYPE) {
        mv().push(((Number) _constantValue).floatValue());
    } else if (_type == Float.class) {
        mv().push(((Number) _constantValue).floatValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;");
    }

    else if (_type == Character.TYPE) {
        mv().push(((Character) _constantValue).charValue());
    } else if (_type == Character.class) {
        mv().push(((Character) _constantValue).charValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                "(C)Ljava/lang/Character;");
    }

    else if (_type == Boolean.TYPE) {
        mv().push(((Boolean) _constantValue).booleanValue());
    } else if (_type == Boolean.class) {
        mv().push(((Boolean) _constantValue).booleanValue());
        mv().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;");
    }

    else if (_type == String.class) {
        mv().visitLdcInsn(_constantValue);
    }

    else if (_type == Date.class) {
        mv().visitLdcInsn(_constantValue);
    }

    else if (_constantValue instanceof Enum) {
        final Enum enumValue = (Enum) _constantValue;
        final Type enumType = Type.getType(enumValue.getDeclaringClass());
        final Type instanceType = Type.getType(enumValue.getClass());
        mv().getStatic(enumType, enumValue.name(), instanceType);
    }

    else {
        throw new CompilerException.UnsupportedDataType(
                "The data type '" + _type + "' is not supported as an input method parameter.");
    }
}

From source file:org.formulacompiler.compiler.internal.bytecode.SectionCompiler.java

License:Open Source License

void compileAccessTo(SubSectionCompiler _sub) throws CompilerException {
    newField(Opcodes.ACC_PRIVATE, _sub.getterName(), _sub.arrayDescriptor());
    new SubSectionLazyGetterCompiler(this, _sub).compile();

    final CallFrame[] callsToImplement = _sub.model().getCallsToImplement();
    for (CallFrame callToImplement : callsToImplement) {
        new SubSectionOutputAccessorCompiler(this, _sub, callToImplement).compile();
    }//from   w  w  w.  j  a va  2  s.c o  m

    // In reset(), do:
    if (hasReset()) {
        // $<section> = null;
        final GeneratorAdapter r = resetter();
        r.loadThis();
        r.visitInsn(Opcodes.ACONST_NULL);
        r.putField(classType(), _sub.getterName(), _sub.arrayType());
    }
}

From source file:org.formulacompiler.compiler.internal.bytecode.SectionCompiler.java

License:Open Source License

protected boolean callConstructorWithInputs(GeneratorAdapter _mv, int _inputsVar) {
    try {/*  ww  w . j  ava2 s  . c o m*/
        outputClass().getConstructor(inputClass()); // ensure it is here and accessible
    } catch (NoSuchMethodException e) {
        return false;
    }

    _mv.loadThis();
    if (0 <= _inputsVar) {
        _mv.visitVarInsn(Opcodes.ALOAD, _inputsVar);
    } else {
        _mv.visitInsn(Opcodes.ACONST_NULL);
    }
    _mv.visitMethodInsn(Opcodes.INVOKESPECIAL, outputType().getInternalName(), "<init>",
            "(" + inputType().getDescriptor() + ")V");

    return true;
}

From source file:org.formulacompiler.compiler.internal.bytecode.SubSectionCompiler.java

License:Open Source License

@Override
protected boolean callConstructorWithInputs(GeneratorAdapter _mv, int _inputsVar) {
    final int P_PARENT = 2;

    // try super( _inputs, _parent );
    try {/*from  w  ww  . ja  v  a  2 s.  co  m*/
        // ensure it is here and accessible
        outputClass().getConstructor(inputClass(), parentSectionCompiler().model().getOutputClass());
    } catch (NoSuchMethodException e) {
        return super.callConstructorWithInputs(_mv, _inputsVar);
    }

    _mv.loadThis();
    if (0 <= _inputsVar) {
        _mv.visitVarInsn(Opcodes.ALOAD, _inputsVar);
    } else {
        _mv.visitInsn(Opcodes.ACONST_NULL);
    }
    _mv.visitVarInsn(Opcodes.ALOAD, P_PARENT);
    _mv.visitMethodInsn(Opcodes.INVOKESPECIAL, outputType().getInternalName(), "<init>",
            "(" + inputType().getDescriptor() + parentSectionCompiler().outputType().getDescriptor() + ")V");

    return true;
}

From source file:org.formulacompiler.compiler.internal.bytecode.TypeCompilerForStrings.java

License:Open Source License

@Override
protected void compileConst(GeneratorAdapter _mv, Object _value) throws CompilerException {
    if (null == _value) {
        _mv.visitInsn(Opcodes.ACONST_NULL);
    } else if (_value instanceof String) {
        _mv.push((String) _value);
    } else {/*from   www.  j a v a  2 s  .com*/
        throw new CompilerException.UnsupportedDataType(
                "String constant cannot be of type " + _value.getClass().getName() + ".");
    }
}

From source file:org.glassfish.pfl.tf.spi.Util.java

License:Open Source License

public void initLocal(MethodVisitor mv, LocalVariableNode var) {
    info(2, "Initializing variable " + var);
    Type type = Type.getType(var.desc);
    switch (type.getSort()) {
    case Type.BYTE:
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.SHORT:
    case Type.INT:
        mv.visitInsn(Opcodes.ICONST_0);// ww  w  . j  a  v a 2  s . c  om
        mv.visitVarInsn(Opcodes.ISTORE, var.index);
        break;

    case Type.LONG:
        mv.visitInsn(Opcodes.LCONST_0);
        mv.visitVarInsn(Opcodes.LSTORE, var.index);
        break;

    case Type.FLOAT:
        mv.visitInsn(Opcodes.FCONST_0);
        mv.visitVarInsn(Opcodes.FSTORE, var.index);
        break;

    case Type.DOUBLE:
        mv.visitInsn(Opcodes.DCONST_0);
        mv.visitVarInsn(Opcodes.DSTORE, var.index);
        break;

    default:
        mv.visitInsn(Opcodes.ACONST_NULL);
        mv.visitVarInsn(Opcodes.ASTORE, var.index);
    }
}

From source file:org.gradle.groovy.scripts.AsmBackedEmptyScriptGenerator.java

License:Apache License

private <T extends Script> Class<? extends T> generateEmptyScriptClass(Class<T> type) {
    ClassWriter visitor = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    String typeName = type.getName() + "_Decorated";
    Type generatedType = Type.getType("L" + typeName.replaceAll("\\.", "/") + ";");
    Type superclassType = Type.getType(type);
    visitor.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, generatedType.getInternalName(), null,
            superclassType.getInternalName(), new String[0]);

    // Constructor

    String constructorDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[0]);
    MethodVisitor methodVisitor = visitor.visitMethod(Opcodes.ACC_PUBLIC, "<init>", constructorDescriptor, null,
            new String[0]);
    methodVisitor.visitCode();//  w w w  .  ja v a  2 s  .  com

    // super()
    methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, superclassType.getInternalName(), "<init>",
            constructorDescriptor);

    methodVisitor.visitInsn(Opcodes.RETURN);
    methodVisitor.visitMaxs(0, 0);
    methodVisitor.visitEnd();

    // run() method

    String runDesciptor = Type.getMethodDescriptor(Type.getType(Object.class), new Type[0]);
    methodVisitor = visitor.visitMethod(Opcodes.ACC_PUBLIC, "run", runDesciptor, null, new String[0]);
    methodVisitor.visitCode();

    // return null
    methodVisitor.visitInsn(Opcodes.ACONST_NULL);

    methodVisitor.visitInsn(Opcodes.ARETURN);
    methodVisitor.visitMaxs(0, 0);
    methodVisitor.visitEnd();

    visitor.visitEnd();

    byte[] bytecode = visitor.toByteArray();
    return (Class<T>) ReflectionUtil.invoke(type.getClassLoader(), "defineClass",
            new Object[] { typeName, bytecode, 0, bytecode.length });
}

From source file:org.jacoco.core.instr.ResizeInstructionsTest.java

License:Open Source License

/**
 * Adds code that requires/*from  w ww  . j  av a2 s. c  om*/
 * {@link ClassWriter#getCommonSuperClass(String, String)}.
 *
 * <pre>
 * Object o = this;
 * while (true) {
 *    o = (Integer) null;
 * }
 * </pre>
 */
private static void addCauseOfGetCommonSuperClass(final MethodVisitor mv) {
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitVarInsn(Opcodes.ASTORE, 1);
    Label label = new Label();
    mv.visitLabel(label);
    mv.visitInsn(Opcodes.ACONST_NULL);
    mv.visitTypeInsn(Opcodes.CHECKCAST, "java/lang/Integer");
    mv.visitVarInsn(Opcodes.ASTORE, 1);
    mv.visitJumpInsn(Opcodes.GOTO, label);
}

From source file:org.jacoco.core.internal.analysis.filter.TryWithResourcesEcjFilterTest.java

License:Open Source License

/**
 * ECJ for/*w w  w . j  ava 2s .com*/
 *
 * <pre>
 *     try (r0 = ...; r1 = ...; r2= ...) {
 *         ...
 *     } finally (...) {
 *         ...
 *     }
 *     ...
 * </pre>
 *
 * generates
 *
 * <pre>
 *     ACONST_NULL
 *     ASTORE primaryExc
 *     ACONST_NULL
 *     ASTORE suppressedExc
 *     ...
 *     ASTORE r1
 *     ...
 *     ASTORE r2
 *     ...
 *     ASTORE r3
 *
 *     ... // body
 *
 *     ALOAD r3
 *     IFNULL r2_close
 *     ALOAD r3
 *     INVOKEVIRTUAL close:()V
 *     GOTO r2_close
 *
 *     ASTORE primaryExc
 *     ALOAD r3
 *     IFNULL n
 *     ALOAD r3
 *     INVOKEVIRTUAL close:()V
 *     n:
 *     ALOAD primaryExc
 *     ATHROW
 *
 *     r2_close:
 *     ALOAD r2
 *     IFNULL r1_close
 *     ALOAD r2
 *     INVOKEVIRTUAL close:()V
 *     GOTO r1_close
 *
 *     ASTORE suppressedExc
 *     ALOAD primaryExc
 *     IFNONNULL s
 *     ALOAD suppressedExc
 *     ASTORE primaryExc
 *     GOTO e
 *     s:
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     IF_ACMPEQ e
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V
 *     e:
 *
 *     ALOAD r2
 *     IFNULL n
 *     ALOAD r2
 *     INVOKEVIRTUAL close:()V
 *     n:
 *     ALOAD primaryExc
 *     ATHROW
 *
 *     r1_close:
 *     ALOAD r1
 *     IFNULL after
 *     ALOAD r1
 *     INVOKEVIRTUAL close:()V
 *     GOTO after
 *
 *     ASTORE suppressedExc
 *     ALOAD primaryExc
 *     IFNONNULL s
 *     ALOAD suppressedExc
 *     ASTORE primaryExc
 *     GOTO e
 *     s:
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     IF_ACMPEQ e
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V
 *     e:
 *
 *     ALOAD r1
 *     IFNULL n
 *     ALOAD r1
 *     INVOKEVIRTUAL close:()V
 *     n:
 *     ALOAD primaryExc
 *     ATHROW
 *
 *     ASTORE suppressedExc
 *     ALOAD primaryExc
 *     IFNONNULL s
 *     ALOAD suppressedExc
 *     ASTORE primaryExc
 *     GOTO e
 *     s:
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     IF_ACMPEQ e
 *     ALOAD primaryExc
 *     ALOAD suppressedExc
 *     INVOKEVIRTUAL java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V
 *     e:
 *
 *     ALOAD primaryExc
 *     ATHROW
 *
 *     ... // additional handlers for catch blocks and finally on exceptional path
 *
 *     after:
 *     ... // finally on normal path
 *     ...
 * </pre>
 */
@Test
public void ecj() {
    final Range range0 = new Range();
    final Range range1 = new Range();

    final Label handler = new Label();
    m.visitTryCatchBlock(handler, handler, handler, null);

    // primaryExc = null
    m.visitInsn(Opcodes.ACONST_NULL);
    m.visitVarInsn(Opcodes.ASTORE, 1);
    // suppressedExc = null
    m.visitInsn(Opcodes.ACONST_NULL);
    m.visitVarInsn(Opcodes.ASTORE, 2);

    // body
    m.visitInsn(Opcodes.NOP);

    final Label l4 = new Label();
    final Label l7 = new Label();
    final Label end = new Label();
    { // nextIsEcjClose("r0")
        m.visitVarInsn(Opcodes.ALOAD, 5);
        range0.fromInclusive = m.instructions.getLast();
        m.visitJumpInsn(Opcodes.IFNULL, l4);
        m.visitVarInsn(Opcodes.ALOAD, 5);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
    }
    m.visitJumpInsn(Opcodes.GOTO, l4);
    range0.toInclusive = m.instructions.getLast();
    // catch (any primaryExc)
    m.visitLabel(handler);
    range1.fromInclusive = m.instructions.getLast();
    m.visitVarInsn(Opcodes.ASTORE, 1);
    { // nextIsEcjCloseAndThrow("r0")
        m.visitVarInsn(Opcodes.ALOAD, 5);
        Label l11 = new Label();
        m.visitJumpInsn(Opcodes.IFNULL, l11);
        m.visitVarInsn(Opcodes.ALOAD, 5);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
        m.visitLabel(l11);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitInsn(Opcodes.ATHROW);
    }
    m.visitLabel(l4);
    { // nextIsEcjClose("r1")
        m.visitVarInsn(Opcodes.ALOAD, 4);
        m.visitJumpInsn(Opcodes.IFNULL, l7);
        m.visitVarInsn(Opcodes.ALOAD, 4);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
    }
    m.visitJumpInsn(Opcodes.GOTO, l7);
    { // nextIsEcjSuppress
        m.visitVarInsn(Opcodes.ASTORE, 2);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        final Label suppressStart = new Label();
        m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitVarInsn(Opcodes.ASTORE, 1);
        final Label suppressEnd = new Label();
        m.visitJumpInsn(Opcodes.GOTO, suppressEnd);
        m.visitLabel(suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed",
                "(Ljava/lang/Throwable;)V", false);
        m.visitLabel(suppressEnd);
    }
    { // nextIsEcjCloseAndThrow("r1")
        m.visitVarInsn(Opcodes.ALOAD, 4);
        final Label l14 = new Label();
        m.visitJumpInsn(Opcodes.IFNULL, l14);
        m.visitVarInsn(Opcodes.ALOAD, 4);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
        m.visitLabel(l14);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitInsn(Opcodes.ATHROW);
    }
    m.visitLabel(l7);
    { // nextIsEcjClose("r2")
        m.visitVarInsn(Opcodes.ALOAD, 3);
        m.visitJumpInsn(Opcodes.IFNULL, end);
        m.visitVarInsn(Opcodes.ALOAD, 3);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
        m.visitJumpInsn(Opcodes.GOTO, end);
    }
    { // nextIsEcjSuppress
        m.visitVarInsn(Opcodes.ASTORE, 2);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        final Label suppressStart = new Label();
        m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitVarInsn(Opcodes.ASTORE, 1);
        final Label suppressEnd = new Label();
        m.visitJumpInsn(Opcodes.GOTO, suppressEnd);
        m.visitLabel(suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed",
                "(Ljava/lang/Throwable;)V", false);
        m.visitLabel(suppressEnd);
    }
    { // nextIsEcjCloseAndThrow("r2")
        m.visitVarInsn(Opcodes.ALOAD, 3);
        final Label l18 = new Label();
        m.visitJumpInsn(Opcodes.IFNULL, l18);
        m.visitVarInsn(Opcodes.ALOAD, 3);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "Fun2$Resource", "close", "()V", false);
        m.visitLabel(l18);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitInsn(Opcodes.ATHROW);
    }
    { // nextIsEcjSuppress
        m.visitVarInsn(Opcodes.ASTORE, 2);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        final Label suppressStart = new Label();
        m.visitJumpInsn(Opcodes.IFNONNULL, suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitVarInsn(Opcodes.ASTORE, 1);
        final Label suppressEnd = new Label();
        m.visitJumpInsn(Opcodes.GOTO, suppressEnd);
        m.visitLabel(suppressStart);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitJumpInsn(Opcodes.IF_ACMPEQ, suppressEnd);
        m.visitVarInsn(Opcodes.ALOAD, 1);
        m.visitVarInsn(Opcodes.ALOAD, 2);
        m.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "addSuppressed",
                "(Ljava/lang/Throwable;)V", false);
        m.visitLabel(suppressEnd);
    }
    // throw primaryExc
    m.visitVarInsn(Opcodes.ALOAD, 1);
    m.visitInsn(Opcodes.ATHROW);
    range1.toInclusive = m.instructions.getLast();

    // additional handlers
    m.visitInsn(Opcodes.NOP);

    filter.filter(m, context, output);

    assertIgnored(range0, range1);
}