--- old/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java 2009-08-01 04:06:23.583309693 +0100 +++ new/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java 2009-08-01 04:06:23.493134364 +0100 @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 @@ -19,7 +19,7 @@ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. - * + * */ package sun.jvm.hotspot.memory; @@ -55,20 +55,30 @@ private static synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("SystemDictionary"); - + dictionaryField = type.getAddressField("_dictionary"); sharedDictionaryField = type.getAddressField("_shared_dictionary"); placeholdersField = type.getAddressField("_placeholders"); loaderConstraintTableField = type.getAddressField("_loader_constraints"); javaSystemLoaderField = type.getOopField("_java_system_loader"); nofBuckets = db.lookupIntConstant("SystemDictionary::_nof_buckets").intValue(); - - objectKlassField = type.getOopField("_object_klass"); - classLoaderKlassField = type.getOopField("_classloader_klass"); - stringKlassField = type.getOopField("_string_klass"); - systemKlassField = type.getOopField("_system_klass"); - threadKlassField = type.getOopField("_thread_klass"); - threadGroupKlassField = type.getOopField("_threadGroup_klass"); + + objectKlassField = type.getOopField(WK_KLASS("object_klass")); + classLoaderKlassField = type.getOopField(WK_KLASS("classloader_klass")); + stringKlassField = type.getOopField(WK_KLASS("string_klass")); + systemKlassField = type.getOopField(WK_KLASS("system_klass")); + threadKlassField = type.getOopField(WK_KLASS("thread_klass")); + threadGroupKlassField = type.getOopField(WK_KLASS("threadGroup_klass")); + } + + // This WK functions must follow the definitions in systemDictionary.hpp: + private static String WK_KLASS(String name) { + //#define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] + return ("_well_known_klasses[SystemDictionary::"+WK_KLASS_ENUM_NAME(name)+"]"); + } + private static String WK_KLASS_ENUM_NAME(String kname) { + //#define WK_KLASS_ENUM_NAME(kname) kname##_knum + return (kname+"_knum"); } public Dictionary dictionary() { @@ -85,7 +95,7 @@ Address tmp = placeholdersField.getValue(); return (PlaceholderTable) VMObjectFactory.newObject(PlaceholderTable.class, tmp); } - + public LoaderConstraintTable constraints() { Address tmp = placeholdersField.getValue(); return (LoaderConstraintTable) VMObjectFactory.newObject(LoaderConstraintTable.class, tmp); @@ -121,7 +131,7 @@ return (InstanceKlass) find("java/util/concurrent/locks/AbstractOwnableSynchronizer", null, null); } - + public static Oop javaSystemLoader() { return newOop(javaSystemLoaderField.getValue()); }