org.objectweb.asm.tree.analysis.Value Java Examples

The following examples show how to use org.objectweb.asm.tree.analysis.Value. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StackHelper.java    From zelixkiller with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Determines if two frames are compatible.
 * 
 * @param oldFrame
 * @param afterRET
 * @param interpreter2
 * @return
 */
public boolean isMergeCompatible(StackFrame oldFrame, StackFrame afterRET) {
	if (oldFrame == null || oldFrame.getStackSize() != afterRET.getStackSize()) {
		return false;
	}
	boolean changes = false;
	for (int i = 0; i < oldFrame.getLocals() + oldFrame.getStackSize(); ++i) {
		Value v = afterRET.getStack(i);
		if (v != null && !v.equals(oldFrame.getStack(i))) {
			changes = true;
		}
	}
	return changes;
}
 
Example #2
Source File: MonitoringFrame.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(AbstractInsnNode insn, Interpreter interpreter) throws AnalyzerException {

    boolean never = false;
    if (never) {
        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);
    }
}
 
Example #3
Source File: MonitoringFrame.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(AbstractInsnNode insn, Interpreter interpreter) throws AnalyzerException {

    boolean never = false;
    if (never) {
        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);
    }
}
 
Example #4
Source File: FastClassVerifier.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public Value merge(Value v, Value w) {
    if (!v.equals(w)) {
        Type t = ((BasicValue)v).getType();
        Type u = ((BasicValue)w).getType();
        int tsort = t == null ? -1 : t.getSort();
        if (tsort == Type.OBJECT || tsort == Type.ARRAY) {
            int usort = u == null ? -1 : u.getSort();
            if (usort == Type.OBJECT || usort == Type.ARRAY) {
                if ("Lnull;".equals(t.getDescriptor())) {
                    return w;
                }
                if ("Lnull;".equals(u.getDescriptor())) {
                    return v;
                }
                if (isAssignableFrom(t, u)) {
                    return v;
                }
                if (isAssignableFrom(u, t)) {
                    return w;
                }
                return new BasicValue(classHierarchy.getCommonSuperType(t, u));
            }
        }
        return BasicValue.UNINITIALIZED_VALUE;
    }
    return v;
}
 
Example #5
Source File: MonitoringFrame.java    From tascalate-javaflow with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(AbstractInsnNode insn, Interpreter interpreter) throws AnalyzerException {

    boolean never = false;
    if (never) {
        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);
    }
}