8256213: Remove os::split_reserved_memory

Reviewed-by: ccheung, iklam
This commit is contained in:
Yumin Qi 2020-12-18 20:23:43 +00:00
parent be41468c83
commit 06c24e14eb
6 changed files with 7 additions and 70 deletions

View file

@ -3193,34 +3193,6 @@ char* os::replace_existing_mapping_with_file_mapping(char* base, size_t size, in
return map_memory_to_file(base, size, fd);
}
// On win32, one cannot release just a part of reserved memory, it's an
// all or nothing deal. When we split a reservation, we must break the
// reservation into two reservations.
void os::split_reserved_memory(char *base, size_t size, size_t split) {
char* const split_address = base + split;
assert(size > 0, "Sanity");
assert(size > split, "Sanity");
assert(split > 0, "Sanity");
assert(is_aligned(base, os::vm_allocation_granularity()), "Sanity");
assert(is_aligned(split_address, os::vm_allocation_granularity()), "Sanity");
const bool rc = release_memory(base, size) &&
(attempt_reserve_memory_at(base, split) != NULL) &&
(attempt_reserve_memory_at(split_address, size - split) != NULL);
if (!rc) {
log_warning(os)("os::split_reserved_memory failed for " RANGE_FORMAT,
RANGE_FORMAT_ARGS(base, size));
os::print_memory_mappings(base, size, tty);
assert(false, "os::split_reserved_memory failed for " RANGE_FORMAT,
RANGE_FORMAT_ARGS(base, size));
}
// NMT: nothing to do here. Since Windows implements the split by
// releasing and re-reserving memory, the parts are already registered
// as individual mappings with NMT.
}
// Multiple threads can race in this code but it's not possible to unmap small sections of
// virtual space to get requested alignment, like posix-like os's.
// Windows prevents multiple thread from remapping over each other so this loop is thread-safe.