G1: Micro-optimize x86 barrier code

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 25, 26
    • Component/s: hotspot
    • gc

      I noticed in disassembly for G1 barriers that we have are missing a few easy things for code density in our hand-written assembly for G1 barriers:
       *) cmpptr(reg, 0) -> testptr(reg, reg)
       *) jcc -> jccb for forward branches, where obvious
       *) jmp -> jmpb for forward jumps, where obvious

      A simple patch already gives me about 1.2% savings even without compiling a lot of code.

      for I in `seq 1 3`; do build/linux-x86_64-server-release/images/jdk/bin/java -Xcomp -XX:+CITime 2>&1 | grep "nmethod code"; done

      # Before
        nmethod code size : 5764304 bytes
        nmethod code size : 5764336 bytes
        nmethod code size : 5764480 bytes

      # After
        nmethod code size : 5691032 bytes
        nmethod code size : 5691032 bytes
        nmethod code size : 5691000 bytes

            Assignee:
            Aleksey Shipilev
            Reporter:
            Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: