< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp

Print this page
@@ -23,13 +23,14 @@
   */
  
  #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
  #define SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
  
- #include "gc/shenandoah/shenandoahStringDedup.hpp"
- 
  #include "classfile/javaClasses.inline.hpp"
+ #include "gc/shenandoah/shenandoahHeap.inline.hpp"
+ #include "gc/shenandoah/shenandoahStringDedup.hpp"
+ #include "oops/markWord.hpp"
  
  bool ShenandoahStringDedup::is_string_candidate(oop obj) {
    assert(Thread::current()->is_Worker_thread(),
          "Only from a GC worker thread");
    return java_lang_String::is_instance(obj) &&

@@ -43,24 +44,12 @@
  bool ShenandoahStringDedup::is_candidate(oop obj) {
    if (!is_string_candidate(obj)) {
      return false;
    }
  
-   const markWord mark = obj->mark();
- 
-   // Having/had displaced header, too risky to deal with them, skip
-   if (mark == markWord::INFLATING() || mark.has_displaced_mark_helper()) {
-     return false;
-   }
- 
-   if (StringDedup::is_below_threshold_age(mark.age())) {
-     // Increase string age and enqueue it when it reaches age threshold
-     markWord new_mark = mark.incr_age();
-     if (mark == obj->cas_set_mark(new_mark, mark)) {
-       return StringDedup::is_threshold_age(new_mark.age()) &&
-              !dedup_requested(obj);
-     }
-   }
-   return false;
+   uint age = ShenandoahHeap::get_object_age(obj);
+   return (age <= markWord::max_age) &&
+          StringDedup::is_below_threshold_age(age) &&
+          !dedup_requested(obj);
  }
  
  #endif // SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
< prev index next >