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

G1: Fix HeapRegion::block_is_obj for unloading class in full gc

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Subcomponent:
      gc
    • Resolved In Build:
      b19

      Description

      In JDK-8262068, we have introduced an enhancement to skip compacting some heap regions.
      But the objs in these regions might have been dead, and their classes might have been unloaded, at this situation, we need following change to make sure we don't get into trouble when calls HeapRegion::block_is_obj(const HeapWord* p) and subsequent calls e.g. to get obj size.


      --- a/src/hotspot/share/gc/g1/heapRegion.inline.hpp
      +++ b/src/hotspot/share/gc/g1/heapRegion.inline.hpp
      @@ -141,7 +141,12 @@ inline bool HeapRegion::block_is_obj(const HeapWord* p) const {
           assert(is_continues_humongous(), "This case can only happen for humongous regions");
           return (p == humongous_start_region()->bottom());
         }
      - if (ClassUnloadingWithConcurrentMark) {
      + // In full gc, we might have skipped compacting some heap regions with high live ratio,
      + // for objs in these regions, the corresponding class info might have been unloaded if
      + // they're not marked in the full gc.
      + // So, only when ClassUnloading is false, it's safe to tell an obj is indeed an obj when
      + // it's under the top of the region, otherwise we have to go to the slow path below.
      + if (ClassUnloading) {
           return !g1h->is_obj_dead(cast_to_oop(p), this);
         }
         return p < top();

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mli Hamlin Li
              Reporter:
              mli Hamlin Li
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: