/** * Get the value corresponding to the object instance used in the given * instruction. This relies on the observation that in instructions which * use an object instance (such as getfield, invokevirtual, etc.), the * object instance is the first operand used by the instruction. * * @param ins * the instruction * @param cpg * the ConstantPoolGen for the method */ public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { return getStackValue(getInstanceStackLocation(ins, cpg)); }
/** * Get the <i>i</i>th argument passed to given method invocation. * * @param ins * the method invocation instruction * @param cpg * the ConstantPoolGen for the class containing the method * @param i * index of the argument; 0 for the first argument, etc. * @return the <i>i</i>th argument * @throws DataflowAnalysisException */ public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, SignatureParser sigParser) throws DataflowAnalysisException { if (i >= sigParser.getNumParameters()) { throw new IllegalArgumentException("requesting parameter # " + i + " of " + sigParser); } return getStackValue(sigParser.getSlotsFromTopOfStackForParameter(i)); }
/** * Get the <i>i</i>th operand used by given instruction. * * @param ins * the instruction, which must be a StackConsumer * @param cpg * the ConstantPoolGen * @param i * index of operand to get: 0 for the first operand, etc. * @return the <i>i</i>th operand used by the given instruction * @throws DataflowAnalysisException */ public ValueType getOperand(StackConsumer ins, ConstantPoolGen cpg, int i) throws DataflowAnalysisException { int numOperands = ins.consumeStack(cpg); if (numOperands == Const.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins); } return getStackValue((numOperands - 1) - i); }
/** * Get the value corresponding to the object instance used in the given * instruction. This relies on the observation that in instructions which * use an object instance (such as getfield, invokevirtual, etc.), the * object instance is the first operand used by the instruction. * * @param ins * the instruction * @param cpg * the ConstantPoolGen for the method */ public ValueType getInstance(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { return getStackValue(getInstanceStackLocation(ins, cpg)); }
/** * Get the <i>i</i>th argument passed to given method invocation. * * @param ins * the method invocation instruction * @param cpg * the ConstantPoolGen for the class containing the method * @param i * index of the argument; 0 for the first argument, etc. * @return the <i>i</i>th argument * @throws DataflowAnalysisException */ public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, SignatureParser sigParser) throws DataflowAnalysisException { if (i >= sigParser.getNumParameters()) { throw new IllegalArgumentException("requesting parameter # " + i + " of " + sigParser); } return getStackValue(sigParser.getSlotsFromTopOfStackForParameter(i)); }
/** * Get the <i>i</i>th operand used by given instruction. * * @param ins * the instruction, which must be a StackConsumer * @param cpg * the ConstantPoolGen * @param i * index of operand to get: 0 for the first operand, etc. * @return the <i>i</i>th operand used by the given instruction * @throws DataflowAnalysisException */ public ValueType getOperand(StackConsumer ins, ConstantPoolGen cpg, int i) throws DataflowAnalysisException { int numOperands = ins.consumeStack(cpg); if (numOperands == Constants.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins); } return getStackValue((numOperands - 1) - i); }