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

G1BarrierSetAssembler::g1_write_barrier_post unnecessarily pushes/pops new_val

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 14
    • hotspot
    • gc
    • b23
    • x86, aarch64

      ## For x86 code

      Before calling the runtime to handle a full buffer, the code in G1BarrierSetAssembler::g1_write_barrier_post pushes and afterwards pops the register new_val.

      This is either unnecessary and/or a bug:

      It's caller, G1BarrierSetAssembler::oop_store_at(), depending on compressed oop mode moves the uncompressed new reference value into new_val since g1_write_barrier_post needs it to perform the out-of-region check.

      It does so because store_at() modifies the given val.

      That caller uses tmp2 for that, which is also used and modified in g1_write_barrier_post.
      So the value we save and restore before the call is some temporary value, which should not be needed, the save/restore is unnecessary (particularly with compressed oops).

      On the other hand, the caller of oop_store_at (or actually any caller of store_at()) might expect that the val register is not modified at all. In this case this save/restore is at the wrong place.

      ## For aarch64 code

      The same problem.

            ayang Albert Yang
            tschatzl Thomas Schatzl
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: