JDK-8267833 : Improve G1CardSetInlinePtr::add()
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-27
  • Updated: 2021-08-16
  • Resolved: 2021-08-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18 masterFixed
Related Reports
Blocks :  
Description
Currently the method to add entries to the inline pointers is somewhat inefficient:

  // Check if the card is already stored in the pointer.
  if (contains(card_idx, bits_per_card)) {
    return Found;
  }
  // Check if there is actually enough space.
  if (card_pos_for(num_elems + 1, bits_per_card) >= BitsInValue) {
    return Overflow;
  }

I.e. contains() could actually return how many elements are already in the card set container.
Also, in the cmpxchg loop we start work looking for whether the element is already stored in there always from the beginning. That's not necessary, there is no overwriting of already inserted values in the inline pointer, only the recently added ones need to be looked at again.

Improve this.
Comments
Changeset: 83d0e128 Author: Ivan Walulya <iwalulya@openjdk.org> Date: 2021-08-16 13:08:36 +0000 URL: https://git.openjdk.java.net/jdk/commit/83d0e128e362822584bb51b00576cb754f44e58b
16-08-2021