8342011: Conditionally compile ReservedHeapSpace compressed heap support
Reviewed-by: stefank, dholmes
This commit is contained in:
parent
e0c6480cd3
commit
5a4b180965
src/hotspot/share/memory
@ -369,6 +369,9 @@ ReservedSpace ReservedSpace::space_for_range(char* base, size_t size, size_t ali
|
||||
return space;
|
||||
}
|
||||
|
||||
// Compressed oop support is not relevant in 32bit builds.
|
||||
#ifdef _LP64
|
||||
|
||||
static size_t noaccess_prefix_size(size_t alignment) {
|
||||
return lcm(os::vm_page_size(), alignment);
|
||||
}
|
||||
@ -594,8 +597,8 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
|
||||
// Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode.
|
||||
char** addresses = get_attach_addresses_for_disjoint_mode();
|
||||
int i = 0;
|
||||
while (addresses[i] && // End of array not yet reached.
|
||||
((_base == nullptr) || // No previous try succeeded.
|
||||
while ((addresses[i] != nullptr) && // End of array not yet reached.
|
||||
((_base == nullptr) || // No previous try succeeded.
|
||||
(_base + size > (char *)OopEncodingHeapMax && // Not zerobased or unscaled address.
|
||||
!CompressedOops::is_disjoint_heap_base_address((address)_base)))) { // Not disjoint address.
|
||||
char* const attach_point = addresses[i];
|
||||
@ -612,6 +615,8 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LP64
|
||||
|
||||
ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_size, const char* heap_allocation_directory) : ReservedSpace() {
|
||||
|
||||
if (size == 0) {
|
||||
@ -636,6 +641,7 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_
|
||||
guarantee(is_aligned(size, alignment), "set by caller");
|
||||
|
||||
if (UseCompressedOops) {
|
||||
#ifdef _LP64
|
||||
initialize_compressed_heap(size, alignment, page_size);
|
||||
if (_size > size) {
|
||||
// We allocated heap with noaccess prefix.
|
||||
@ -643,6 +649,9 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_
|
||||
// if we had to try at arbitrary address.
|
||||
establish_noaccess_prefix();
|
||||
}
|
||||
#else
|
||||
ShouldNotReachHere();
|
||||
#endif // _LP64
|
||||
} else {
|
||||
initialize(size, alignment, page_size, nullptr, false);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* 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)
|
||||
// Class encapsulating behavior specific of memory space reserved for Java heap.
|
||||
class ReservedHeapSpace : public ReservedSpace {
|
||||
private:
|
||||
|
||||
// Compressed oop support is not relevant in 32bit builds.
|
||||
#ifdef _LP64
|
||||
|
||||
void try_reserve_heap(size_t size, size_t alignment, size_t page_size,
|
||||
char *requested_address);
|
||||
void try_reserve_range(char *highest_start, char *lowest_start,
|
||||
@ -141,6 +145,9 @@ class ReservedHeapSpace : public ReservedSpace {
|
||||
void initialize_compressed_heap(const size_t size, size_t alignment, size_t page_size);
|
||||
// Create protection page at the beginning of the space.
|
||||
void establish_noaccess_prefix();
|
||||
|
||||
#endif // _LP64
|
||||
|
||||
public:
|
||||
// Constructor. Tries to find a heap that is good for compressed oops.
|
||||
// heap_allocation_directory is the path to the backing memory for Java heap. When set, Java heap will be allocated
|
||||
|
Loading…
x
Reference in New Issue
Block a user