--- old/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java 2010-05-14 15:55:37.807642077 +0100 +++ new/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java 2010-05-14 15:55:37.626304740 +0100 @@ -1,5 +1,5 @@ /* - * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2000, 2005, Oracle and/or its affiliates. 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 @@ -16,8 +16,8 @@ * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, + * CA 94065 USA or visit www.oracle.com if you need additional information or * have any questions. * */ @@ -33,6 +33,7 @@ public class CodeCache { private static AddressField heapField; + private static AddressField scavengeRootNMethodsField; private static VirtualConstructor virtualConstructor; private CodeHeap heap; @@ -49,6 +50,7 @@ Type type = db.lookupType("CodeCache"); heapField = type.getAddressField("_heap"); + scavengeRootNMethodsField = type.getAddressField("_scavenge_root_nmethods"); virtualConstructor = new VirtualConstructor(db); // Add mappings for all possible CodeBlob subclasses @@ -67,6 +69,10 @@ heap = (CodeHeap) VMObjectFactory.newObject(CodeHeap.class, heapField.getValue()); } + public NMethod scavengeRootMethods() { + return (NMethod) VMObjectFactory.newObject(NMethod.class, scavengeRootNMethodsField.getValue()); + } + public boolean contains(Address p) { return getHeap().contains(p); } @@ -167,7 +173,8 @@ CodeBlob lastBlob = null; while (ptr != null && ptr.lessThan(end)) { try { - CodeBlob blob = findBlobUnsafe(ptr); + // Use findStart to get a pointer inside blob other findBlob asserts + CodeBlob blob = findBlobUnsafe(heap.findStart(ptr)); if (blob != null) { visitor.visit(blob); if (blob == lastBlob) {