code: public int getInstanceStackLocation(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException {
          int numConsumed = ins.consumeStack(cpg);
          if (numConsumed == Const.UNPREDICTABLE) {
              throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins);
          }
          return numConsumed - 1;
      }
docs: Get the stack location (counting down from top of stack, starting at 0)
  containing the object instance referred to by 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.
  
  <p>
  The value returned may be passed to getStackValue(int).
  </p>
  
  @param ins
  the Instruction
  @param cpg
  the ConstantPoolGen for the method
  @return stack location (counting down from top of stack, starting at 0)
  containing the object instance
  @throws DataflowAnalysisException