Skip to content

Commit 687a461

Browse files
committed
8302464: Parallel: Remove unreachable code in callers of numa_has_static_binding
Reviewed-by: lkorinth, tschatzl
1 parent 84c058b commit 687a461

File tree

4 files changed

+7
-87
lines changed

4 files changed

+7
-87
lines changed

src/hotspot/os/posix/os_posix.inline.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <netdb.h>
3636

3737
// Aix does not have NUMA support but need these for compilation.
38-
inline bool os::numa_has_static_binding() { AIX_ONLY(ShouldNotReachHere();) return true; }
3938
inline bool os::numa_has_group_homing() { AIX_ONLY(ShouldNotReachHere();) return false; }
4039

4140
// Platform Mutex/Monitor implementation

src/hotspot/os/windows/os_windows.inline.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ inline void os::map_stack_shadow_pages(address sp) {
5757
}
5858
}
5959

60-
inline bool os::numa_has_static_binding() { return true; }
6160
inline bool os::numa_has_group_homing() { return false; }
6261

6362
// Platform Mutex/Monitor implementation

src/hotspot/share/gc/parallel/mutableNUMASpace.cpp

Lines changed: 7 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -116,47 +116,12 @@ void MutableNUMASpace::ensure_parsability() {
116116
"Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")",
117117
words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size());
118118
CollectedHeap::fill_with_object(cur_top, words_to_fill);
119-
if (!os::numa_has_static_binding()) {
120-
size_t touched_words = words_to_fill;
121-
#ifndef ASSERT
122-
if (!ZapUnusedHeapArea) {
123-
touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)),
124-
touched_words);
125-
}
126-
#endif
127-
MemRegion invalid;
128-
HeapWord *crossing_start = align_up(cur_top, os::vm_page_size());
129-
HeapWord *crossing_end = align_down(cur_top + touched_words, os::vm_page_size());
130-
if (crossing_start != crossing_end) {
131-
// If object header crossed a small page boundary we mark the area
132-
// as invalid rounding it to a page_size().
133-
HeapWord *start = MAX2(align_down(cur_top, page_size()), s->bottom());
134-
HeapWord *end = MIN2(align_up(cur_top + touched_words, page_size()), s->end());
135-
invalid = MemRegion(start, end);
136-
}
137-
138-
ls->add_invalid_region(invalid);
139-
}
140119
cur_top += words_to_fill;
141120
words_left_to_fill -= words_to_fill;
142121
}
143122
}
144123
} else {
145-
if (!os::numa_has_static_binding()) {
146-
#ifdef ASSERT
147-
MemRegion invalid(s->top(), s->end());
148-
ls->add_invalid_region(invalid);
149-
#else
150-
if (ZapUnusedHeapArea) {
151-
MemRegion invalid(s->top(), s->end());
152-
ls->add_invalid_region(invalid);
153-
} else {
154-
return;
155-
}
156-
#endif
157-
} else {
158-
return;
159-
}
124+
return;
160125
}
161126
}
162127
}
@@ -278,18 +243,7 @@ void MutableNUMASpace::free_region(MemRegion mr) {
278243

279244
// Update space layout. Perform adaptation.
280245
void MutableNUMASpace::update() {
281-
bool should_initialize = false;
282-
if (!os::numa_has_static_binding()) {
283-
for (int i = 0; i < lgrp_spaces()->length(); i++) {
284-
if (!lgrp_spaces()->at(i)->invalid_region().is_empty()) {
285-
should_initialize = true;
286-
break;
287-
}
288-
}
289-
}
290-
291-
if (should_initialize ||
292-
(UseAdaptiveNUMAChunkSizing && adaptation_cycles() < samples_count())) {
246+
if (UseAdaptiveNUMAChunkSizing && adaptation_cycles() < samples_count()) {
293247
// A NUMA space is never mangled
294248
initialize(region(),
295249
SpaceDecorator::Clear,
@@ -605,31 +559,12 @@ void MutableNUMASpace::initialize(MemRegion mr,
605559
intersection = MemRegion(new_region.start(), new_region.start());
606560
}
607561

608-
if (!os::numa_has_static_binding()) {
609-
MemRegion invalid_region = ls->invalid_region().intersection(new_region);
610-
// Invalid region is a range of memory that could've possibly
611-
// been allocated on the other node. That's relevant only on Solaris where
612-
// there is no static memory binding.
613-
if (!invalid_region.is_empty()) {
614-
merge_regions(new_region, &intersection, &invalid_region);
615-
free_region(invalid_region);
616-
ls->set_invalid_region(MemRegion());
617-
}
618-
}
619-
620562
select_tails(new_region, intersection, &bottom_region, &top_region);
621563

622-
if (!os::numa_has_static_binding()) {
623-
// If that's a system with the first-touch policy then it's enough
624-
// to free the pages.
625-
free_region(bottom_region);
626-
free_region(top_region);
627-
} else {
628-
// In a system with static binding we have to change the bias whenever
629-
// we reshape the heap.
630-
bias_region(bottom_region, ls->lgrp_id());
631-
bias_region(top_region, ls->lgrp_id());
632-
}
564+
// In a system with static binding we have to change the bias whenever
565+
// we reshape the heap.
566+
bias_region(bottom_region, ls->lgrp_id());
567+
bias_region(top_region, ls->lgrp_id());
633568

634569
// Clear space (set top = bottom) but never mangle.
635570
s->initialize(new_region, SpaceDecorator::Clear, SpaceDecorator::DontMangle, MutableSpace::DontSetupPages);
@@ -664,18 +599,12 @@ void MutableNUMASpace::set_top(HeapWord* value) {
664599
}
665600
}
666601

667-
if (!os::numa_has_static_binding() && top < value && top < s->end()) {
668-
ls->add_invalid_region(MemRegion(top, value));
669-
}
670602
s->set_top(value);
671603
found_top = true;
672604
} else {
673605
if (found_top) {
674-
s->set_top(s->bottom());
606+
s->set_top(s->bottom());
675607
} else {
676-
if (!os::numa_has_static_binding() && top < s->end()) {
677-
ls->add_invalid_region(MemRegion(top, s->end()));
678-
}
679608
s->set_top(s->end());
680609
}
681610
}
@@ -742,12 +671,6 @@ HeapWord* MutableNUMASpace::cas_allocate(size_t size) {
742671
}
743672
}
744673

745-
// Make the page allocation happen here if there is no static binding.
746-
if (p != nullptr && !os::numa_has_static_binding() ) {
747-
for (HeapWord *i = p; i < p + size; i += os::vm_page_size() >> LogHeapWordSize) {
748-
*(int*)i = 0;
749-
}
750-
}
751674
if (p == nullptr) {
752675
ls->set_allocation_failed();
753676
}

src/hotspot/share/runtime/os.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ class os: AllStatic {
489489
static void realign_memory(char *addr, size_t bytes, size_t alignment_hint);
490490

491491
// NUMA-specific interface
492-
static bool numa_has_static_binding();
493492
static bool numa_has_group_homing();
494493
static void numa_make_local(char *addr, size_t bytes, int lgrp_hint);
495494
static void numa_make_global(char *addr, size_t bytes);

0 commit comments

Comments
 (0)