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

C2: Micro-optimize PhaseIdealLoop::Dominators()

XMLWordPrintable

    • b22

      Noticed this while looking at Leyden profiles. C2 seems to spend considerable time doing in this code:

      void PhaseIdealLoop::Dominators() {
        ...
        NTarjan *ntarjan = NEW_RESOURCE_ARRAY(NTarjan,C->unique()+1);
        // Initialize _control field for fast reference
        int i;
        for( i= C->unique()-1; i>=0; i-- )
          ntarjan[i]._control = nullptr;

      The disassembly shows this loop is fairly hot. Replacing the initialization with memset, while touching more memory, is apparently faster. We seem to touch a lot (all?) these structs later on, so pulling them to cache with memset is likely "free".

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: