292 static ByteSize primary_supers_offset() { return in_ByteSize(offset_of(Klass, _primary_supers)); }
293 static ByteSize secondary_super_cache_offset() { return in_ByteSize(offset_of(Klass, _secondary_super_cache)); }
294 static ByteSize secondary_supers_offset() { return in_ByteSize(offset_of(Klass, _secondary_supers)); }
295 static ByteSize java_mirror_offset() { return in_ByteSize(offset_of(Klass, _java_mirror)); }
296 static ByteSize modifier_flags_offset() { return in_ByteSize(offset_of(Klass, _modifier_flags)); }
297 static ByteSize layout_helper_offset() { return in_ByteSize(offset_of(Klass, _layout_helper)); }
298 static ByteSize access_flags_offset() { return in_ByteSize(offset_of(Klass, _access_flags)); }
299
300 // Unpacking layout_helper:
301 enum {
302 _lh_neutral_value = 0, // neutral non-array non-instance value
303 _lh_instance_slow_path_bit = 0x01,
304 _lh_log2_element_size_shift = BitsPerByte*0,
305 _lh_log2_element_size_mask = BitsPerLong-1,
306 _lh_element_type_shift = BitsPerByte*1,
307 _lh_element_type_mask = right_n_bits(BitsPerByte), // shifted mask
308 _lh_header_size_shift = BitsPerByte*2,
309 _lh_header_size_mask = right_n_bits(BitsPerByte), // shifted mask
310 _lh_array_tag_bits = 2,
311 _lh_array_tag_shift = BitsPerInt - _lh_array_tag_bits,
312 _lh_array_tag_type_value = ~0x00, // 0xC0000000 >> 30
313 _lh_array_tag_obj_value = ~0x01 // 0x80000000 >> 30
314 };
315
316 static int layout_helper_size_in_bytes(jint lh) {
317 assert(lh > (jint)_lh_neutral_value, "must be instance");
318 return (int) lh & ~_lh_instance_slow_path_bit;
319 }
320 static bool layout_helper_needs_slow_path(jint lh) {
321 assert(lh > (jint)_lh_neutral_value, "must be instance");
322 return (lh & _lh_instance_slow_path_bit) != 0;
323 }
324 static bool layout_helper_is_instance(jint lh) {
325 return (jint)lh > (jint)_lh_neutral_value;
326 }
327 static bool layout_helper_is_array(jint lh) {
328 return (jint)lh < (jint)_lh_neutral_value;
329 }
330 static bool layout_helper_is_typeArray(jint lh) {
331 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift);
332 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift);
333 }
334 static bool layout_helper_is_objArray(jint lh) {
335 // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift);
|
292 static ByteSize primary_supers_offset() { return in_ByteSize(offset_of(Klass, _primary_supers)); }
293 static ByteSize secondary_super_cache_offset() { return in_ByteSize(offset_of(Klass, _secondary_super_cache)); }
294 static ByteSize secondary_supers_offset() { return in_ByteSize(offset_of(Klass, _secondary_supers)); }
295 static ByteSize java_mirror_offset() { return in_ByteSize(offset_of(Klass, _java_mirror)); }
296 static ByteSize modifier_flags_offset() { return in_ByteSize(offset_of(Klass, _modifier_flags)); }
297 static ByteSize layout_helper_offset() { return in_ByteSize(offset_of(Klass, _layout_helper)); }
298 static ByteSize access_flags_offset() { return in_ByteSize(offset_of(Klass, _access_flags)); }
299
300 // Unpacking layout_helper:
301 enum {
302 _lh_neutral_value = 0, // neutral non-array non-instance value
303 _lh_instance_slow_path_bit = 0x01,
304 _lh_log2_element_size_shift = BitsPerByte*0,
305 _lh_log2_element_size_mask = BitsPerLong-1,
306 _lh_element_type_shift = BitsPerByte*1,
307 _lh_element_type_mask = right_n_bits(BitsPerByte), // shifted mask
308 _lh_header_size_shift = BitsPerByte*2,
309 _lh_header_size_mask = right_n_bits(BitsPerByte), // shifted mask
310 _lh_array_tag_bits = 2,
311 _lh_array_tag_shift = BitsPerInt - _lh_array_tag_bits,
312 _lh_array_tag_obj_value = ~0x01 // 0x80000000 >> 30
313 };
314
315 static const unsigned int _lh_array_tag_type_value = 0Xffffffff; // ~0x00, // 0xC0000000 >> 30
316
317 static int layout_helper_size_in_bytes(jint lh) {
318 assert(lh > (jint)_lh_neutral_value, "must be instance");
319 return (int) lh & ~_lh_instance_slow_path_bit;
320 }
321 static bool layout_helper_needs_slow_path(jint lh) {
322 assert(lh > (jint)_lh_neutral_value, "must be instance");
323 return (lh & _lh_instance_slow_path_bit) != 0;
324 }
325 static bool layout_helper_is_instance(jint lh) {
326 return (jint)lh > (jint)_lh_neutral_value;
327 }
328 static bool layout_helper_is_array(jint lh) {
329 return (jint)lh < (jint)_lh_neutral_value;
330 }
331 static bool layout_helper_is_typeArray(jint lh) {
332 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift);
333 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift);
334 }
335 static bool layout_helper_is_objArray(jint lh) {
336 // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift);
|