Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim identity-hashcode to 25bit #3

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -41,8 +41,8 @@
//
// 64 bits:
// --------
// unused:25 hash:31 -->| unused_gap:1 age:4 biased_lock:1 lock:2 (normal object)
// JavaThread*:54 epoch:2 unused_gap:1 age:4 biased_lock:1 lock:2 (biased object)
// unused:32 hash:25 -->| age:4 biased_lock:1 lock:2 (normal object)
// JavaThread*:55 epoch:2 age:4 biased_lock:1 lock:2 (biased object)
//
// - hash contains the identity hash value: largest value is
// 31 bits, see os::random(). Also, 64-bit vm's require
@@ -130,17 +130,15 @@ class markWord {
static const int lock_bits = 2;
static const int biased_lock_bits = 1;
static const int max_hash_bits = BitsPerWord - age_bits - lock_bits - biased_lock_bits;
static const int hash_bits = max_hash_bits > 31 ? 31 : max_hash_bits;
static const int unused_gap_bits = LP64_ONLY(1) NOT_LP64(0);
static const int hash_bits = max_hash_bits > 25 ? 25 : max_hash_bits;
static const int epoch_bits = 2;

// The biased locking code currently requires that the age bits be
// contiguous to the lock bits.
static const int lock_shift = 0;
static const int biased_lock_shift = lock_bits;
static const int age_shift = lock_bits + biased_lock_bits;
static const int unused_gap_shift = age_shift + age_bits;
static const int hash_shift = unused_gap_shift + unused_gap_bits;
static const int hash_shift = age_shift + age_bits;
static const int epoch_shift = hash_shift;

static const uintptr_t lock_mask = right_n_bits(lock_bits);
@@ -137,15 +137,21 @@ void HeapObjectStatistics::begin_sample() {

void HeapObjectStatistics::visit_object(oop obj) {
increase_counter(_num_objects);
if (!obj->mark().has_no_hash()) {
markWord mark = obj->mark();
if (!mark.has_no_hash()) {
increase_counter(_num_ihashed);
if (obj->mark().age() > 0) {
if (mark.age() > 0) {
increase_counter(_num_ihashed_moved);
}
}
if (obj->mark().is_locked()) {
if (mark.is_locked()) {
increase_counter(_num_locked);
}
#ifdef ASSERT
if (!mark.has_displaced_mark_helper()) {
assert((mark.value() & 0xffffffff00000000) == 0, "upper 32 mark bits must be free");
}
#endif
increase_counter(_lds, obj->size());
}

@@ -100,7 +100,7 @@ private static void checkForTruncation(String longConstantOutput) throws Excepti

checkLongValue("markWord::hash_mask_in_place",
longConstantOutput,
Platform.is64bit() ? 549755813632L: 4294967168L);
4294967168L);

String arch = System.getProperty("os.arch");
if (arch.equals("amd64") || arch.equals("i386") || arch.equals("x86")) {