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

C2: simplify anti-dependence check in PhaseCFG::implicit_null_check()

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 17
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      The following loop in PhaseCFG::implicit_null_check() is guaranteed to run for exactly one iteration, and could be simplified accordingly:

            // mach use (faulting) trying to hoist
            // n might be blocker to hoisting
            while( b != block ) {
              ...
              b = get_block_for_node(b->pred(1)); // Move up to predecessor block
            }

      The reason is that, before the loop, 'block' (the null-check block) is guaranteed to be the direct predecessor of 'b' (the memory operation block). This invariant follows from earlier code in the same function, which ensures that 'block' is the immediate dominator of 'b' if 'b's memory operation is a store (for clarity, 'b' refers here to the memory operation block, instead of the original 'cb'):

          // Check ctrl input to see if the null-check dominates the memory op
          Block *b = get_block_for_node(mach);
          b = b->_idom; // Always hoist at least 1 block
          if( !was_store ) { // Stores can be hoisted only one block
            ...
            }
          }
          if( b != block ) continue;

      Due to the null-check shape of 'block' (where its successors cannot re-join), the fact that 'block' is the immediate dominator of 'b' implies 'block' is also the direct predecessor of 'b'.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rcastanedalo Roberto Castaneda Lozano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: