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

Fix missing missing volatile specifiers in CAS operations in GC code

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u20, 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b140

      Description

      GC code uses CAS to exchange values to avoid real locks in a few places.

      This must be done with care, as compilers must be prevented from putting local variables into registers using volatile specifiers. Issues like JDK-8033545 frequently pop up.

      Look through (GC) code that uses these Atomic instructions (Atomic::cmpxchg_ptr, Atomic::cmpxchg) and make sure there might not be problems due to valid compiler optimizations.

      A first look identified at least the following potential places for such issues:

      void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr) rereading _dirty_cards_region_list
      HeapRegion* G1CollectedHeap::pop_dirty_cards_region(), rereading _dirty_cards_region_list
      PerRegionTable::bulk_free, rereading _free_list
      PerRegionTable*::alloc(HeapRegion* hr), rereading _free_list
      mutableNUMASpace.cpp: 850, rereading top() [end()]
      MutableSpace::cas_allocate(size_t size), rereading top(), end()
      DefNewGeneration::allocate()
      ContiguousSpace::par_allocate_impl() ,rereading top(), end()
      ConcEdenSpace::par_allocate(), probably the OrderAccess::loadload() helps?

      runtime.cpp:1348: head = _named_counters;

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                eosterlund Erik Österlund
                Reporter:
                tschatzl Thomas Schatzl
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: