On 21/01/2013 1:06 PM, 云达 wrote: > Actually I just changed "BinaryTreeDictionary" to "AFLBinaryTreeDictionary", > since there is no definition of BinaryTreeDictionary in the latest hotspot: > http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/file/b5f6465019f6/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp > , which has been changed to AFLBinaryTreeDictionary. So the code in SA has > to change too. The bug is already found here: > http://bugs.sun.com/view_bug.do?bug_id=8005278
I'm still missing some pieces here. We have: typedef BinaryTreeDictionary<FreeChunk, AdaptiveFreeList> AFLBinaryTreeDictionary; in vmStructs and we have: ./share/vm/memory/binaryTreeDictionary.hpp/cpp and we have: src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java So I'm unclear what is causing the problem here. Staffan: can you generate a webrev from this patch to make the context clearer please? Thanks, David > Regards, > Yunda > -----邮件原件----- > 发件人: David Holmes [mailto:david.hol...@oracle.com] > 发送时间: 2013年1月21日 10:45 > 收件人: 云达 > 抄送: Staffan Larsen; serviceability-dev@openjdk.java.net > 主题: Re: 答复: Errors when use "universe" command in CLHSDB > > I couldn't quite understand the problem and fix from the patch. Why do we > need to add AFLBinaryTreeDictionary ?? > > Thanks, > David > > On 21/01/2013 12:03 PM, 云达 wrote: >> Thanks for your review again. Could someone with Reviewer status help >> me with this? Thanks in advance! >> >> Regards, >> >> Yunda >> >> *发件人:*Staffan Larsen [mailto:staffan.lar...@oracle.com] >> *发送时间:*2013年1月18日20:14 >> *收件人:*云达 >> *抄送:*daniel.daughe...@oracle.com; serviceability-dev@openjdk.java.net >> *主题:*Re: Errors when use "universe" command in CLHSDB >> >> This patch applied cleanly. >> >> I can sponsor this fix, but we still need a review from someone with >> Reviewer status. Once we have that, I can push the change. >> >> Thanks, >> >> /Staffan >> >> On 18 jan 2013, at 11:22, 云达<yunda....@taobao.com >> <mailto:yunda....@taobao.com>> wrote: >> >> >> >> OK. I diffed it with the >> latesthttp://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/and I hope it >> works. Thanks for the review! >> >> Regards, >> >> Yunda >> >> *发件人:*Staffan Larsen [mailto:staffan.lar...@oracle.com >> <http://oracle.com>] >> *发送时间:*2013年1月18日17:07 >> *收件人:*云达 >> *抄送:*daniel.daughe...@oracle.com<mailto:daniel.daughe...@oracle.com>; >> serviceability-dev@openjdk.java.net >> <mailto:serviceability-dev@openjdk.java.net> >> *主题:*Re: Errors when use "universe" command in CLHSDB >> >> Yunda, >> >> I think this fixes http://bugs.sun.com/view_bug.do?bug_id=8005278 >> >> The changes look good to me. I couldn't apply the patch to the code >> cleanly, however (see below). Perhaps the patch was broken in email? >> Can you regenerate the patch and include it as a zipped attachment? >> >> Thanks, >> >> /Staffan >> >> file >> agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary >> .java >> already exists >> 1 out of 1 hunks FAILED -- saving rejects to file >> agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary >> .java.rej >> patching file >> agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpac >> e.java >> Hunk #1 FAILED at 116 >> Hunk #2 FAILED at 40 >> 2 out of 2 hunks FAILED -- saving rejects to file >> agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpac >> e.java.rej >> patching file >> src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp >> Hunk #1 succeeded at 45 with fuzz 2 (offset 0 lines). >> patch failed, unable to continue (try -v) patch failed, rejects left >> in working dir >> >> On 18 jan 2013, at 04:54,云达<yunda....@taobao.com >> <mailto:yunda....@taobao.com>> wrote: >> >> >> >> >> Thanks Dan! >> >> Regards, >> >> Yunda >> >> *发件人:*Daniel D. Daugherty [mailto:daniel.daughe...@oracle.com >> <http://oracle.com>] >> *发送时间:*2013年1月18日10:46 >> *收件人:*云达;serviceability-dev@openjdk.java.net >> <mailto:serviceability-dev@openjdk.java.net> >> *主题:*Re: Errors when use "universe" command in CLHSDB >> >> Yunda, >> >> The Serviceability Agent is maintained by the Serviceability team. >> I'm adding that alias to this e-mail thread (and Bcc'ing the Runtime >> alias. >> >> Dan >> >> On 1/17/13 7:42 PM,云达wrote: >> >> Hi all, >> >> This is Yunda<yunda....@taobao.com> >> <mailto:yunda....@taobao.com>from Alibaba Group(with OCA). >> >> When I used CLHSDB( java -classpath .:$JAVA_HOME/lib/sa-jdi.jar >> sun.jvm.hotspot.CLHSDB) I found two errors below(the second error >> occurred after I made some fix). It seemed that some code about CMS >> in SA didn’t change accordingly. >> >> hsdb> universe >> >> Heap Parameters: >> >> Gen 0: eden >> [0x0000000609200000,0x00000006094aeb90,0x0000000611820000) space >> capacity = 140640256, 2.000007736049627 used >> >> from [0x0000000611820000,0x0000000611820000,0x00000006128e0000) >> space capacity = 17563648, 0.0 used >> >> to [0x00000006128e0000,0x00000006128e0000,0x00000006139a0000) space >> capacity = 17563648, 0.0 usedInvocations: 0 >> >> Gen 1: concurrent mark-sweep generation >> >> Exception in thread "main" java.lang.ExceptionInInitializerError >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> >> at >> >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo >> rAccessorImpl.java:57) >> >> at >> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo >> nstructorAccessorImpl.java:45) >> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:395) >> >> at >> >> sun.jvm.hotspot.runtime.VMObjectFactory.newObject(VMObjectFactory.java >> :58) >> >> at >> >> sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.cmsSpace(Concurre >> ntMarkSweepGeneration.java:55) >> >> at >> >> sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.printOn(Concurren >> tMarkSweepGeneration.java:79) >> >> at >> >> sun.jvm.hotspot.memory.GenCollectedHeap.printOn(GenCollectedHeap.java: >> 139) >> >> at >> sun.jvm.hotspot.CommandProcessor$48.doit(CommandProcessor.java:1605) >> >> 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) >> >> Caused by: java.lang.RuntimeException: field "_dictionary" not found >> in type CompactibleFreeListSpace >> >> at >> sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:183) >> >> at >> sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:190) >> >> at >> sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:194) >> >> at >> >> sun.jvm.hotspot.types.basic.BasicType.getAddressField(BasicType.java:2 >> 82) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.initialize(Compactible >> FreeListSpace.java:69) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.access$000(Compactible >> FreeListSpace.java:35) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace$1.update(CompactibleFr >> eeListSpace.java:55) >> >> at >> sun.jvm.hotspot.runtime.VM.registerVMInitializedObserver(VM.java:402) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.<clinit>(CompactibleFr >> eeListSpace.java:53) >> >> ... 14 more >> >> hsdb> universe >> >> Heap Parameters: >> >> Gen 0: eden >> [0x0000000609200000,0x00000006094aeb90,0x0000000611820000) space >> capacity = 140640256, 2.000007736049627 used >> >> from [0x0000000611820000,0x0000000611820000,0x00000006128e0000) >> space capacity = 17563648, 0.0 used >> >> to [0x00000006128e0000,0x00000006128e0000,0x00000006139a0000) space >> capacity = 17563648, 0.0 usedInvocations: 0 >> >> Gen 1: concurrent mark-sweep generation >> >> free-list-space[ 0x000000064cb90000 , 0x0000000661ad0000 ) Exception >> in thread "main" java.lang.ExceptionInInitializerError >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.free(CompactibleFreeLi >> stSpace.java:112) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.used(CompactibleFreeLi >> stSpace.java:95) >> >> at >> >> sun.jvm.hotspot.memory.CompactibleFreeListSpace.printOn(CompactibleFre >> eListSpace.java:137) >> >> at >> >> sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.printOn(Concurren >> tMarkSweepGeneration.java:79) >> >> at >> >> sun.jvm.hotspot.memory.GenCollectedHeap.printOn(GenCollectedHeap.java: >> 139) >> >> at >> sun.jvm.hotspot.CommandProcessor$48.doit(CommandProcessor.java:1605) >> >> 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) >> >> Caused by: java.lang.RuntimeException: No type named "FreeList" in >> database >> >> at >> >> sun.jvm.hotspot.types.basic.BasicTypeDataBase.lookupType(BasicTypeData >> Base.java:80) >> >> at >> >> sun.jvm.hotspot.HotSpotTypeDataBase.lookupType(HotSpotTypeDataBase.jav >> a:134) >> >> at >> >> sun.jvm.hotspot.types.basic.BasicTypeDataBase.lookupType(BasicTypeData >> Base.java:74) >> >> at sun.jvm.hotspot.memory.FreeList.initialize(FreeList.java:44) >> >> at sun.jvm.hotspot.memory.FreeList.access$000(FreeList.java:34) >> >> at sun.jvm.hotspot.memory.FreeList$1.update(FreeList.java:38) >> >> at >> sun.jvm.hotspot.runtime.VM.registerVMInitializedObserver(VM.java:402) >> >> at sun.jvm.hotspot.memory.FreeList.<clinit>(FreeList.java:36) >> >> ... 11 more >> >> So I made a patch to fix them and now “universe” command works well. >> Could someone help to review the patch below? >> >> diff -r b14da2e6f2dc -r 8652e04889a4 >> >> agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary >> .java >> >> --- /dev/null Thu Jan 01 00:00:00 1970 +0000 >> >> +++ >> >> b/agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java >> Fri Jan 18 09:56:06 2013 +0800 >> >> @@ -0,0 +1,59 @@ >> >> +/* >> >> + * @(#)AFLBinaryTreeDictionary.java >> >> + * Copyright (c) 2000, 2008, 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 >> >> + * under the terms of the GNU General Public License version 2 >> only, as >> >> + * published by the Free Software Foundation. >> >> + * >> >> + * This code is distributed in the hope that it will be useful, but >> WITHOUT >> >> + * ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY or >> >> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public >> License >> >> + * version 2 for more details (a copy is included in the LICENSE >> file that >> >> + * accompanied this code). >> >> + * >> >> + * You should have received a copy of the GNU General Public >> License version >> >> + * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA >> 94065 USA >> >> + * or visitwww.oracle.com<http://www.oracle.com>if you need >> additional information or have any >> >> + * questions. >> >> + * >> >> + */ >> >> + >> >> +package sun.jvm.hotspot.memory; >> >> + >> >> +import java.util.*; >> >> +import sun.jvm.hotspot.debugger.*; >> >> +import sun.jvm.hotspot.types.*; >> >> +import sun.jvm.hotspot.runtime.*; >> >> + >> >> +public class AFLBinaryTreeDictionary extends VMObject { >> >> + static { >> >> + VM.registerVMInitializedObserver(new Observer() { >> >> + public void update(Observable o, Object data) { >> >> + initialize(VM.getVM().getTypeDataBase()); >> >> + } >> >> + }); >> >> + } >> >> + >> >> + private static synchronized void initialize(TypeDataBase db) { >> >> + Type type = db.lookupType("AFLBinaryTreeDictionary"); >> >> + totalSizeField = type.getCIntegerField("_total_size"); >> >> + } >> >> + >> >> + // Fields >> >> + private static CIntegerField totalSizeField; >> >> + >> >> + // Accessors >> >> + public long size() { >> >> + return totalSizeField.getValue(addr); >> >> + } >> >> + >> >> + // Constructor >> >> + public AFLBinaryTreeDictionary(Address addr) { >> >> + super(addr); >> >> + } >> >> +} >> >> diff -r b14da2e6f2dc -r 8652e04889a4 >> >> agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.ja >> va >> >> --- >> >> a/agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java >> Thu Jan 17 13:40:31 2013 -0500 >> >> +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 >> >> @@ -1,59 +0,0 @@ >> >> -/* >> >> - * @(#)BinaryTreeDictionary.java >> >> - * Copyright (c) 2000, 2008, 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 >> >> - * under the terms of the GNU General Public License version 2 >> only, as >> >> - * published by the Free Software Foundation. >> >> - * >> >> - * This code is distributed in the hope that it will be useful, but >> WITHOUT >> >> - * ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY or >> >> - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public >> License >> >> - * version 2 for more details (a copy is included in the LICENSE >> file that >> >> - * accompanied this code). >> >> - * >> >> - * You should have received a copy of the GNU General Public >> License version >> >> - * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA >> 94065 USA >> >> - * or visitwww.oracle.com<http://www.oracle.com>if you need >> additional information or have any >> >> - * questions. >> >> - * >> >> - */ >> >> - >> >> -package sun.jvm.hotspot.memory; >> >> - >> >> -import java.util.*; >> >> -import sun.jvm.hotspot.debugger.*; >> >> -import sun.jvm.hotspot.types.*; >> >> -import sun.jvm.hotspot.runtime.*; >> >> - >> >> -public class BinaryTreeDictionary extends VMObject { >> >> - static { >> >> - VM.registerVMInitializedObserver(new Observer() { >> >> - public void update(Observable o, Object data) { >> >> - initialize(VM.getVM().getTypeDataBase()); >> >> - } >> >> - }); >> >> - } >> >> - >> >> - private static synchronized void initialize(TypeDataBase db) { >> >> - Type type = db.lookupType("BinaryTreeDictionary"); >> >> - totalSizeField = type.getCIntegerField("_totalSize"); >> >> - } >> >> - >> >> - // Fields >> >> - private static CIntegerField totalSizeField; >> >> - >> >> - // Accessors >> >> - public long size() { >> >> - return totalSizeField.getValue(addr); >> >> - } >> >> - >> >> - // Constructor >> >> - public BinaryTreeDictionary(Address addr) { >> >> - super(addr); >> >> - } >> >> -} >> >> diff -r b14da2e6f2dc -r 8652e04889a4 >> >> agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpac >> e.java >> >> --- >> >> a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java >> Thu Jan 17 13:40:31 2013 -0500 >> >> +++ >> >> b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java >> Fri Jan 18 09:56:06 2013 +0800 >> >> @@ -117,7 +117,7 @@ >> >> } >> >> // large block >> >> - BinaryTreeDictionary bfbd = (BinaryTreeDictionary) >> VMObjectFactory.newObject(BinaryTreeDictionary.class, >> >> + AFLBinaryTreeDictionary bfbd = (AFLBinaryTreeDictionary) >> VMObjectFactory.newObject(AFLBinaryTreeDictionary.class, >> >> dictionaryField.getValue(addr)); >> >> size += bfbd.size(); >> >> diff -r b14da2e6f2dc -r 8652e04889a4 >> agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java >> >> --- a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java >> Thu Jan 17 13:40:31 2013 -0500 >> >> +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java >> Fri Jan 18 09:56:06 2013 +0800 >> >> @@ -41,7 +41,7 @@ >> >> } >> >> private static synchronized void initialize(TypeDataBase db) { >> >> - Type type = db.lookupType("FreeList"); >> >> + Type type = db.lookupType("FreeList<FreeChunk>"); >> >> sizeField = type.getCIntegerField("_size"); >> >> countField = type.getCIntegerField("_count"); >> >> headerSize = type.getSize(); >> >> diff -r b14da2e6f2dc -r 8652e04889a4 >> >> src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp >> >> --- >> a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp >> Thu Jan 17 13:40:31 2013 -0500 >> >> +++ >> b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp >> Fri Jan 18 09:56:06 2013 +0800 >> >> @@ -43,7 +43,8 @@ >> >> nonstatic_field(LinearAllocBlock, _word_size, size_t) \ >> >> nonstatic_field(AFLBinaryTreeDictionary, _total_size, size_t) \ >> >> nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], >> FreeList<FreeChunk>) \ >> >> - nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, >> LinearAllocBlock) >> >> + nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, >> LinearAllocBlock) \ >> >> + nonstatic_field(CompactibleFreeListSpace, _dictionary, >> FreeBlockDictionary<FreeChunk>*) >> >> #define VM_TYPES_CMS(declare_type, \ >> >> Regards, >> >> Yunda >> >> >> ---------------------------------------------------------------------- >> -- >> >> >> This email (including any attachments) is confidential and may be >> legally privileged. If you received this email in error, please >> delete it immediately and do not copy it or use it for any purpose >> or disclose its contents to any other person. Thank you. >> >> 本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件 >> 人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或 >> 透露本邮件之内容。谢谢。 >> >> ---------------------------------------------------------------------- >> -- >> >> >> This email (including any attachments) is confidential and may be >> legally privileged. If you received this email in error, please delete >> it immediately and do not copy it or use it for any purpose or >> disclose its contents to any other person. Thank you. >> >> 本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人, >> 请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮 >> 件之内容。谢谢。 >> >> <tmp.zip> >> > > ________________________________ > > This email (including any attachments) is confidential and may be legally > privileged. If you received this email in error, please delete it immediately > and do not copy it or use it for any purpose or disclose its contents to any > other person. Thank you. > > 本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。