diff src/share/vm/memory/iterator.hpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents f95d63e2154a
children 1d1603768966
line wrap: on
line diff
--- a/src/share/vm/memory/iterator.hpp	Thu Jan 27 13:42:28 2011 -0800
+++ b/src/share/vm/memory/iterator.hpp	Thu Jan 27 16:11:27 2011 -0800
@@ -290,6 +290,22 @@
   virtual void do_tag(int tag) = 0;
 };
 
+class SymbolClosure : public StackObj {
+ public:
+  virtual void do_symbol(Symbol**) = 0;
+
+  // Clear LSB in symbol address; it can be set by CPSlot.
+  static Symbol* load_symbol(Symbol** p) {
+    return (Symbol*)(intptr_t(*p) & ~1);
+  }
+
+  // Store symbol, adjusting new pointer if the original pointer was adjusted
+  // (symbol references in constant pool slots have their LSB set to 1).
+  static void store_symbol(Symbol** p, Symbol* sym) {
+    *p = (Symbol*)(intptr_t(sym) | (intptr_t(*p) & 1));
+  }
+};
+
 #ifdef ASSERT
 // This class is used to flag phases of a collection that
 // can unload classes and which should override the