@@ -247,11 +247,6 @@ class markWord {
247
247
static const uintptr_t null_free_flat_array_pattern = flat_array_bit_in_place | null_free_array_pattern;
248
248
static const uintptr_t nullable_flat_array_pattern = flat_array_bit_in_place | unlocked_value;
249
249
250
- // Has static klass prototype, used for decode/encode pointer
251
- static const uintptr_t static_prototype_mask = LP64_ONLY(right_n_bits(inline_type_bits + flat_array_bits + null_free_array_bits)) NOT_LP64(right_n_bits(inline_type_bits));
252
- static const uintptr_t static_prototype_mask_in_place = static_prototype_mask << lock_bits;
253
- static const uintptr_t static_prototype_value_max = (1 << age_shift) - 1 ;
254
-
255
250
static const uintptr_t larval_pattern = larval_bit_in_place | inline_type_pattern;
256
251
257
252
static const uintptr_t no_hash = 0 ; // no hash value assigned
@@ -460,10 +455,23 @@ class markWord {
460
455
461
456
// Recover address of oop from encoded form used in mark
462
457
inline void * decode_pointer () const {
463
- return (EnableValhalla && _value < static_prototype_value_max) ? nullptr :
458
+ // Get the current age and 3 Valhalla bits.
459
+ // Note that the larval bit is ignored in this case.
460
+ uint n_valhalla = 3 ;
461
+ uintptr_t age = (_value >> age_shift) & age_mask;
462
+ uintptr_t valhalla = (_value >> inline_type_shift) & right_n_bits (n_valhalla);
463
+ // Use the legacy indices: age = 6, Valhalla = 3.
464
+ uint old_age = 6 , old_valhalla = 3 ;
465
+ // Swap into the legacy format.
466
+ uintptr_t tmp = write_bits (_value, valhalla, old_valhalla, old_valhalla + n_valhalla);
467
+ tmp = write_bits (tmp, age, old_age, old_age + age_bits);
468
+ // No idea what this achives, but it is needed to work.
469
+ uintptr_t static_prototype_value_max = (1 << old_age) - 1 ;
470
+ return (EnableValhalla && tmp < static_prototype_value_max) ? nullptr :
464
471
(void *) (clear_lock_bits ().value ());
465
472
}
466
473
474
+
467
475
inline bool is_self_forwarded () const {
468
476
NOT_LP64 (assert (LockingMode != LM_LEGACY, " incorrect with LM_LEGACY on 32 bit" );)
469
477
return mask_bits (value (), self_fwd_mask_in_place) != 0 ;
@@ -482,6 +490,13 @@ class markWord {
482
490
inline oop forwardee () const {
483
491
return cast_to_oop (decode_pointer ());
484
492
}
493
+
494
+ private:
495
+ inline uintptr_t write_bits (uintptr_t input, uintptr_t val, uint start, uint end) const {
496
+ uintptr_t mask = ((1 << start) - 1 ) ^ ((1 << (end + 1 )) - 1 );
497
+ input &= ~mask;
498
+ return input | (val << start);
499
+ }
485
500
};
486
501
487
502
// Support atomic operations.
0 commit comments