Java Code Examples for org.apache.bcel.generic.InvokeInstruction#consumeStack()

The following examples show how to use org.apache.bcel.generic.InvokeInstruction#consumeStack() . 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: Stream.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private ResourceValue getInstanceValue(ResourceValueFrame frame, InvokeInstruction inv, ConstantPoolGen cpg) {
    int numConsumed = inv.consumeStack(cpg);
    if (numConsumed == Const.UNPREDICTABLE) {
        throw new IllegalStateException();
    }
    return frame.getValue(frame.getNumSlots() - numConsumed);
}
 
Example 2
Source File: Frame.java    From spotbugs with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Get the number of arguments passed to given method invocation, including
 * the object instance if the call is to an instance method.
 *
 * @param ins
 *            the method invocation instruction
 * @param cpg
 *            the ConstantPoolGen for the class containing the method
 * @return number of arguments, including object instance if appropriate
 * @throws DataflowAnalysisException
 */
public int getNumArgumentsIncludingObjectInstance(InvokeInstruction ins, ConstantPoolGen cpg)
        throws DataflowAnalysisException {
    int numConsumed = ins.consumeStack(cpg);
    if (numConsumed == Const.UNPREDICTABLE) {
        throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins);
    }
    return numConsumed;
}