Wed, 30 Mar 2011 07:47:19 -0700
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
Reviewed-by: kvn, dcubed
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java Wed Mar 30 03:48:38 2011 -0700 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java Wed Mar 30 07:47:19 2011 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -27,7 +27,7 @@ 1.11 import com.sun.jdi.*; 1.12 import sun.jvm.hotspot.oops.Instance; 1.13 import sun.jvm.hotspot.oops.Klass; 1.14 -import sun.jvm.hotspot.oops.OopUtilities; 1.15 +import sun.jvm.hotspot.oops.java_lang_Class; 1.16 1.17 public class ClassObjectReferenceImpl extends ObjectReferenceImpl 1.18 implements ClassObjectReference { 1.19 @@ -39,7 +39,7 @@ 1.20 1.21 public ReferenceType reflectedType() { 1.22 if (reflectedType == null) { 1.23 - Klass k = OopUtilities.classOopToKlass(ref()); 1.24 + Klass k = java_lang_Class.asKlass(ref()); 1.25 reflectedType = vm.referenceType(k); 1.26 } 1.27 return reflectedType;
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java Wed Mar 30 03:48:38 2011 -0700 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java Wed Mar 30 07:47:19 2011 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -64,7 +64,7 @@ 2.11 2.12 public void iterateFields(OopVisitor visitor, boolean doVMFields) { 2.13 super.iterateFields(visitor, doVMFields); 2.14 - ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor); 2.15 + ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor, this); 2.16 } 2.17 2.18 public void printValueOn(PrintStream tty) {
3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Wed Mar 30 03:48:38 2011 -0700 3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Wed Mar 30 07:47:19 2011 -0700 3.3 @@ -241,6 +241,10 @@ 3.4 // Byteside of the header 3.5 private static long headerSize; 3.6 3.7 + public long getObjectSize(Oop object) { 3.8 + return getSizeHelper() * VM.getVM().getAddressSize(); 3.9 + } 3.10 + 3.11 public static long getHeaderSize() { return headerSize; } 3.12 3.13 // Accessors for declared fields 3.14 @@ -459,7 +463,22 @@ 3.15 visitor.doCInt(vtableLen, true); 3.16 visitor.doCInt(itableLen, true); 3.17 } 3.18 + } 3.19 3.20 + /* 3.21 + * Visit the static fields of this InstanceKlass with the obj of 3.22 + * the visitor set to the oop holding the fields, which is 3.23 + * currently the java mirror. 3.24 + */ 3.25 + public void iterateStaticFields(OopVisitor visitor) { 3.26 + visitor.setObj(getJavaMirror()); 3.27 + visitor.prologue(); 3.28 + iterateStaticFieldsInternal(visitor); 3.29 + visitor.epilogue(); 3.30 + 3.31 + } 3.32 + 3.33 + void iterateStaticFieldsInternal(OopVisitor visitor) { 3.34 TypeArray fields = getFields(); 3.35 int length = (int) fields.getLength(); 3.36 for (int index = 0; index < length; index += NEXT_OFFSET) { 3.37 @@ -477,9 +496,9 @@ 3.38 return getSuper(); 3.39 } 3.40 3.41 - public void iterateNonStaticFields(OopVisitor visitor) { 3.42 + public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { 3.43 if (getSuper() != null) { 3.44 - ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor); 3.45 + ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); 3.46 } 3.47 TypeArray fields = getFields(); 3.48
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java Wed Mar 30 07:47:19 2011 -0700 4.3 @@ -0,0 +1,67 @@ 4.4 +/* 4.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + * 4.26 + */ 4.27 + 4.28 +package sun.jvm.hotspot.oops; 4.29 + 4.30 +import java.io.*; 4.31 +import java.util.*; 4.32 +import sun.jvm.hotspot.debugger.*; 4.33 +import sun.jvm.hotspot.memory.*; 4.34 +import sun.jvm.hotspot.runtime.*; 4.35 +import sun.jvm.hotspot.types.*; 4.36 +import sun.jvm.hotspot.utilities.*; 4.37 + 4.38 +// An InstanceKlass is the VM level representation of a Java class. 4.39 + 4.40 +public class InstanceMirrorKlass extends InstanceKlass { 4.41 + static { 4.42 + VM.registerVMInitializedObserver(new Observer() { 4.43 + public void update(Observable o, Object data) { 4.44 + initialize(VM.getVM().getTypeDataBase()); 4.45 + } 4.46 + }); 4.47 + } 4.48 + 4.49 + private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { 4.50 + // Just make sure it's there for now 4.51 + Type type = db.lookupType("instanceMirrorKlass"); 4.52 + } 4.53 + 4.54 + InstanceMirrorKlass(OopHandle handle, ObjectHeap heap) { 4.55 + super(handle, heap); 4.56 + } 4.57 + 4.58 + public long getObjectSize(Oop o) { 4.59 + return java_lang_Class.getOopSize(o) * VM.getVM().getAddressSize(); 4.60 + } 4.61 + 4.62 + public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { 4.63 + super.iterateNonStaticFields(visitor, obj); 4.64 + // Fetch the real klass from the mirror object 4.65 + Klass klass = java_lang_Class.asKlass(obj); 4.66 + if (klass instanceof InstanceKlass) { 4.67 + ((InstanceKlass)klass).iterateStaticFields(visitor); 4.68 + } 4.69 + } 4.70 +}
5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Wed Mar 30 03:48:38 2011 -0700 5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Wed Mar 30 07:47:19 2011 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -362,7 +362,16 @@ 5.11 if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this); 5.12 if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this); 5.13 } 5.14 - if (klass.equals(instanceKlassKlassHandle)) return new InstanceKlass(handle, this); 5.15 + if (klass.equals(instanceKlassKlassHandle)) { 5.16 + InstanceKlass ik = new InstanceKlass(handle, this); 5.17 + if (ik.getName().asString().equals("java/lang/Class")) { 5.18 + // We would normally do this using the vtable style 5.19 + // lookup but since it's not used for these currently 5.20 + // it's simpler to just check for the name. 5.21 + return new InstanceMirrorKlass(handle, this); 5.22 + } 5.23 + return ik; 5.24 + } 5.25 if (klass.equals(objArrayKlassKlassHandle)) return new ObjArrayKlass(handle, this); 5.26 if (klass.equals(typeArrayKlassKlassHandle)) return new TypeArrayKlass(handle, this); 5.27
6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java Wed Mar 30 03:48:38 2011 -0700 6.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java Wed Mar 30 07:47:19 2011 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -103,12 +103,8 @@ 6.11 // Returns the byte size of this object 6.12 public long getObjectSize() { 6.13 Klass k = getKlass(); 6.14 - if (k instanceof InstanceKlass) { 6.15 - return ((InstanceKlass)k).getSizeHelper() 6.16 - * VM.getVM().getAddressSize(); 6.17 - } 6.18 - // If it is not an instance, this method should be replaced. 6.19 - return getHeaderSize(); 6.20 + // All other types should be overriding getObjectSize directly 6.21 + return ((InstanceKlass)k).getObjectSize(this); 6.22 } 6.23 6.24 // Type test operations
7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java Wed Mar 30 03:48:38 2011 -0700 7.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java Wed Mar 30 07:47:19 2011 -0700 7.3 @@ -74,9 +74,6 @@ 7.4 private static int THREAD_STATUS_TERMINATED; 7.5 */ 7.6 7.7 - // java.lang.Class fields 7.8 - private static OopField hcKlassField; 7.9 - 7.10 // java.util.concurrent.locks.AbstractOwnableSynchronizer fields 7.11 private static OopField absOwnSyncOwnerThreadField; 7.12 7.13 @@ -268,27 +265,6 @@ 7.14 return null; 7.15 } 7.16 7.17 - // initialize fields for java.lang.Class 7.18 - private static void initClassFields() { 7.19 - if (hcKlassField == null) { 7.20 - // hc_klass is a HotSpot magic field and hence we can't 7.21 - // find it from InstanceKlass for java.lang.Class. 7.22 - TypeDataBase db = VM.getVM().getTypeDataBase(); 7.23 - int hcKlassOffset = (int) db.lookupType("java_lang_Class").getCIntegerField("klass_offset").getValue(); 7.24 - if (VM.getVM().isCompressedOopsEnabled()) { 7.25 - hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); 7.26 - } else { 7.27 - hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); 7.28 - } 7.29 - } 7.30 - } 7.31 - 7.32 - /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */ 7.33 - public static Klass classOopToKlass(Oop aClass) { 7.34 - initClassFields(); 7.35 - return (Klass) hcKlassField.getValue(aClass); 7.36 - } 7.37 - 7.38 // initialize fields for j.u.c.l AbstractOwnableSynchornizer class 7.39 private static void initAbsOwnSyncFields() { 7.40 if (absOwnSyncOwnerThreadField == null) {
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java Wed Mar 30 07:47:19 2011 -0700 8.3 @@ -0,0 +1,77 @@ 8.4 +/* 8.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + * 8.26 + */ 8.27 + 8.28 +package sun.jvm.hotspot.oops; 8.29 + 8.30 +import java.util.*; 8.31 + 8.32 +import sun.jvm.hotspot.debugger.*; 8.33 +import sun.jvm.hotspot.memory.*; 8.34 +import sun.jvm.hotspot.runtime.*; 8.35 +import sun.jvm.hotspot.types.Type; 8.36 +import sun.jvm.hotspot.types.TypeDataBase; 8.37 +import sun.jvm.hotspot.utilities.*; 8.38 +import sun.jvm.hotspot.jdi.JVMTIThreadState; 8.39 + 8.40 +/** A utility class encapsulating useful oop operations */ 8.41 + 8.42 +// initialize fields for java.lang.Class 8.43 +public class java_lang_Class { 8.44 + 8.45 + // java.lang.Class fields 8.46 + static OopField klassField; 8.47 + static IntField oopSizeField; 8.48 + 8.49 + static { 8.50 + VM.registerVMInitializedObserver(new Observer() { 8.51 + public void update(Observable o, Object data) { 8.52 + initialize(VM.getVM().getTypeDataBase()); 8.53 + } 8.54 + }); 8.55 + } 8.56 + 8.57 + private static synchronized void initialize(TypeDataBase db) { 8.58 + // klass and oop_size are HotSpot magic fields and hence we can't 8.59 + // find them from InstanceKlass for java.lang.Class. 8.60 + Type jlc = db.lookupType("java_lang_Class"); 8.61 + int klassOffset = (int) jlc.getCIntegerField("klass_offset").getValue(); 8.62 + if (VM.getVM().isCompressedOopsEnabled()) { 8.63 + klassField = new NarrowOopField(new NamedFieldIdentifier("klass"), klassOffset, true); 8.64 + } else { 8.65 + klassField = new OopField(new NamedFieldIdentifier("klass"), klassOffset, true); 8.66 + } 8.67 + int oopSizeOffset = (int) jlc.getCIntegerField("oop_size_offset").getValue(); 8.68 + oopSizeField = new IntField(new NamedFieldIdentifier("oop_size"), oopSizeOffset, true); 8.69 + } 8.70 + 8.71 + /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */ 8.72 + public static Klass asKlass(Oop aClass) { 8.73 + return (Klass) java_lang_Class.klassField.getValue(aClass); 8.74 + } 8.75 + 8.76 + /** get oop_size field at offset oop_size_offset from a java.lang.Class object */ 8.77 + public static long getOopSize(Oop aClass) { 8.78 + return java_lang_Class.oopSizeField.getValue(aClass); 8.79 + } 8.80 +}
9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Wed Mar 30 03:48:38 2011 -0700 9.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Wed Mar 30 07:47:19 2011 -0700 9.3 @@ -839,20 +839,18 @@ 9.4 } 9.5 9.6 private void readSystemProperties() { 9.7 - final InstanceKlass systemKls = getSystemDictionary().getSystemKlass(); 9.8 - systemKls.iterate(new DefaultOopVisitor() { 9.9 - ObjectReader objReader = new ObjectReader(); 9.10 - public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) { 9.11 - if (field.getID().getName().equals("props")) { 9.12 - try { 9.13 - sysProps = (Properties) objReader.readObject(field.getValue(systemKls.getJavaMirror())); 9.14 - } catch (Exception e) { 9.15 - if (Assert.ASSERTS_ENABLED) { 9.16 - e.printStackTrace(); 9.17 - } 9.18 - } 9.19 - } 9.20 - } 9.21 - }, false); 9.22 + final InstanceKlass systemKls = getSystemDictionary().getSystemKlass(); 9.23 + systemKls.iterateStaticFields(new DefaultOopVisitor() { 9.24 + ObjectReader objReader = new ObjectReader(); 9.25 + public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) { 9.26 + if (field.getID().getName().equals("props")) { 9.27 + try { 9.28 + sysProps = (Properties) objReader.readObject(field.getValue(getObj())); 9.29 + } catch (Exception e) { 9.30 + e.printStackTrace(); 9.31 + } 9.32 + } 9.33 + } 9.34 + }); 9.35 } 9.36 }
10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Wed Mar 30 03:48:38 2011 -0700 10.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Wed Mar 30 07:47:19 2011 -0700 10.3 @@ -1,5 +1,5 @@ 10.4 /* 10.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 10.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 10.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.8 * 10.9 * This code is free software; you can redistribute it and/or modify it 10.10 @@ -64,16 +64,16 @@ 10.11 */ 10.12 InstanceKlass ik = 10.13 SystemDictionaryHelper.findInstanceKlass("java.lang.ref.Finalizer"); 10.14 - final OopField queueField[] = new OopField[1]; 10.15 - ik.iterateFields(new DefaultOopVisitor() { 10.16 + final Oop[] queueref = new Oop[1]; 10.17 + ik.iterateStaticFields(new DefaultOopVisitor() { 10.18 public void doOop(OopField field, boolean isVMField) { 10.19 - String name = field.getID().getName(); 10.20 - if (name.equals("queue")) { 10.21 - queueField[0] = field; 10.22 - } 10.23 + String name = field.getID().getName(); 10.24 + if (name.equals("queue")) { 10.25 + queueref[0] = field.getValue(getObj()); 10.26 + } 10.27 } 10.28 - }, false); 10.29 - Oop queue = queueField[0].getValue(ik); 10.30 + }); 10.31 + Oop queue = queueref[0]; 10.32 10.33 InstanceKlass k = (InstanceKlass) queue.getKlass(); 10.34
11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Wed Mar 30 03:48:38 2011 -0700 11.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Wed Mar 30 07:47:19 2011 -0700 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -164,7 +164,7 @@ 11.11 11.12 protected void writeClass(Instance instance) throws IOException { 11.13 writeObjectHeader(instance); 11.14 - Klass reflectedType = OopUtilities.classOopToKlass(instance); 11.15 + Klass reflectedType = java_lang_Class.asKlass(instance); 11.16 boolean isInstanceKlass = (reflectedType instanceof InstanceKlass); 11.17 // reflectedType is null for primitive types (int.class etc). 11.18 if (reflectedType != null) {
12.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Wed Mar 30 03:48:38 2011 -0700 12.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Wed Mar 30 07:47:19 2011 -0700 12.3 @@ -455,7 +455,7 @@ 12.4 } 12.5 12.6 protected void writeClass(Instance instance) throws IOException { 12.7 - Klass reflectedKlass = OopUtilities.classOopToKlass(instance); 12.8 + Klass reflectedKlass = java_lang_Class.asKlass(instance); 12.9 // dump instance record only for primitive type Class objects. 12.10 // all other Class objects are covered by writeClassDumpRecords. 12.11 if (reflectedKlass == null) {
13.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java Wed Mar 30 03:48:38 2011 -0700 13.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java Wed Mar 30 07:47:19 2011 -0700 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -117,10 +117,10 @@ 13.11 public boolean doObj(Oop obj) { 13.12 if (obj instanceof InstanceKlass) { 13.13 final InstanceKlass ik = (InstanceKlass) obj; 13.14 - ik.iterateFields( 13.15 + ik.iterateStaticFields( 13.16 new DefaultOopVisitor() { 13.17 public void doOop(OopField field, boolean isVMField) { 13.18 - Oop next = field.getValue(ik); 13.19 + Oop next = field.getValue(getObj()); 13.20 LivenessPathElement lp = new LivenessPathElement(null, 13.21 new NamedFieldIdentifier("Static field \"" + 13.22 field.getID().getName() + 13.23 @@ -142,8 +142,7 @@ 13.24 System.err.println(); 13.25 } 13.26 } 13.27 - }, 13.28 - false); 13.29 + }); 13.30 } 13.31 return false; 13.32 }
14.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java Wed Mar 30 03:48:38 2011 -0700 14.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java Wed Mar 30 07:47:19 2011 -0700 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -158,7 +158,7 @@ 14.11 } else if (className.equals(javaLangThread())) { 14.12 res = new JSJavaThread(instance, this); 14.13 } else if (className.equals(javaLangClass())) { 14.14 - Klass reflectedType = OopUtilities.classOopToKlass(instance); 14.15 + Klass reflectedType = java_lang_Class.asKlass(instance); 14.16 if (reflectedType != null) { 14.17 JSJavaKlass jk = newJSJavaKlass(reflectedType); 14.18 // we don't support mirrors of VM internal Klasses
15.1 --- a/src/share/vm/oops/instanceMirrorKlass.hpp Wed Mar 30 03:48:38 2011 -0700 15.2 +++ b/src/share/vm/oops/instanceMirrorKlass.hpp Wed Mar 30 07:47:19 2011 -0700 15.3 @@ -36,6 +36,8 @@ 15.4 15.5 15.6 class instanceMirrorKlass: public instanceKlass { 15.7 + friend class VMStructs; 15.8 + 15.9 private: 15.10 static int _offset_of_static_fields; 15.11
16.1 --- a/src/share/vm/runtime/vmStructs.cpp Wed Mar 30 03:48:38 2011 -0700 16.2 +++ b/src/share/vm/runtime/vmStructs.cpp Wed Mar 30 07:47:19 2011 -0700 16.3 @@ -70,6 +70,7 @@ 16.4 #include "oops/cpCacheKlass.hpp" 16.5 #include "oops/cpCacheOop.hpp" 16.6 #include "oops/instanceKlass.hpp" 16.7 +#include "oops/instanceMirrorKlass.hpp" 16.8 #include "oops/instanceKlassKlass.hpp" 16.9 #include "oops/instanceOop.hpp" 16.10 #include "oops/klass.hpp" 16.11 @@ -1101,6 +1102,7 @@ 16.12 declare_type(instanceKlass, Klass) \ 16.13 declare_type(instanceKlassKlass, klassKlass) \ 16.14 declare_type(instanceOopDesc, oopDesc) \ 16.15 + declare_type(instanceMirrorKlass, instanceKlass) \ 16.16 declare_type(instanceRefKlass, instanceKlass) \ 16.17 declare_type(klassKlass, Klass) \ 16.18 declare_type(klassOopDesc, oopDesc) \