Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277496

Remove duplication in c1 Block successor lists

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 18
    • 18
    • hotspot
    • b27

    Description

      The list of successors of a block in c1 seems to not have a single source of truth, but be duplicated in `BlockBegin::_successors` and `BlockEnd::_sux`. Removing this duplication would simplify a lot of verification code, and remove bug surface area.

      Some hints that this is a true duplication:

      c1_Instruction performs assertions on matching before element access:
      ```
      inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); }
      inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); }
      inline void BlockBegin::add_successor(BlockBegin* sux) { assert(_end == NULL, "Would create mismatch with successors of BlockEnd"); _successors.append(sux); }
      ```

      And the _successor field is commented as "factor out later":
      ```
        // SSA specific fields: (factor out later)
        BlockList _successors; // the successors of this block
        BlockList _predecessors; // the predecessors of this block
        BlockList _dominates; // list of blocks that are dominated by this block
        BlockBegin* _dominator; // the dominator of this block
        // SSA specific ends
      ```

      It's possible that all four of these fields should be factored out.

      Attachments

        Issue Links

          Activity

            People

              lujaniuk Ludvig Janiuk
              lujaniuk Ludvig Janiuk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: