Skip to content
Permalink
Browse files
8270041: Consolidate oopDesc::cas_forward_to() and oopDesc::forward_t…
…o_atomic()

Reviewed-by: stefank, kbarrett
  • Loading branch information
rkennke committed Aug 19, 2021
1 parent b40e8f0 commit f4be211ae290824cb6c678dcdff0df91a20117d6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
@@ -351,7 +351,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markWord obj_mark) {
// this started. If it is the same (i.e., no forwarding
// pointer has been installed), then this thread owns
// it.
if (obj->cas_forward_to(obj, obj_mark)) {
if (obj->forward_to_atomic(obj, obj_mark) == NULL) {
// We won any races, we "own" this object.
assert(obj == obj->forwardee(), "Sanity");

@@ -246,7 +246,6 @@ class oopDesc {
void verify_forwardee(oop forwardee) NOT_DEBUG_RETURN;

inline void forward_to(oop p);
inline bool cas_forward_to(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);

// Like "forward_to", but inserts the forwarding pointer atomically.
// Exactly one thread succeeds in inserting the forwarding pointer, and
@@ -278,14 +278,6 @@ void oopDesc::forward_to(oop p) {
set_mark(m);
}

// Used by parallel scavengers
bool oopDesc::cas_forward_to(oop p, markWord compare, atomic_memory_order order) {
verify_forwardee(p);
markWord m = markWord::encode_pointer_as_mark(p);
assert(m.decode_pointer() == p, "encoding must be reversable");
return cas_set_mark(m, compare, order) == compare;
}

oop oopDesc::forward_to_atomic(oop p, markWord compare, atomic_memory_order order) {
verify_forwardee(p);
markWord m = markWord::encode_pointer_as_mark(p);

1 comment on commit f4be211

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on f4be211 Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.