src/share/vm/oops/markOop.hpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/oops/markOop.hpp Thu May 29 11:14:28 2008
--- new/src/share/vm/oops/markOop.hpp Thu May 29 11:14:27 2008
*** 28,38 ****
--- 28,39 ----
// It is placed in the oop hierarchy for historical reasons.
//
// Bit-format of an object header (most significant first):
//
//
// unused:0/25 hash:25/31 age:4 biased_lock:1 lock:2 = 32/64 bits
+ // 32 bits: hash:25/31 age:4 biased_lock:1 lock:2
+ // 64 bits: unused:0/23 hash:27/33 cms:2 age:4 biased_lock:1 lock:2
//
// - hash contains the identity hash value: largest value is
// 31 bits, see os::random(). Also, 64-bit vm's require
// a hash value no bigger than 32 bits because they will not
// properly generate a mask larger than that: see library_call.cpp
*** 89,98 ****
--- 90,100 ----
enum { age_bits = 4,
lock_bits = 2,
biased_lock_bits = 1,
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(2) NOT_LP64(0),
epoch_bits = 2
};
// The biased locking code currently requires that the age bits be
// contiguous to the lock bits. Class data sharing would prefer the
*** 104,114 ****
--- 106,117 ----
// of the biased locking code.
enum { lock_shift = 0,
biased_lock_shift = lock_bits,
age_shift = lock_bits + biased_lock_bits,
! hash_shift = lock_bits + biased_lock_bits + age_bits,
! cms_shift = age_shift + age_bits,
+ hash_shift = cms_shift + cms_bits,
epoch_shift = hash_shift
};
enum { lock_mask = right_n_bits(lock_bits),
lock_mask_in_place = lock_mask << lock_shift,
*** 116,126 ****
--- 119,131 ----
biased_lock_mask_in_place= biased_lock_mask << lock_shift,
biased_lock_bit_in_place = 1 << biased_lock_shift,
age_mask = right_n_bits(age_bits),
age_mask_in_place = age_mask << age_shift,
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
#ifndef _WIN64
,hash_mask = right_n_bits(hash_bits),
hash_mask_in_place = (address_word)hash_mask << hash_shift
#endif
};
*** 358,363 ****
--- 363,414 ----
// Recover address of oop from encoded form used in mark
inline void* decode_pointer() { if (UseBiasedLocking && has_bias_pattern()) return NULL; return clear_lock_bits(); }
// see the definition in markOop.cpp for the gory details
bool should_not_be_cached() const;
+
+ // These markOops indicate cms free chunk blocks and not objects.
+ // In 64 bit, the markOop is set to distinguish them from oops.
+ // 0x1 is free chunk and 0x3 is can't coalesce, no other bits should be
+ // set other than unlocked.
+ // These are defined in 32 bit mode for vmStructs.
+ const static uintptr_t cms_free_chunk_pattern = 0x1;
+ const static uintptr_t cms_no_coalesce_pattern = 0x3;
+
+ // Constants for the size field.
+ enum { size_shift = cms_shift + cms_bits,
+ size_bits = 35 // need for compressed oops 32G
+ };
+ // These values are too big for Win64
+ const static uintptr_t size_mask = LP64_ONLY(right_n_bits(size_bits))
+ NOT_LP64(0);
+ const static uintptr_t size_mask_in_place =
+ (address_word)size_mask << size_shift;
+
+ #ifdef _LP64
+ static markOop cms_free_prototype() {
+ return markOop(((intptr_t)prototype() & ~cms_mask_in_place) |
+ ((cms_free_chunk_pattern & cms_mask) << cms_shift));
+ }
+ markOop set_cms_no_coalesce() {
+ return markOop(((intptr_t)value() & ~cms_mask_in_place) |
+ ((cms_no_coalesce_pattern & cms_mask) << cms_shift));
+ }
+ uintptr_t cms_encoding() const {
+ return mask_bits(value() >> cms_shift, cms_mask);
+ }
+ bool is_cms_free_chunk() const {
+ return is_neutral() &&
+ (cms_encoding() & cms_free_chunk_pattern) == cms_free_chunk_pattern;
+ }
+ bool is_cms_no_coalesce() const {
+ return is_neutral() && (cms_encoding() == cms_no_coalesce_pattern);
+ }
+
+ size_t get_size() const { return (size_t)(value() >> size_shift); }
+ static markOop set_size_and_free(size_t size) {
+ assert((size & ~size_mask) == 0, "shouldn't overflow size field");
+ return markOop(((intptr_t)cms_free_prototype() & ~size_mask_in_place) |
+ (((intptr_t)size & size_mask) << size_shift));
+ }
+ #endif // _LP64
};
src/share/vm/oops/markOop.hpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File