197 // If optimize_for_zero_base is true, the implementation will attempt to reserve optimized for zero-based encoding.
198 static char* reserve_address_space_for_compressed_classes(size_t size, bool aslr, bool optimize_for_zero_base);
199
200 // Given a klass range [addr, addr+len) and a given encoding scheme, assert that this scheme covers the range, then
201 // set this encoding scheme. Used by CDS at runtime to re-instate the scheme used to pre-compute klass ids for
202 // archived heap objects. In this case, we don't have the freedom to choose base and shift; they are handed to
203 // us from CDS.
204 static void initialize_for_given_encoding(address addr, size_t len, address requested_base, int requested_shift);
205
206 // Given an address range [addr, addr+len) which the encoding is supposed to
207 // cover, choose base, shift and range.
208 // The address range is the expected range of uncompressed Klass pointers we
209 // will encounter (and the implicit promise that there will be no Klass
210 // structures outside this range).
211 static void initialize(address addr, size_t len);
212
213 static void print_mode(outputStream* st);
214
215 // Can only be used after initialization
216 static address base() { check_init(_base); return _base; }
217 static address base_addr() { return (address)&_base; }
218 static int shift() { check_init(_shift); return _shift; }
219
220 static address klass_range_start() { return _klass_range_start; }
221 static address klass_range_end() { return _klass_range_end; }
222
223 static inline address encoding_range_end();
224
225 // Returns the alignment a Klass* is guaranteed to have.
226 // Note: *Not* the same as 1 << shift ! Klass are always guaranteed to be at least 64-bit aligned,
227 // so this will return 8 even if shift is 0.
228 static int klass_alignment_in_bytes() { return nth_bit(MAX2(3, _shift)); }
229 static int klass_alignment_in_words() { return klass_alignment_in_bytes() / BytesPerWord; }
230
231 // Returns the highest possible narrowKlass value given the current Klass range
232 static narrowKlass highest_valid_narrow_klass_id() { return _highest_valid_narrow_klass_id; }
233
234 static bool is_null(Klass* v) { return v == nullptr; }
235 static bool is_null(narrowKlass v) { return v == 0; }
236
237 // Versions without asserts
|
197 // If optimize_for_zero_base is true, the implementation will attempt to reserve optimized for zero-based encoding.
198 static char* reserve_address_space_for_compressed_classes(size_t size, bool aslr, bool optimize_for_zero_base);
199
200 // Given a klass range [addr, addr+len) and a given encoding scheme, assert that this scheme covers the range, then
201 // set this encoding scheme. Used by CDS at runtime to re-instate the scheme used to pre-compute klass ids for
202 // archived heap objects. In this case, we don't have the freedom to choose base and shift; they are handed to
203 // us from CDS.
204 static void initialize_for_given_encoding(address addr, size_t len, address requested_base, int requested_shift);
205
206 // Given an address range [addr, addr+len) which the encoding is supposed to
207 // cover, choose base, shift and range.
208 // The address range is the expected range of uncompressed Klass pointers we
209 // will encounter (and the implicit promise that there will be no Klass
210 // structures outside this range).
211 static void initialize(address addr, size_t len);
212
213 static void print_mode(outputStream* st);
214
215 // Can only be used after initialization
216 static address base() { check_init(_base); return _base; }
217 static address base_addr() { return (address)&_base; }
218 static int shift() { check_init(_shift); return _shift; }
219
220 static address klass_range_start() { return _klass_range_start; }
221 static address klass_range_end() { return _klass_range_end; }
222
223 static inline address encoding_range_end();
224
225 // Returns the alignment a Klass* is guaranteed to have.
226 // Note: *Not* the same as 1 << shift ! Klass are always guaranteed to be at least 64-bit aligned,
227 // so this will return 8 even if shift is 0.
228 static int klass_alignment_in_bytes() { return nth_bit(MAX2(3, _shift)); }
229 static int klass_alignment_in_words() { return klass_alignment_in_bytes() / BytesPerWord; }
230
231 // Returns the highest possible narrowKlass value given the current Klass range
232 static narrowKlass highest_valid_narrow_klass_id() { return _highest_valid_narrow_klass_id; }
233
234 static bool is_null(Klass* v) { return v == nullptr; }
235 static bool is_null(narrowKlass v) { return v == 0; }
236
237 // Versions without asserts
|