hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java

Print this page
rev 611 : Merge

*** 1,7 **** /* ! * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 156,166 **** } } public ObjectHeap(TypeDataBase db) throws WrongTypeException { // Get commonly used sizes of basic types ! oopSize = db.getOopSize(); byteSize = db.getJByteType().getSize(); charSize = db.getJCharType().getSize(); booleanSize = db.getJBooleanType().getSize(); intSize = db.getJIntType().getSize(); shortSize = db.getJShortType().getSize(); --- 156,166 ---- } } public ObjectHeap(TypeDataBase db) throws WrongTypeException { // Get commonly used sizes of basic types ! oopSize = VM.getVM().getOopSize(); byteSize = db.getJByteType().getSize(); charSize = db.getJCharType().getSize(); booleanSize = db.getJBooleanType().getSize(); intSize = db.getJIntType().getSize(); shortSize = db.getJShortType().getSize();
*** 314,323 **** --- 314,331 ---- addPermGenLiveRegions(liveRegions, heap); sortLiveRegions(liveRegions); iterateLiveRegions(liveRegions, visitor, null); } + public boolean isValidMethod(OopHandle handle) { + OopHandle klass = Oop.getKlassForOopHandle(handle); + if (klass != null && klass.equals(methodKlassHandle)) { + return true; + } + return false; + } + // Creates an instance from the Oop hierarchy based based on the handle public Oop newOop(OopHandle handle) { // The only known way to detect the right type of an oop is // traversing the class chain until a well-known klass is recognized. // A more direct solution would require the klasses to expose
*** 380,395 **** System.err.println("Oop's klass is " + klass); } throw new UnknownOopException(); } ! public boolean isValidMethod(OopHandle handle) { ! OopHandle klass = Oop.getKlassForOopHandle(handle); ! if (klass != null && klass.equals(methodKlassHandle)) { ! return true; } ! return false; } // Print all objects in the object heap public void print() { HeapPrinter printer = new HeapPrinter(System.out); --- 388,403 ---- System.err.println("Oop's klass is " + klass); } throw new UnknownOopException(); } ! if (DEBUG) { ! System.err.println("Unknown oop at " + handle); ! System.err.println("Oop's klass is " + klass); } ! ! throw new UnknownOopException(); } // Print all objects in the object heap public void print() { HeapPrinter printer = new HeapPrinter(System.out);
*** 453,468 **** --- 461,480 ---- Address top = (Address) liveRegions.get(i+1); try { // Traverses the space from bottom to top OopHandle handle = bottom.addOffsetToAsOopHandle(0); + while (handle.lessThan(top)) { Oop obj = null; try { obj = newOop(handle); } catch (UnknownOopException exp) { + if (DEBUG) { + throw new RuntimeException(" UnknownOopException " + exp); + } } if (obj == null) { //Find the object size using Printezis bits and skip over System.err.println("Finding object size using Printezis bits and skipping over..."); long size = 0;