< prev index next > src/hotspot/share/oops/compressedKlass.cpp
Print this page
RANGE2FMTARGS(_klass_range_start, _klass_range_end),
p2i(_base), _shift, _lowest_valid_narrow_klass_id, _highest_valid_narrow_klass_id);
#define ASSERT_HERE(cond) assert(cond, " (%s)", tmp);
#define ASSERT_HERE_2(cond, msg) assert(cond, msg " (%s)", tmp);
+ // There is no technical reason preventing us from using other klass pointer bit lengths,
+ // but it should be a deliberate choice
+ ASSERT_HERE(_narrow_klass_pointer_bits == 32 || _narrow_klass_pointer_bits == 19);
+
// All values must be inited
ASSERT_HERE(_max_shift != -1);
ASSERT_HERE(_klass_range_start != (address)-1);
ASSERT_HERE(_klass_range_end != (address)-1);
ASSERT_HERE(_lowest_valid_narrow_klass_id != (narrowKlass)-1);
// Calculate Base and Shift:
if (UseCompactObjectHeaders) {
! // In compact object header mode, with 22-bit narrowKlass, we don't attempt for
// zero-based mode. Instead, we set the base to the start of the klass range and
// then try for the smallest shift possible that still covers the whole range.
// The reason is that we want to avoid, if possible, shifts larger than
// a cacheline size.
_base = addr;
// Calculate Base and Shift:
if (UseCompactObjectHeaders) {
! // This handles the case that we - experimentally - reduce the number of
+ // class pointer bits further, such that (shift + num bits) < 32.
+ assert(len <= (size_t)nth_bit(narrow_klass_pointer_bits() + max_shift()),
+ "klass range size exceeds encoding, len: " SIZE_FORMAT ", narrow_klass_pointer_bits: %d, max_shift: %d", len, narrow_klass_pointer_bits(), max_shift());
+
+ // In compact object header mode, with 19-bit narrowKlass, we don't attempt for
// zero-based mode. Instead, we set the base to the start of the klass range and
// then try for the smallest shift possible that still covers the whole range.
// The reason is that we want to avoid, if possible, shifts larger than
// a cacheline size.
_base = addr;
< prev index next >