--- old/src/hotspot/share/oops/markOop.hpp 2018-12-07 12:57:46.000000000 -0800 +++ new/src/hotspot/share/oops/markOop.hpp 2018-12-07 12:57:45.000000000 -0800 @@ -108,6 +108,10 @@ // // [ |1| epoch | age | 1 | 01] permanently locked // +// A private buffered value can be in a larval state. It's a value instance +// and hence always locked. "epoch" is unused. We use the same bit as "epoch" +// to set the larval state. +// class BasicLock; class ObjectMonitor; @@ -126,7 +130,8 @@ max_hash_bits = BitsPerWord - age_bits - lock_bits - biased_lock_bits, hash_bits = max_hash_bits > 31 ? 31 : max_hash_bits, cms_bits = LP64_ONLY(1) NOT_LP64(0), - epoch_bits = 2 + epoch_bits = 2, + larval_bits = 1 }; // The biased locking code currently requires that the age bits be @@ -137,7 +142,8 @@ cms_shift = age_shift + age_bits, hash_shift = cms_shift + cms_bits, epoch_shift = hash_shift, - thread_shift = epoch_shift + epoch_bits + larval_shift = hash_shift, + thread_shift = epoch_shift + epoch_bits, }; enum { lock_mask = right_n_bits(lock_bits), @@ -150,11 +156,13 @@ epoch_mask = right_n_bits(epoch_bits), epoch_mask_in_place = epoch_mask << epoch_shift, cms_mask = right_n_bits(cms_bits), - cms_mask_in_place = cms_mask << cms_shift + cms_mask_in_place = cms_mask << cms_shift, #ifndef _WIN64 - ,hash_mask = right_n_bits(hash_bits), - hash_mask_in_place = (address_word)hash_mask << hash_shift + hash_mask = right_n_bits(hash_bits), + hash_mask_in_place = (address_word)hash_mask << hash_shift, #endif + larval_mask = right_n_bits(larval_bits), + larval_mask_in_place = larval_mask << larval_shift }; // Alignment of JavaThread pointers encoded in object header required by biased locking @@ -186,6 +194,10 @@ enum { max_bias_epoch = epoch_mask }; + enum { normal_value = 0, + larval_value = 1 + }; + static markOop always_locked_prototype() { return markOop(always_locked_pattern); } @@ -371,6 +383,17 @@ return hash() == no_hash; } + // value private buffer operations + markOop enter_larval_state() const { + return markOop((value() & ~larval_mask_in_place) | larval_value); + } + markOop exit_larval_state() const { + return markOop((value() & ~larval_mask_in_place) | normal_value); + } + bool is_larval_state() const { + return ((value() & larval_mask_in_place) == larval_value); + } + // Prototype mark for initialization static markOop prototype() { return markOop( no_hash_in_place | no_lock_in_place );