-
Bug
-
Resolution: Fixed
-
P3
-
17
-
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();
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();
- relates to
-
JDK-8262068 Improve G1 Full GC by skipping compaction for regions with high survival ratio
-
- Resolved
-