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

Update the comment of PhaseIdealLoop::has_ctrl()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 21
    • hotspot
    • generic
    • generic

      Here is current comment:
        // Set/get control node out. Set lower bit to distinguish from IdealLoopTree
        // Returns true if "n" is a data node, false if it's a control node.

      I think it is opposite! has_ctrl(n) returns true if it's a control node (the lowest bit is set). it returns false when it is a IdealLoopTree* data.

      We can deduce this from real code. eg.
      1. getLoop() asserts that has_ctrl(n) == false
        IdealLoopTree *get_loop( Node *n ) const {
          // Dead nodes have no loop, so return the top level loop instead
          if (!has_node(n)) return _ltree_root;
          assert(!has_ctrl(n), "");
          return (IdealLoopTree*)_nodes[n->_idx];
        }

      2. when we set ctrl, either n is dead or has_ctrl(n) is true.
        void set_ctrl( Node *n, Node *ctrl ) {
          assert( !has_node(n) || has_ctrl(n), "" );
          assert( ctrl->in(0), "cannot set dead control node" );
          assert( ctrl == find_non_split_ctrl(ctrl), "must set legal crtl" );
          _nodes.map( n->_idx, (Node*)((intptr_t)ctrl + 1) );
        }


      update:
      I misunderstood the comment. if we define control node is "a CFG node or pinned node", then yes, return false if it's a control node.

            xliu Xin Liu
            xliu Xin Liu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: