From d9c84e763a0880d33586dbb8dc90b66ede030444 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 11 Apr 2024 05:24:33 +0000 Subject: [PATCH] 8329656: assertion failed in MAP_ARCHIVE_MMAP_FAILURE path: Invalid immediate -5 0 Reviewed-by: ccheung, iklam --- src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp index 47b6f1f2f38..54af69ffaba 100644 --- a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp @@ -57,15 +57,15 @@ static char* reserve_at_eor_compatible_address(size_t size, bool aslr) { 0x7800, 0x7c00, 0x7e00, 0x7f00, 0x7f80, 0x7fc0, 0x7fe0, 0x7ff0, 0x7ff8, 0x7ffc, 0x7ffe, 0x7fff }; - static constexpr int num_immediates = sizeof(immediates) / sizeof(immediates[0]); - const int start_index = aslr ? os::next_random((int)os::javaTimeNanos()) : 0; + static constexpr unsigned num_immediates = sizeof(immediates) / sizeof(immediates[0]); + const unsigned start_index = aslr ? os::next_random((int)os::javaTimeNanos()) : 0; constexpr int max_tries = 64; for (int ntry = 0; result == nullptr && ntry < max_tries; ntry ++) { // As in os::attempt_reserve_memory_between, we alternate between higher and lower // addresses; this maximizes the chance of early success if part of the address space // is not accessible (e.g. 39-bit address space). - const int alt_index = (ntry & 1) ? 0 : num_immediates / 2; - const int index = (start_index + ntry + alt_index) % num_immediates; + const unsigned alt_index = (ntry & 1) ? 0 : num_immediates / 2; + const unsigned index = (start_index + ntry + alt_index) % num_immediates; const uint64_t immediate = ((uint64_t)immediates[index]) << 32; assert(immediate > 0 && Assembler::operand_valid_for_logical_immediate(/*is32*/false, immediate), "Invalid immediate %d " UINT64_FORMAT, index, immediate);