8005278: Serviceability Agent: jmap -heap and jstack -m fail

Thu, 24 Jan 2013 23:30:45 -0800

author
minqi
date
Thu, 24 Jan 2013 23:30:45 -0800
changeset 4491
6cf2530f7fd3
parent 4490
5daaddd917a1
child 4492
8b46b0196eb0
child 4494
4a0dd3799a44
child 4497
16fb9f942703
child 4509
44c5fcd9cb25

8005278: Serviceability Agent: jmap -heap and jstack -m fail
Summary: BinaryTreeDictionary is typedef'ed as AFLBinaryTreeDictionary in vmStructs and in SA we still use old name for that. FreeList now is a template based class which is not reflect in SA type library. When SA does calculation of heap for CMS, the former will cause failure to retrieve BinaryTreeDictionary sine the rename. The later will fail wherever it is used in SA.
Reviewed-by: dholmes, sla, coleenp
Contributed-by: yunda.mly@taobao.com

agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java	Thu Jan 24 23:30:45 2013 -0800
     1.3 @@ -0,0 +1,59 @@
     1.4 +/*
     1.5 + * @(#)BinaryTreeDictionary.java
     1.6 + * Copyright (c) 2000, 2013, 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 + * under the terms of the GNU General Public License version 2 only, as
    1.11 + * published by the Free Software Foundation.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +package sun.jvm.hotspot.memory;
    1.30 +
    1.31 +import java.util.*;
    1.32 +import sun.jvm.hotspot.debugger.*;
    1.33 +import sun.jvm.hotspot.types.*;
    1.34 +import sun.jvm.hotspot.runtime.*;
    1.35 +
    1.36 +public class AFLBinaryTreeDictionary extends VMObject {
    1.37 +   static {
    1.38 +      VM.registerVMInitializedObserver(new Observer() {
    1.39 +         public void update(Observable o, Object data) {
    1.40 +            initialize(VM.getVM().getTypeDataBase());
    1.41 +         }
    1.42 +      });
    1.43 +   }
    1.44 +
    1.45 +   private static synchronized void initialize(TypeDataBase db) {
    1.46 +      Type type = db.lookupType("AFLBinaryTreeDictionary");
    1.47 +      totalSizeField = type.getCIntegerField("_total_size");
    1.48 +   }
    1.49 +
    1.50 +   // Fields
    1.51 +   private static CIntegerField totalSizeField;
    1.52 +
    1.53 +   // Accessors
    1.54 +   public long size() {
    1.55 +      return totalSizeField.getValue(addr);
    1.56 +   }
    1.57 +
    1.58 +   // Constructor
    1.59 +   public AFLBinaryTreeDictionary(Address addr) {
    1.60 +      super(addr);
    1.61 +   }
    1.62 +}
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java	Wed Jan 23 10:34:29 2013 -0500
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,59 +0,0 @@
     2.4 -/*
     2.5 - * @(#)BinaryTreeDictionary.java
     2.6 - * Copyright (c) 2000, 2008, 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 - * under the terms of the GNU General Public License version 2 only, as
    2.11 - * published by the Free Software Foundation.
    2.12 - *
    2.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
    2.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.16 - * version 2 for more details (a copy is included in the LICENSE file that
    2.17 - * accompanied this code).
    2.18 - *
    2.19 - * You should have received a copy of the GNU General Public License version
    2.20 - * 2 along with this work; if not, write to the Free Software Foundation,
    2.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.22 - *
    2.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.24 - * or visit www.oracle.com if you need additional information or have any
    2.25 - * questions.
    2.26 - *
    2.27 - */
    2.28 -
    2.29 -package sun.jvm.hotspot.memory;
    2.30 -
    2.31 -import java.util.*;
    2.32 -import sun.jvm.hotspot.debugger.*;
    2.33 -import sun.jvm.hotspot.types.*;
    2.34 -import sun.jvm.hotspot.runtime.*;
    2.35 -
    2.36 -public class BinaryTreeDictionary extends VMObject {
    2.37 -   static {
    2.38 -      VM.registerVMInitializedObserver(new Observer() {
    2.39 -         public void update(Observable o, Object data) {
    2.40 -            initialize(VM.getVM().getTypeDataBase());
    2.41 -         }
    2.42 -      });
    2.43 -   }
    2.44 -
    2.45 -   private static synchronized void initialize(TypeDataBase db) {
    2.46 -      Type type = db.lookupType("BinaryTreeDictionary");
    2.47 -      totalSizeField = type.getCIntegerField("_totalSize");
    2.48 -   }
    2.49 -
    2.50 -   // Fields
    2.51 -   private static CIntegerField totalSizeField;
    2.52 -
    2.53 -   // Accessors
    2.54 -   public long size() {
    2.55 -      return totalSizeField.getValue(addr);
    2.56 -   }
    2.57 -
    2.58 -   // Constructor
    2.59 -   public BinaryTreeDictionary(Address addr) {
    2.60 -      super(addr);
    2.61 -   }
    2.62 -}
     3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java	Wed Jan 23 10:34:29 2013 -0500
     3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java	Thu Jan 24 23:30:45 2013 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -117,9 +117,9 @@
    3.11        }
    3.12  
    3.13        // large block
    3.14 -      BinaryTreeDictionary bfbd = (BinaryTreeDictionary) VMObjectFactory.newObject(BinaryTreeDictionary.class,
    3.15 +      AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
    3.16                                                                                     dictionaryField.getValue(addr));
    3.17 -      size += bfbd.size();
    3.18 +      size += aflbd.size();
    3.19  
    3.20  
    3.21        // linear block in TLAB
     4.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java	Wed Jan 23 10:34:29 2013 -0500
     4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java	Thu Jan 24 23:30:45 2013 -0800
     4.3 @@ -1,7 +1,7 @@
     4.4  /*
     4.5   * @(#)FreeList.java
     4.6   *
     4.7 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
     4.8 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     4.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4.10   *
    4.11   * This code is free software; you can redistribute it and/or modify it
    4.12 @@ -41,7 +41,7 @@
    4.13     }
    4.14  
    4.15     private static synchronized void initialize(TypeDataBase db) {
    4.16 -      Type type = db.lookupType("FreeList");
    4.17 +      Type type = db.lookupType("FreeList<FreeChunk>");
    4.18        sizeField = type.getCIntegerField("_size");
    4.19        countField = type.getCIntegerField("_count");
    4.20        headerSize = type.getSize();
     5.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp	Wed Jan 23 10:34:29 2013 -0500
     5.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp	Thu Jan 24 23:30:45 2013 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2007, 2013, 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 @@ -34,16 +34,17 @@
    5.11    nonstatic_field(CompactibleFreeListSpace,    _bt,                                           BlockOffsetArrayNonContigSpace)        \
    5.12                                                                                                                                       \
    5.13    nonstatic_field(CMSBitMap,                   _bmWordSize,                                   size_t)                                \
    5.14 -  nonstatic_field(CMSBitMap,                   _shifter,                                      const int)                            \
    5.15 -  nonstatic_field(CMSBitMap,                      _bm,                                           BitMap)                            \
    5.16 -  nonstatic_field(CMSBitMap,                   _virtual_space,                                VirtualSpace)                         \
    5.17 +  nonstatic_field(CMSBitMap,                   _shifter,                                      const int)                             \
    5.18 +  nonstatic_field(CMSBitMap,                      _bm,                                           BitMap)                             \
    5.19 +  nonstatic_field(CMSBitMap,                   _virtual_space,                                VirtualSpace)                          \
    5.20    nonstatic_field(CMSCollector,                _markBitMap,                                   CMSBitMap)                             \
    5.21    nonstatic_field(ConcurrentMarkSweepGeneration, _cmsSpace,                                   CompactibleFreeListSpace*)             \
    5.22       static_field(ConcurrentMarkSweepThread,   _collector,                                    CMSCollector*)                         \
    5.23    nonstatic_field(LinearAllocBlock,            _word_size,                                    size_t)                                \
    5.24    nonstatic_field(AFLBinaryTreeDictionary,     _total_size,                                   size_t)                                \
    5.25    nonstatic_field(CompactibleFreeListSpace,    _indexedFreeList[0],                           FreeList<FreeChunk>)                   \
    5.26 -  nonstatic_field(CompactibleFreeListSpace,    _smallLinearAllocBlock,                        LinearAllocBlock)
    5.27 +  nonstatic_field(CompactibleFreeListSpace,    _smallLinearAllocBlock,                        LinearAllocBlock)                      \
    5.28 +  nonstatic_field(CompactibleFreeListSpace,    _dictionary,                                   FreeBlockDictionary<FreeChunk>*)
    5.29  
    5.30  
    5.31  #define VM_TYPES_CMS(declare_type,                                        \

mercurial