annotate agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java @ 14518:d8041d695d19

Merged with jdk9/dev/hotspot changeset 3812c088b945
author twisti
date Tue, 11 Mar 2014 18:45:59 -0700
parents agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java@6cf2530f7fd3 agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java@f6490a5f084a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
1 /*
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
2 * @(#)AdaptiveFreeList.java
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
3 *
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
4 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
6 *
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
7 * This code is free software; you can redistribute it and/or modify it
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
8 * under the terms of the GNU General Public License version 2 only, as
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
9 * published by the Free Software Foundation.
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
10 *
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
15 * accompanied this code).
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
16 *
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
20 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
23 * questions.
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
24 *
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
25 */
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
26
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
27 package sun.jvm.hotspot.memory;
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
28
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
29 import java.util.Observable;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
30 import java.util.Observer;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
31
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
32 import sun.jvm.hotspot.debugger.Address;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
33 import sun.jvm.hotspot.runtime.VM;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
34 import sun.jvm.hotspot.runtime.VMObject;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
35 import sun.jvm.hotspot.types.CIntegerField;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
36 import sun.jvm.hotspot.types.Type;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
37 import sun.jvm.hotspot.types.TypeDataBase;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
38
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
39 public class AdaptiveFreeList extends VMObject {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
40 static {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
41 VM.registerVMInitializedObserver(new Observer() {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
42 public void update(Observable o, Object data) {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
43 initialize(VM.getVM().getTypeDataBase());
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
44 }
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
45 });
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
46 }
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
47
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
48 private static synchronized void initialize(TypeDataBase db) {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
49 Type type = db.lookupType("AdaptiveFreeList<FreeChunk>");
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
50 sizeField = type.getCIntegerField("_size");
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
51 countField = type.getCIntegerField("_count");
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
52 headerSize = type.getSize();
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
53 }
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
54
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
55 // Fields
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
56 private static CIntegerField sizeField;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
57 private static CIntegerField countField;
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
58 private static long headerSize;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
59
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
60 //Constructor
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
61 public AdaptiveFreeList(Address address) {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
62 super(address);
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
63 }
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
64
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
65 // Accessors
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
66 public long size() {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
67 return sizeField.getValue(addr);
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
68 }
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
69
14470
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
70 public long count() {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
71 return countField.getValue(addr);
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
72 }
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
73
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
74 public static long sizeOf() {
f6490a5f084a 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 7950
diff changeset
75 return headerSize;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
76 }
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
diff changeset
77 }