src/share/vm/gc_implementation/shared/markSweep.inline.hpp

Print this page
rev 6069 : 8029075: String deduplication in G1
Implementation of JEP 192, http://openjdk.java.net/jeps/192

@@ -28,14 +28,21 @@
 #include "gc_implementation/shared/markSweep.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "utilities/stack.inline.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/stringDedup.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
 #endif // INCLUDE_ALL_GCS
 
 inline void MarkSweep::mark_object(oop obj) {
+#if INCLUDE_ALL_GCS
+  if (UseG1GC && UseStringDeduplication) {
+    // We must enqueue the object before it is marked
+    StringDedup::enqueue_from_mark(obj);
+  }
+#endif
   // some marks may contain information we need to preserve so we store them away
   // and overwrite the mark.  We'll restore it at the end of markSweep.
   markOop mark = obj->mark();
   obj->set_mark(markOopDesc::prototype()->set_marked());