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

Implement self-forwarding of objects that preserves header bits #10

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
@@ -132,7 +132,6 @@ class markWord {
static const uintptr_t monitor_value = 2;
static const uintptr_t marked_value = 3;

static const uintptr_t self_forwarded_value = 1 << self_forwarded_shift;
static const uintptr_t no_hash = 0 ; // no hash value assigned
static const uintptr_t no_hash_in_place = (address_word)no_hash << hash_shift;
static const uintptr_t no_lock_in_place = unlocked_value;
@@ -274,9 +273,7 @@ class markWord {
}

inline markWord set_self_forwarded() const {
intptr_t bits = (intptr_t)value();
set_bits(bits, self_forwarded_value | marked_value);
return markWord((uintptr_t)bits);
return markWord(value() | self_forwarded_mask_in_place | marked_value);
}
};

@@ -302,17 +302,14 @@ oop oopDesc::forward_to_atomic(oop p, markWord compare, atomic_memory_order orde

oop oopDesc::forward_to_self_atomic(markWord compare, atomic_memory_order order) {
verify_forwardee(this);
while (true) {
markWord m = compare.set_self_forwarded();
assert(forwardee(m) == cast_to_oop(this), "encoding must be reversable");
markWord old_mark = cas_set_mark(m, compare, order);
if (old_mark == compare) {
return NULL;
} else if (old_mark.is_marked()) {
return forwardee(old_mark);
} else {
compare = old_mark;
}
markWord m = compare.set_self_forwarded();
assert(forwardee(m) == cast_to_oop(this), "encoding must be reversable");
markWord old_mark = cas_set_mark(m, compare, order);
if (old_mark == compare) {
return NULL;
} else {
assert(old_mark.is_marked(), "must be marked here");
return forwardee(old_mark);
}
}