annotate agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java @ 6831:d8ce2825b193

8000213: NPG: Should have renamed arrayKlass and typeArrayKlass Summary: Capitalize these metadata types (and objArrayKlass) Reviewed-by: stefank, twisti, kvn
author coleenp
date Sat, 29 Sep 2012 06:40:00 -0400
parents 720b6a76dd9d
children 58fc1b1523dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
1 /*
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
4 *
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
7 * published by the Free Software Foundation.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
8 *
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
13 * accompanied this code).
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
14 *
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
18 *
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
21 * questions.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
22 *
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
23 */
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
24
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
25 package sun.jvm.hotspot.gc_implementation.g1;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
26
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
27 import java.util.Iterator;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
28 import java.util.Observable;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
29 import java.util.Observer;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
30
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
31 import sun.jvm.hotspot.debugger.Address;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
32 import sun.jvm.hotspot.runtime.VM;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
33 import sun.jvm.hotspot.runtime.VMObject;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
34 import sun.jvm.hotspot.runtime.VMObjectFactory;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
35 import sun.jvm.hotspot.types.AddressField;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
36 import sun.jvm.hotspot.types.CIntegerField;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
37 import sun.jvm.hotspot.types.Type;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
38 import sun.jvm.hotspot.types.TypeDataBase;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
39
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
40 // Mirror class for HeapRegionSetBase. Represents a group of regions.
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
41
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
42 public class HeapRegionSetBase extends VMObject {
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 4830
diff changeset
43 // uint _length;
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
44 static private CIntegerField lengthField;
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 4830
diff changeset
45 // uint _region_num;
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
46 static private CIntegerField regionNumField;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
47 // size_t _total_used_bytes;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
48 static private CIntegerField totalUsedBytesField;
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
49
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
50 static {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
51 VM.registerVMInitializedObserver(new Observer() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
52 public void update(Observable o, Object data) {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
53 initialize(VM.getVM().getTypeDataBase());
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
54 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
55 });
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
56 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
57
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
58 static private synchronized void initialize(TypeDataBase db) {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
59 Type type = db.lookupType("HeapRegionSetBase");
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
60
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
61 lengthField = type.getCIntegerField("_length");
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
62 regionNumField = type.getCIntegerField("_region_num");
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
63 totalUsedBytesField = type.getCIntegerField("_total_used_bytes");
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
64 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
65
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
66 public long length() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
67 return lengthField.getValue(addr);
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
68 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
69
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
70 public long regionNum() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
71 return regionNumField.getValue(addr);
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
72 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
73
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
74 public long totalUsedBytes() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
75 return totalUsedBytesField.getValue(addr);
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
76 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
77
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
78 public HeapRegionSetBase(Address addr) {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
79 super(addr);
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
80 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
diff changeset
81 }