Example usage for org.objectweb.asm.tree.analysis Interpreter unaryOperation

List of usage examples for org.objectweb.asm.tree.analysis Interpreter unaryOperation

Introduction

In this page you can find the example usage for org.objectweb.asm.tree.analysis Interpreter unaryOperation.

Prototype

public abstract V unaryOperation(AbstractInsnNode insn, V value) throws AnalyzerException;

Source Link

Document

Interprets a bytecode instruction with a single argument.

Usage

From source file:com.dragome.callbackevictor.serverside.bytecode.transformation.asm.MonitoringFrame.java

License:Apache License

public void execute(AbstractInsnNode insn, Interpreter interpreter) throws AnalyzerException {

    boolean never = false;
    if (never) {//from  w w w . j a  v  a 2 s  .c  o m
        super.execute(insn, interpreter);
        return;
    }

    int insnOpcode = insn.getOpcode();

    if (insnOpcode == Opcodes.MONITORENTER || insnOpcode == Opcodes.MONITOREXIT) {
        Value pop = pop();
        interpreter.unaryOperation(insn, pop);

        int local = -1;
        for (int i = 0; i < getLocals(); i++) {
            if (getLocal(i) == pop)
                local = i;
        }

        if (local > -1) {
            if (insnOpcode == Opcodes.MONITORENTER) {
                monitorEnter(local);
            } else {
                monitorExit(local);
            }
        }

    } else {
        super.execute(insn, interpreter);
    }
}