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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 17
    • 17
    • hotspot
    • gc
    • b19

      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();

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

              Created:
              Updated:
              Resolved: