< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahForwarding.hpp

Print this page
@@ -28,10 +28,13 @@
  #include "oops/markWord.hpp"
  #include "oops/oop.hpp"
  #include "utilities/globalDefinitions.hpp"
  
  class ShenandoahForwarding {
+ private:
+   static const uintptr_t FWDED_HASH_TRANSITION = 0b111;
+ 
  public:
    /* Gets forwardee from the given object. For a self-forwarded object
     * (evacuation failure), returns the object itself.
     */
    static inline oop get_forwardee(oop obj);

@@ -55,10 +58,23 @@
    /**
     * Returns true if the object is forwarded (including self-forwarded),
     * false otherwise.
     */
    static inline bool is_forwarded(oop obj);
+   static inline bool is_forwarded(markWord m);
+ 
+   /**
+    * Returns true iff the mark word's lock bits are marked_value (0b11),
+    * i.e. the upper bits encode a real forwardee pointer. This covers both
+    * normal-forwarded (0b011) and forward-expanded (0b111) states, and
+    * excludes self-forwarded states (0b100, 0b101, 0b110) whose upper bits
+    * still hold the original klass/hash/age metadata.
+    *
+    * Do NOT use markWord::is_marked() for this purpose -- it also returns
+    * true for self-forwarded objects.
+    */
+   static inline bool has_forwardee(markWord m);
  
    /**
     * Returns true iff obj has been self-forwarded (i.e. evacuation has
     * failed for this object in the current cycle).
     */
< prev index next >