JDK-8269821 : Remove is-queue-active check in inner loop of write_ref_array_pre_work
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-07-02
  • Updated: 2023-08-07
  • Resolved: 2021-07-05
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 17 JDK 18
17.0.8Fixed 18 b05Fixed
Related Reports
Relates :  
Description
G1BarrierSet::write_ref_array_pre_work roughly looks as follows:

if marking active -> exit

for all references in array:
  if array[i] != NULL
    enqueue(array[i])

enqueue every time checks again whether marking is active. In reality, the generated assembly code seems to load Thread::current() and does the check for every loop iteration which is really unnecessary.

Also some other code can be hoisted out of the loop which results in more compact generated code.
Comments
Fix Request (17u) Provides a little performance improvement and a cleaner ground for future backports. Applies cleanly, testing passes (see 17u PR).
21-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/905 Date: 2022-11-21 09:50:31 +0000
21-11-2022

Changeset: 675a9520 Author: Thomas Schatzl <tschatzl@openjdk.org> Date: 2021-07-05 07:24:10 +0000 URL: https://git.openjdk.java.net/jdk/commit/675a9520b21e7adfded8a4bb8b1a06c1dcc6ccfb
05-07-2021