コード例 #1
0
  /** ************************************************************************** */
  private void insertIndirectionAndPrediction(boolean isPrediction, int position) {

    int[] newIndirection = new int[indirection.length + 1];
    boolean[] newPrediction = new boolean[newIndirection.length];

    for (int i = 0; i < position; i++) {
      newIndirection[i] = indirection[i];
      newPrediction[i] = prediction[i];
    }

    if (isPrediction) {
      if (newTableHackVariable) newIndirection[position] = 0;
      else newIndirection[position] = predictionColumnsTable.getNumColumns();
    } else newIndirection[position] = original.getNumColumns();

    newPrediction[position] = isPrediction;

    for (int i = position + 1; i < newIndirection.length; i++) {
      newIndirection[i] = indirection[i - 1];
      newPrediction[i] = prediction[i - 1];
    }

    indirection = newIndirection;
    prediction = newPrediction;

    // also might need to modify predictionSet
    if (isPrediction) {

      int[] newPredictionSet = new int[predictionSet.length + 1];
      for (int i = 0; i < predictionSet.length; i++) newPredictionSet[i] = predictionSet[i];
      newPredictionSet[predictionSet.length] = getNumColumns();

      predictionSet = newPredictionSet;
    }

    for (int i = 0; i < predictionSet.length; i++)
      if (predictionSet[i] > position) predictionSet[i]++;

    // Arrays.sort(predictionSet);

  }
コード例 #2
0
  public int getNumColumns() {
    if (newTableHackVariable) return original.getNumColumns();

    return (original.getNumColumns() + predictionColumnsTable.getNumColumns());
  }