Skip to content

Commit 4ed5e62

Browse files
committed
Debugging breadcrumbs
1 parent ee3b308 commit 4ed5e62

File tree

5 files changed

+28
-136
lines changed

5 files changed

+28
-136
lines changed

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,8 +2779,13 @@ HeapWord* ShenandoahHeap::allocate_loaded_archive_space(size_t size) {
27792779
// Flip humongous -> regular.
27802780
{
27812781
ShenandoahHeapLocker locker(lock(), false);
2782+
// The 'waste' in the last region is no longer wasted at this point,
2783+
// so we must stop treating it as such.
2784+
ShenandoahHeapRegion* last = get_region(start_idx + num_regions - 1);
2785+
last->decrement_humongous_waste();
27822786
for (size_t c = start_idx; c < start_idx + num_regions; c++) {
2783-
get_region(c)->make_regular_bypass();
2787+
ShenandoahHeapRegion* r = get_region(c);
2788+
r->make_regular_bypass();
27842789
}
27852790
}
27862791

@@ -2802,7 +2807,7 @@ void ShenandoahHeap::complete_loaded_archive_space(MemRegion archive_space) {
28022807
HeapWord* cur = start;
28032808
while (cur < end) {
28042809
oop oop = cast_to_oop(cur);
2805-
shenandoah_assert_in_correct_region(nullptr, oop);
2810+
shenandoah_assert_correct(nullptr, oop);
28062811
cur += oop->size();
28072812
}
28082813

@@ -2811,11 +2816,19 @@ void ShenandoahHeap::complete_loaded_archive_space(MemRegion archive_space) {
28112816
"Archive space should be fully used: " PTR_FORMAT " " PTR_FORMAT,
28122817
p2i(cur), p2i(end));
28132818

2819+
size_t begin_reg_idx = heap_region_index_containing(start);
2820+
size_t end_reg_idx = heap_region_index_containing(end);
2821+
for (size_t idx = begin_reg_idx; idx <= end_reg_idx; idx++) {
2822+
ShenandoahHeapRegion* r = get_region(idx);
2823+
assert(r->is_regular(), "Must be");
2824+
assert(r->get_update_watermark() == r->bottom(), "Must be");
2825+
assert(idx == end_reg_idx || r->top() == r->end(), "Must be");
2826+
assert(r->affiliation() == YOUNG_GENERATION, "Should be young");
2827+
}
2828+
28142829
// Region bounds are good.
2815-
ShenandoahHeapRegion* begin_reg = heap_region_containing(start);
2816-
ShenandoahHeapRegion* end_reg = heap_region_containing(end);
2817-
assert(begin_reg->is_regular(), "Must be");
2818-
assert(end_reg->is_regular(), "Must be");
2830+
ShenandoahHeapRegion* begin_reg = get_region(begin_reg_idx);
2831+
ShenandoahHeapRegion* end_reg = get_region(end_reg_idx);
28192832
assert(begin_reg->bottom() == start,
28202833
"Must agree: archive-space-start: " PTR_FORMAT ", begin-region-bottom: " PTR_FORMAT,
28212834
p2i(start), p2i(begin_reg->bottom()));

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,13 @@ void ShenandoahHeapRegion::make_regular_bypass() {
147147
ShenandoahHeap::heap()->is_degenerated_gc_in_progress(),
148148
"Only for STW GC or when Universe is initializing (CDS)");
149149
reset_age();
150-
auto cur_state = state();
151-
switch (cur_state) {
150+
switch (state()) {
152151
case _empty_uncommitted:
153152
do_commit();
154153
case _empty_committed:
155154
case _cset:
156155
case _humongous_start:
157156
case _humongous_cont:
158-
if (cur_state == _humongous_start || cur_state == _humongous_cont) {
159-
// CDS allocates chunks of the heap to fill with regular objects. The allocator
160-
// will dutifully track any waste in the unused portion of the last region. Once
161-
// CDS has finished initializing the objects, it will convert these regions to
162-
// regular regions. The 'waste' in the last region is no longer wasted at this point,
163-
// so we must stop treating it as such.
164-
decrement_humongous_waste();
165-
}
166157
set_state(_regular);
167158
return;
168159
case _pinned_cset:
@@ -813,6 +804,9 @@ void ShenandoahHeapRegion::do_commit() {
813804
if (AlwaysPreTouch) {
814805
os::pretouch_memory(bottom(), end(), heap->pretouch_heap_page_size());
815806
}
807+
if (ZapUnusedHeapArea) {
808+
SpaceMangler::mangle_region(MemRegion(_bottom, _end));
809+
}
816810
heap->increase_committed(ShenandoahHeapRegion::region_size_bytes());
817811
}
818812

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,9 @@ class ShenandoahHeapRegion {
491491
_needs_bitmap_reset = false;
492492
}
493493

494-
private:
495494
void decrement_humongous_waste() const;
495+
496+
private:
496497
void do_commit();
497498
void do_uncommit();
498499

src/hotspot/share/memory/iterator.inline.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
5555
if (cld != nullptr) {
5656
ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
5757
} else {
58-
assert(AOTLinkedClassBulkLoader::is_pending_aot_linked_class(k), "sanity");
58+
ResourceMark rm;
59+
assert(AOTLinkedClassBulkLoader::is_pending_aot_linked_class(k), "sanity: %s", k->external_name());
5960
}
6061
}
6162

test/hotspot/jtreg/gc/shenandoah/TestAllocIntArrays.java

Lines changed: 1 addition & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -23,83 +23,6 @@
2323
*
2424
*/
2525

26-
/*
27-
* @test id=passive
28-
* @summary Acceptance tests: collector can withstand allocation
29-
* @key randomness
30-
* @requires vm.gc.Shenandoah
31-
* @library /test/lib
32-
*
33-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
34-
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
35-
* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify
36-
* TestAllocIntArrays
37-
*
38-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
39-
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
40-
* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify
41-
* TestAllocIntArrays
42-
*
43-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
44-
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
45-
* -XX:+ShenandoahDegeneratedGC
46-
* TestAllocIntArrays
47-
*
48-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
49-
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
50-
* -XX:-ShenandoahDegeneratedGC
51-
* TestAllocIntArrays
52-
*/
53-
54-
/*
55-
* @test id=aggressive
56-
* @summary Acceptance tests: collector can withstand allocation
57-
* @key randomness
58-
* @requires vm.gc.Shenandoah
59-
* @library /test/lib
60-
*
61-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
62-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
63-
* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify
64-
* TestAllocIntArrays
65-
*
66-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
67-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
68-
* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify
69-
* TestAllocIntArrays
70-
*
71-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
72-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
73-
* -XX:+ShenandoahOOMDuringEvacALot
74-
* TestAllocIntArrays
75-
*
76-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
77-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
78-
* -XX:+ShenandoahAllocFailureALot
79-
* TestAllocIntArrays
80-
*
81-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
82-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
83-
* TestAllocIntArrays
84-
*/
85-
86-
/*
87-
* @test id=adaptive
88-
* @summary Acceptance tests: collector can withstand allocation
89-
* @key randomness
90-
* @requires vm.gc.Shenandoah
91-
* @library /test/lib
92-
*
93-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
94-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
95-
* -XX:+ShenandoahVerify
96-
* TestAllocIntArrays
97-
*
98-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
99-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
100-
* TestAllocIntArrays
101-
*/
102-
10326
/*
10427
* @test id=generational
10528
* @summary Acceptance tests: collector can withstand allocation
@@ -109,50 +32,10 @@
10932
*
11033
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
11134
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational
112-
* -XX:+ShenandoahVerify
113-
* TestAllocIntArrays
114-
*
115-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
116-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational
35+
* -XX:+ShenandoahVerify -Xlog:aot
11736
* TestAllocIntArrays
11837
*/
11938

120-
/*
121-
* @test id=static
122-
* @summary Acceptance tests: collector can withstand allocation
123-
* @key randomness
124-
* @requires vm.gc.Shenandoah
125-
* @library /test/lib
126-
*
127-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
128-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
129-
* TestAllocIntArrays
130-
*/
131-
132-
/*
133-
* @test id=compact
134-
* @summary Acceptance tests: collector can withstand allocation
135-
* @key randomness
136-
* @requires vm.gc.Shenandoah
137-
* @library /test/lib
138-
*
139-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
140-
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
141-
* TestAllocIntArrays
142-
*/
143-
144-
/*
145-
* @test id=no-tlab
146-
* @summary Acceptance tests: collector can withstand allocation
147-
* @key randomness
148-
* @requires vm.gc.Shenandoah
149-
* @library /test/lib
150-
*
151-
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
152-
* -XX:+UseShenandoahGC
153-
* -XX:-UseTLAB -XX:+ShenandoahVerify
154-
* TestAllocIntArrays
155-
*/
15639
import java.util.Random;
15740
import jdk.test.lib.Utils;
15841

0 commit comments

Comments
 (0)