< prev index next >

src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp

Print this page

101     result = reserve_address_space_for_16bit_move(size, aslr);
102   }
103 
104   // Movk-compatible reservation via overallocation.
105   // If that failed, attempt to allocate at any 4G-aligned address. Let the system decide where. For ASLR,
106   // we now rely on the system.
107   // Compared with the probing done above, this has two disadvantages:
108   // - on a kernel with 52-bit address space we may get an address that has bits set between [48, 52).
109   //   In that case, we may need two movk moves (not yet implemented).
110   // - this technique leads to temporary over-reservation of address space; it will spike the vsize of
111   //   the process. Therefore it may fail if a vsize limit is in place (e.g. ulimit -v).
112   if (result == nullptr) {
113     constexpr size_t alignment = nth_bit(32);
114     log_debug(metaspace, map)("Trying to reserve at a 32-bit-aligned address");
115     result = os::reserve_memory_aligned(size, alignment, false);
116   }
117 
118   return result;
119 }
120 
121 void CompressedKlassPointers::initialize(address addr, size_t len) {








122   constexpr uintptr_t unscaled_max = nth_bit(32);
123   assert(len <= unscaled_max, "Klass range larger than 32 bits?");
124 
125   // Shift is always 0 on aarch64.
126   _shift = 0;
127 
128   // On aarch64, we don't bother with zero-based encoding (base=0 shift>0).
129   address const end = addr + len;
130   _base = (end <= (address)unscaled_max) ? nullptr : addr;
131 
132   _range = end - _base;









133 }

101     result = reserve_address_space_for_16bit_move(size, aslr);
102   }
103 
104   // Movk-compatible reservation via overallocation.
105   // If that failed, attempt to allocate at any 4G-aligned address. Let the system decide where. For ASLR,
106   // we now rely on the system.
107   // Compared with the probing done above, this has two disadvantages:
108   // - on a kernel with 52-bit address space we may get an address that has bits set between [48, 52).
109   //   In that case, we may need two movk moves (not yet implemented).
110   // - this technique leads to temporary over-reservation of address space; it will spike the vsize of
111   //   the process. Therefore it may fail if a vsize limit is in place (e.g. ulimit -v).
112   if (result == nullptr) {
113     constexpr size_t alignment = nth_bit(32);
114     log_debug(metaspace, map)("Trying to reserve at a 32-bit-aligned address");
115     result = os::reserve_memory_aligned(size, alignment, false);
116   }
117 
118   return result;
119 }
120 
121 bool CompressedKlassPointers::pd_initialize(address addr, size_t len) {
122 
123   if (tiny_classpointer_mode()) {
124     // In tiny-classpointer mode, we do what all other platforms do.
125     return false;
126   }
127 
128   // Aarch64 uses an own initialization logic that avoids zero-base shifted mode
129   // (_base=0 _shift>0), instead preferring non-zero-based mode with shift=0
130   constexpr uintptr_t unscaled_max = nth_bit(32);
131   assert(len <= unscaled_max, "Klass range larger than 32 bits?");
132 

133   _shift = 0;
134 

135   address const end = addr + len;
136   _base = (end <= (address)unscaled_max) ? nullptr : addr;
137 
138   _range = end - _base;
139 
140 #ifdef ASSERT
141   _klass_range_start = addr;
142   _klass_range_end = addr + len;
143   calc_lowest_highest_narrow_klass_id();
144   sanity_check_after_initialization();
145 #endif
146 
147   return true;
148 }
< prev index next >