Skip to content

Commit 5a4b180

Browse files
author
Kim Barrett
committed
8342011: Conditionally compile ReservedHeapSpace compressed heap support
Reviewed-by: stefank, dholmes
1 parent e0c6480 commit 5a4b180

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/hotspot/share/memory/virtualspace.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ ReservedSpace ReservedSpace::space_for_range(char* base, size_t size, size_t ali
369369
return space;
370370
}
371371

372+
// Compressed oop support is not relevant in 32bit builds.
373+
#ifdef _LP64
374+
372375
static size_t noaccess_prefix_size(size_t alignment) {
373376
return lcm(os::vm_page_size(), alignment);
374377
}
@@ -594,8 +597,8 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
594597
// Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode.
595598
char** addresses = get_attach_addresses_for_disjoint_mode();
596599
int i = 0;
597-
while (addresses[i] && // End of array not yet reached.
598-
((_base == nullptr) || // No previous try succeeded.
600+
while ((addresses[i] != nullptr) && // End of array not yet reached.
601+
((_base == nullptr) || // No previous try succeeded.
599602
(_base + size > (char *)OopEncodingHeapMax && // Not zerobased or unscaled address.
600603
!CompressedOops::is_disjoint_heap_base_address((address)_base)))) { // Not disjoint address.
601604
char* const attach_point = addresses[i];
@@ -612,6 +615,8 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
612615
}
613616
}
614617

618+
#endif // _LP64
619+
615620
ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_size, const char* heap_allocation_directory) : ReservedSpace() {
616621

617622
if (size == 0) {
@@ -636,13 +641,17 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_
636641
guarantee(is_aligned(size, alignment), "set by caller");
637642

638643
if (UseCompressedOops) {
644+
#ifdef _LP64
639645
initialize_compressed_heap(size, alignment, page_size);
640646
if (_size > size) {
641647
// We allocated heap with noaccess prefix.
642648
// It can happen we get a zerobased/unscaled heap with noaccess prefix,
643649
// if we had to try at arbitrary address.
644650
establish_noaccess_prefix();
645651
}
652+
#else
653+
ShouldNotReachHere();
654+
#endif // _LP64
646655
} else {
647656
initialize(size, alignment, page_size, nullptr, false);
648657
}

src/hotspot/share/memory/virtualspace.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,10 @@ ReservedSpace ReservedSpace::partition(size_t offset, size_t partition_size)
133133
// Class encapsulating behavior specific of memory space reserved for Java heap.
134134
class ReservedHeapSpace : public ReservedSpace {
135135
private:
136+
137+
// Compressed oop support is not relevant in 32bit builds.
138+
#ifdef _LP64
139+
136140
void try_reserve_heap(size_t size, size_t alignment, size_t page_size,
137141
char *requested_address);
138142
void try_reserve_range(char *highest_start, char *lowest_start,
@@ -141,6 +145,9 @@ class ReservedHeapSpace : public ReservedSpace {
141145
void initialize_compressed_heap(const size_t size, size_t alignment, size_t page_size);
142146
// Create protection page at the beginning of the space.
143147
void establish_noaccess_prefix();
148+
149+
#endif // _LP64
150+
144151
public:
145152
// Constructor. Tries to find a heap that is good for compressed oops.
146153
// heap_allocation_directory is the path to the backing memory for Java heap. When set, Java heap will be allocated

0 commit comments

Comments
 (0)