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

ZGC: refine estimation of C2's barrier stub size

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • hotspot

      ZBarrierSetC2::estimate_stub_size() always returns 0, because the list of stubs (barrier_set_state()->stubs()) is populated (by ZBarrierStubC2::register_stub()) after estimate_stub_size() is called. Here is an ad-hoc trace of a method compilation with two stubs:

      ZBarrierSetC2::register_stub() (in_scratch_emit_size, nothing happens)
      ZBarrierSetC2::register_stub() (in_scratch_emit_size, nothing happens)
      ZBarrierSetC2::estimate_stub_size() (stubs->length() == 0, so returned size is 0)
      ZBarrierSetC2::register_stub() (appends stub: stubs->length() == 1)
      ZBarrierSetC2::register_stub() (in_scratch_emit_size, nothing happens)
      ZBarrierSetC2::register_stub() (appends stub: stubs->length() == 2)
      ZBarrierSetC2::register_stub() (in_scratch_emit_size, nothing happens)

      The consequence is potentially extra unnecessary reallocations (but not malfunctioning, because underestimations are taken care of). The number of reallocations might be mitigated by the fact that additional space is allocated currently. This RFE proposes making the necessary adjustments so that estimate_stub_size() does take into account the actual size of the stubs.

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

              Created:
              Updated: