< prev index next >

src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp

Print this page
rev 57156 : imported patch 8234796-v3


  52 // Candidate selection criteria is GC specific.
  53 //
  54 // Interned strings are a bit special. They are explicitly deduplicated just before
  55 // being inserted into the StringTable (to avoid counteracting C2 optimizations done
  56 // on string literals), then they also become deduplication candidates if they reach
  57 // the deduplication age threshold or are evacuated to an old heap region. The second
  58 // attempt to deduplicate such strings will be in vain, but we have no fast way of
  59 // filtering them out. This has not shown to be a problem, as the number of interned
  60 // strings is usually dwarfed by the number of normal (non-interned) strings.
  61 //
  62 // For additional information on string deduplication, please see JEP 192,
  63 // http://openjdk.java.net/jeps/192
  64 //
  65 
  66 #include "gc/shared/stringdedup/stringDedupQueue.hpp"
  67 #include "gc/shared/stringdedup/stringDedupStat.hpp"
  68 #include "gc/shared/stringdedup/stringDedupTable.hpp"
  69 #include "memory/allocation.hpp"
  70 #include "runtime/thread.hpp"
  71 


  72 //
  73 // Main interface for interacting with string deduplication.
  74 //
  75 class StringDedup : public AllStatic {
  76 private:
  77   // Single state for checking if string deduplication is enabled.
  78   static bool _enabled;
  79 
  80 public:
  81   // Returns true if string deduplication is enabled.
  82   static bool is_enabled() {
  83     return _enabled;
  84   }
  85 
  86   // Stop the deduplication thread.
  87   static void stop();
  88 
  89   // Immediately deduplicates the given String object, bypassing the
  90   // the deduplication queue.
  91   static void deduplicate(oop java_string);




  52 // Candidate selection criteria is GC specific.
  53 //
  54 // Interned strings are a bit special. They are explicitly deduplicated just before
  55 // being inserted into the StringTable (to avoid counteracting C2 optimizations done
  56 // on string literals), then they also become deduplication candidates if they reach
  57 // the deduplication age threshold or are evacuated to an old heap region. The second
  58 // attempt to deduplicate such strings will be in vain, but we have no fast way of
  59 // filtering them out. This has not shown to be a problem, as the number of interned
  60 // strings is usually dwarfed by the number of normal (non-interned) strings.
  61 //
  62 // For additional information on string deduplication, please see JEP 192,
  63 // http://openjdk.java.net/jeps/192
  64 //
  65 
  66 #include "gc/shared/stringdedup/stringDedupQueue.hpp"
  67 #include "gc/shared/stringdedup/stringDedupStat.hpp"
  68 #include "gc/shared/stringdedup/stringDedupTable.hpp"
  69 #include "memory/allocation.hpp"
  70 #include "runtime/thread.hpp"
  71 
  72 class ThreadClosure;
  73 
  74 //
  75 // Main interface for interacting with string deduplication.
  76 //
  77 class StringDedup : public AllStatic {
  78 private:
  79   // Single state for checking if string deduplication is enabled.
  80   static bool _enabled;
  81 
  82 public:
  83   // Returns true if string deduplication is enabled.
  84   static bool is_enabled() {
  85     return _enabled;
  86   }
  87 
  88   // Stop the deduplication thread.
  89   static void stop();
  90 
  91   // Immediately deduplicates the given String object, bypassing the
  92   // the deduplication queue.
  93   static void deduplicate(oop java_string);


< prev index next >