diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 594d8817322..06298949e0a 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -2219,7 +2219,7 @@ address FileMapInfo::heap_region_dumptime_address() { assert(CDSConfig::is_using_archive(), "runtime only"); assert(is_aligned(r->mapping_offset(), sizeof(HeapWord)), "must be"); if (UseCompressedOops) { - return /*dumptime*/ narrow_oop_base() + r->mapping_offset(); + return /*dumptime*/ (address)((uintptr_t)narrow_oop_base() + r->mapping_offset()); } else { return heap_region_requested_address(); } @@ -2245,7 +2245,7 @@ address FileMapInfo::heap_region_requested_address() { // Runtime base = 0x4000 and shift is also 0. If we map this region at 0x5000, then // the value P can remain 0x1200. The decoded address = (0x4000 + (0x1200 << 0)) = 0x5200, // which is the runtime location of the referenced object. - return /*runtime*/ CompressedOops::base() + r->mapping_offset(); + return /*runtime*/ (address)((uintptr_t)CompressedOops::base() + r->mapping_offset()); } else { // This was the hard-coded requested base address used at dump time. With uncompressed oops, // the heap range is assigned by the OS so we will most likely have to relocate anyway, no matter diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 0e4e4a4660d..69b39fcbdeb 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -443,7 +443,7 @@ void ReservedHeapSpace::try_reserve_range(char *highest_start, while (attach_point >= lowest_start && attach_point <= highest_start && // Avoid wrap around. ((_base == nullptr) || - (_base < aligned_heap_base_min_address || _base + size > upper_bound))) { + (_base < aligned_heap_base_min_address || size > (uintptr_t)(upper_bound - _base)))) { try_reserve_heap(size, alignment, page_size, attach_point); attach_point -= stepsize; }