comparison agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents f6f3bb0ee072
children 5a98bf7d847b
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
632 if (t.countTokens() != 1) { 632 if (t.countTokens() != 1) {
633 usage(); 633 usage();
634 } else { 634 } else {
635 String s = t.nextToken(); 635 String s = t.nextToken();
636 if (s.equals("-a")) { 636 if (s.equals("-a")) {
637 HeapVisitor iterator = new DefaultHeapVisitor() { 637 SystemDictionary sysDict = VM.getVM().getSystemDictionary();
638 public boolean doObj(Oop obj) { 638 sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
639 if (obj instanceof MethodData) { 639 public void visit(Klass k) {
640 Method m = ((MethodData)obj).getMethod(); 640 if (k instanceof InstanceKlass) {
641 out.println("MethodData " + obj.getHandle() + " for " + 641 MethodArray methods = ((InstanceKlass)k).getMethods();
642 for (int i = 0; i < methods.length(); i++) {
643 Method m = methods.at(i);
644 MethodData mdo = m.getMethodData();
645 if (mdo != null) {
646 out.println("MethodData " + mdo.getAddress() + " for " +
642 "method " + m.getMethodHolder().getName().asString() + "." + 647 "method " + m.getMethodHolder().getName().asString() + "." +
643 m.getName().asString() + 648 m.getName().asString() +
644 m.getSignature().asString() + "@" + m.getHandle()); 649 m.getSignature().asString() + "@" + m.getAddress());
645 ((MethodData)obj).printDataOn(out); 650 mdo.printDataOn(out);
646 } 651 }
647 return false;
648 } 652 }
649 }; 653 }
650 VM.getVM().getObjectHeap().iteratePerm(iterator); 654 }
655 }
656 );
651 } else { 657 } else {
652 Address a = VM.getVM().getDebugger().parseAddress(s); 658 Address a = VM.getVM().getDebugger().parseAddress(s);
653 OopHandle handle = a.addOffsetToAsOopHandle(0); 659 MethodData mdo = (MethodData) Metadata.instantiateWrapperFor(a);
654 MethodData mdo = (MethodData)VM.getVM().getObjectHeap().newOop(handle);
655 mdo.printDataOn(out); 660 mdo.printDataOn(out);
656 } 661 }
662 }
663 }
664 },
665 new Command("printall", "printall", false) {
666 // Print every MDO in the heap or the one referenced by expression.
667 public void doit(Tokens t) {
668 if (t.countTokens() != 0) {
669 usage();
670 } else {
671 SystemDictionary sysDict = VM.getVM().getSystemDictionary();
672 sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
673 public void visit(Klass k) {
674 if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) {
675 MethodArray methods = ((InstanceKlass)k).getMethods();
676 for (int i = 0; i < methods.length(); i++) {
677 Method m = methods.at(i);
678 HTMLGenerator gen = new HTMLGenerator(false);
679 out.println(gen.genHTML(m));
680 }
681 }
682 }
683 }
684 );
657 } 685 }
658 } 686 }
659 }, 687 },
660 new Command("dumpideal", "dumpideal { -a | id }", false) { 688 new Command("dumpideal", "dumpideal { -a | id }", false) {
661 // Do a full dump of the nodes reachabile from root in each compiler thread. 689 // Do a full dump of the nodes reachabile from root in each compiler thread.
1227 } 1255 }
1228 public void epilogue() { 1256 public void epilogue() {
1229 } 1257 }
1230 }; 1258 };
1231 VM.getVM().getObjectHeap().iterateRaw(iterator); 1259 VM.getVM().getObjectHeap().iterateRaw(iterator);
1232 } else if (type.equals("heap") || type.equals("perm")) { 1260 } else if (type.equals("heap")) {
1233 HeapVisitor iterator = new DefaultHeapVisitor() { 1261 HeapVisitor iterator = new DefaultHeapVisitor() {
1234 public boolean doObj(Oop obj) { 1262 public boolean doObj(Oop obj) {
1235 int index = 0; 1263 int index = 0;
1236 Address start = obj.getHandle(); 1264 Address start = obj.getHandle();
1237 long end = obj.getObjectSize(); 1265 long end = obj.getObjectSize();
1244 index += 4; 1272 index += 4;
1245 } 1273 }
1246 return false; 1274 return false;
1247 } 1275 }
1248 }; 1276 };
1249 if (type.equals("heap")) {
1250 VM.getVM().getObjectHeap().iterate(iterator); 1277 VM.getVM().getObjectHeap().iterate(iterator);
1251 } else {
1252 VM.getVM().getObjectHeap().iteratePerm(iterator);
1253 }
1254 } else if (type.equals("codecache")) { 1278 } else if (type.equals("codecache")) {
1255 CodeCacheVisitor v = new CodeCacheVisitor() { 1279 CodeCacheVisitor v = new CodeCacheVisitor() {
1256 public void prologue(Address start, Address end) { 1280 public void prologue(Address start, Address end) {
1257 } 1281 }
1258 public void visit(CodeBlob blob) { 1282 public void visit(CodeBlob blob) {