diff agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java @ 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 3e8fbc61cee8
children 1d1603768966
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Thu Jan 27 13:42:28 2011 -0800
+++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Thu Jan 27 16:11:27 2011 -0800
@@ -428,6 +428,36 @@
                 }
             }
         },
+        new Command("symbol", "symbol address", false) {
+            public void doit(Tokens t) {
+                if (t.countTokens() != 1) {
+                    usage();
+                } else {
+                    Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
+                    Symbol.create(a).printValueOn(out);
+                    out.println();
+                }
+            }
+        },
+        new Command("symboltable", "symboltable name", false) {
+            public void doit(Tokens t) {
+                if (t.countTokens() != 1) {
+                    usage();
+                } else {
+                    out.println(SymbolTable.getTheTable().probe(t.nextToken()));
+                }
+            }
+        },
+        new Command("symboldump", "symboldump", false) {
+            public void doit(Tokens t) {
+                SymbolTable.getTheTable().symbolsDo(new SymbolTable.SymbolVisitor() {
+                        public void visit(Symbol sym) {
+                            sym.printValueOn(out);
+                            out.println();
+                        }
+                    });
+            }
+        },
         new Command("flags", "flags [ flag ]", false) {
             public void doit(Tokens t) {
                 int tokens = t.countTokens();
@@ -629,17 +659,6 @@
                 }
             }
         },
-        new Command("symbol", "symbol name", false) {
-            public void doit(Tokens t) {
-                if (t.countTokens() != 1) {
-                    usage();
-                } else {
-                    String symbol = t.nextToken();
-                    Address a = lookup(symbol);
-                    out.println(symbol + " = " + a);
-                }
-            }
-        },
         new Command("printstatics", "printstatics [ type ]", false) {
             public void doit(Tokens t) {
                 if (t.countTokens() > 1) {
@@ -1262,6 +1281,9 @@
         this.err = err;
         for (int i = 0; i < commandList.length; i++) {
             Command c = commandList[i];
+            if (commands.get(c.name) != null) {
+                throw new InternalError(c.name + " has multiple definitions");
+            }
             commands.put(c.name, c);
         }
         if (debugger.isAttached()) {