src/main/java/org/plumelib/bcelutil/InstructionListUtils.java
protected final StackMapType[] calculate_live_local_types(MethodGen mg, int location) {
    int max_local_index = -1;
    StackMapType[] local_map_types = new StackMapType[mg.getMaxLocals()];
    Arrays.fill(local_map_types, new StackMapType(Const.ITEM_Bogus, -1, pool.getConstantPool()));
    for (LocalVariableGen lv : mg.getLocalVariables()) {
      if (location >= lv.getStart().getPosition()) {
        if (lv.getLiveToEnd() || location < lv.getEnd().getPosition()) {
          int i = lv.getIndex();
          local_map_types[i] = generate_StackMapType_from_Type(lv.getType());
          max_local_index = Math.max(max_local_index, i);
        }
      }
    }
    return Arrays.copyOf(local_map_types, max_local_index + 1);
  }
protected final StackMapType[] calculate_live_local_types(MethodGen mg, int location) {
    int max_local_index = -1;
    StackMapType[] local_map_types = new StackMapType[mg.getMaxLocals()];
    Arrays.fill(local_map_types, new StackMapType(Const.ITEM_Bogus, -1, pool.getConstantPool()));
    for (LocalVariableGen lv : mg.getLocalVariables()) {
      if (location >= lv.getStart().getPosition()) {
        if (lv.getLiveToEnd() || location < lv.getEnd().getPosition()) {
          int i = lv.getIndex();
          local_map_types[i] = generate_StackMapType_from_Type(lv.getType());
          max_local_index = Math.max(max_local_index, i);
        }
      }
    }
    return Arrays.copyOf(local_map_types, max_local_index + 1);
  }
Compute the StackMapTypes of the live variables of the current method at a specific location
within the method. There may be gaps ("Bogus" or non-live slots) so we can't just count the
number of live variables, we must find the max index of all the live variables.

@param mg MethodGen for the current method
@param location the code location to be evaluated
@return an array of StackMapType describing the live locals at location