src/share/vm/gc_implementation/g1/g1StringDedup.hpp

Print this page
rev 6521 : 8044775: Improve usage of umbrella header atomic.inline.hpp.


  67 //   less than the deduplication age threshold
  68 //
  69 // Once an string object has been promoted to an old region, or its age is higher
  70 // than the deduplication age threshold, is will never become a candidate again.
  71 // This approach avoids making the same object a candidate more than once.
  72 //
  73 // Interned strings are a bit special. They are explicitly deduplicated just before
  74 // being inserted into the StringTable (to avoid counteracting C2 optimizations done
  75 // on string literals), then they also become deduplication candidates if they reach
  76 // the deduplication age threshold or are evacuated to an old heap region. The second
  77 // attempt to deduplicate such strings will be in vain, but we have no fast way of
  78 // filtering them out. This has not shown to be a problem, as the number of interned
  79 // strings is usually dwarfed by the number of normal (non-interned) strings.
  80 //
  81 // For additional information on string deduplication, please see JEP 192,
  82 // http://openjdk.java.net/jeps/192
  83 //
  84 
  85 #include "memory/allocation.hpp"
  86 #include "oops/oop.hpp"

  87 
  88 class OopClosure;
  89 class BoolObjectClosure;
  90 class ThreadClosure;
  91 class outputStream;
  92 class G1StringDedupTable;
  93 
  94 //
  95 // Main interface for interacting with string deduplication.
  96 //
  97 class G1StringDedup : public AllStatic {
  98 private:
  99   // Single state for checking if both G1 and string deduplication is enabled.
 100   static bool _enabled;
 101 
 102   // Candidate selection policies, returns true if the given object is
 103   // candidate for string deduplication.
 104   static bool is_candidate_from_mark(oop obj);
 105   static bool is_candidate_from_evacuation(bool from_young, bool to_young, oop obj);
 106 




  67 //   less than the deduplication age threshold
  68 //
  69 // Once an string object has been promoted to an old region, or its age is higher
  70 // than the deduplication age threshold, is will never become a candidate again.
  71 // This approach avoids making the same object a candidate more than once.
  72 //
  73 // Interned strings are a bit special. They are explicitly deduplicated just before
  74 // being inserted into the StringTable (to avoid counteracting C2 optimizations done
  75 // on string literals), then they also become deduplication candidates if they reach
  76 // the deduplication age threshold or are evacuated to an old heap region. The second
  77 // attempt to deduplicate such strings will be in vain, but we have no fast way of
  78 // filtering them out. This has not shown to be a problem, as the number of interned
  79 // strings is usually dwarfed by the number of normal (non-interned) strings.
  80 //
  81 // For additional information on string deduplication, please see JEP 192,
  82 // http://openjdk.java.net/jeps/192
  83 //
  84 
  85 #include "memory/allocation.hpp"
  86 #include "oops/oop.hpp"
  87 #include "runtime/atomic.hpp"
  88 
  89 class OopClosure;
  90 class BoolObjectClosure;
  91 class ThreadClosure;
  92 class outputStream;
  93 class G1StringDedupTable;
  94 
  95 //
  96 // Main interface for interacting with string deduplication.
  97 //
  98 class G1StringDedup : public AllStatic {
  99 private:
 100   // Single state for checking if both G1 and string deduplication is enabled.
 101   static bool _enabled;
 102 
 103   // Candidate selection policies, returns true if the given object is
 104   // candidate for string deduplication.
 105   static bool is_candidate_from_mark(oop obj);
 106   static bool is_candidate_from_evacuation(bool from_young, bool to_young, oop obj);
 107