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

Incorrect sorting of DirtyCardQueue buffers

    XMLWordPrintable

Details

    • gc
    • b02

    Description

      When refining a buffer of cards, the buffer is first sorted, to improve locality. However, the sort function's return type is wrong. G1RefineBufferedCards::compare_card uses the difference between the cards as the result (negative -> lt, zero -> eq, positive -> gt). But it returns an int, so discards all but the low 32 bits of that difference. This renders the "sort" potentially more of a "randomizer". However, since the pointers being compared are in the card table, the range of the results probably fit in 32bits. Only for really large heaps or small card sizes (after JDK-8272773 made GCCardSizeInBytes configurable) are we likely to lose any bits from the narrowing conversion.

      Attachments

        Issue Links

          Activity

            People

              kbarrett Kim Barrett
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: