Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 f4be211
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psPromotionManager.cpp
Expand Up @@ -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");

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/oops/oop.hpp
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/share/oops/oop.inline.hpp
Expand Up @@ -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);
Expand Down

1 comment on commit f4be211

@openjdk-notifier
Copy link

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.