Relates :
|
On 2013/2/25 2:58, ������(Yunda) wrote: Hi all, When I used CLHSDB just now I met this error: hsdb> inspect 0x00000000ee255080 instance of "java/io/InputStream" @ 0x00000000ee255080 @ 0x00000000ee255080 (size = 24) Exception in thread "main" java.lang.InternalError: unimplemented at sun.jvm.hotspot.oops.Oop.iterateFields(Oop.java:151) at sun.jvm.hotspot.oops.Instance.iterateFields(Instance.java:66) at sun.jvm.hotspot.oops.Oop.iterate(Oop.java:143) at sun.jvm.hotspot.ui.tree.OopTreeNodeAdapter.getChildCount(OopTreeNodeAdapter.java:65) at sun.jvm.hotspot.CommandProcessor$Command.printNode(CommandProcessor.java:231) at sun.jvm.hotspot.CommandProcessor$24.doit(CommandProcessor.java:1008) at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1897) at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1867) at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1747) at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:91) at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35) I found it���s caused by the code of sun.jvm.hotspot.oops.Oop.iterateFields(): void iterateFields(OopVisitor visitor, boolean doVMFields) { if (doVMFields) { visitor.doCInt(mark, true); if (VM.getVM().isCompressedKlassPointersEnabled()) { throw new InternalError("unimplemented"); } else { visitor.doMetadata(klass, true); } } } When compressed oops( which is by default) are used an InternalError of ���unimplemented��� will be throwed. But actually it can be implemented easily by just one line of code: visitor.doMetadata(compressedKlass, true); I checked the hotspot-rt repo and I found it was implemented this way before changeset 3601, the main implementation of NPG. Since 3601 changed a whole lot of stuff, the ���compressedKlass��� field couldn���t get the right value, as in line 51: // compressedKlass = new CIntField(type.getCIntegerField("_metadata._compressed_klass"), 0); So the code in iterateFields() was changed to throwing an InternalError accordingly. But the ���compressedKlass��� field can get the right value now. So I think it���s time to change the code back and here���s the diff against the latest hotspot-rt: diff -r 2f881161d085 agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java Mon Feb 25 18:25:24 2013 +0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java Mon Feb 25 18:47:08 2013 +0800 @@ -148,7 +148,7 @@ if (doVMFields) { visitor.doCInt(mark, true); if (VM.getVM().isCompressedKlassPointersEnabled()) { - throw new InternalError("unimplemented"); + visitor.doMetadata(compressedKlass, true); } else { visitor.doMetadata(klass, true); } Regards, Yunda