JDK-8224840 : Optimize G1CardTable::mark_region_table()
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 13
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2019-05-27
  • Updated: 2021-08-31
  • Resolved: 2021-08-31
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.
Other
tbdResolved
Related Reports
Blocks :  
Duplicate :  
Description
The code for merging the cards of coarse PRTs could be optimized.
Comments
This does *not* work for fine PRTs (not sure what I was thinking when I suggested that). That would make all the clean cards in a card word be dirty, rather than the (possibly just one) card indicated by the remset bitmap. [~tschatzl] suggested a table lookup approach to process multiple bits at a time. He also pointed out the problem of multiple threads attempting to update the same word based on different remsets, which would introduce CAS, which makes the word at a time updates possibly much less attractive.
08-06-2019

Some more ideas [~tschatzl] and I talked about. - It might be worth recognizing the case of any coarse PRTs for a region, and just doing one pass of that and done. - clean_to_dirty might be fast enough to make some conditional "fast" cases in the coarse loop (checking for all clean or all dirty) not worth special casing.
07-06-2019

Kim suggested to do the merging based on some bit twiddling: // Changes clean bytes to dirty, while preserving already_scanned bytes. // 1...11 => 0...00 -- clean to dirty // 0...01 => 0...01 -- already_scanned preserved // 0...00 => 0...00 -- dirty preserved inline size_t clean_to_dirty(size_t value) { STATIC_ASSERT(BitsPerByte == 8); STATIC_ASSERT(WordAllClean == SIZE_MAX); STATIC_ASSERT(WordAllDirty == 0); STATIC_ASSERT(g1_card_already_scanned == 1); return (value ^ (value >> 1)) & (SIZE_MAX / 255); } The same method could be applied to the fine PRT case: To process a fine set (1) find the next set bit (2) round down that position to word align in the card table (3) clean_to_dirty that word of the card table (4) set start bit for next search to correspond to next word in card table (5) loop until done
07-06-2019