Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java @ 11096:71180a6e5080
7133260: AllocationProfiler uses space in metadata and doesn't seem to do anything useful.
Summary: Remove -Xaprof and Klass::_alloc_count & ArrayKlass::_alloc_size.
Reviewed-by: stefank, coleenp
author | jiangli |
---|---|
date | Wed, 03 Jul 2013 17:26:59 -0400 |
parents | d8ce2825b193 |
children | de6a9e811145 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.oops; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.utilities.*; | |
30 import sun.jvm.hotspot.debugger.*; | |
31 import sun.jvm.hotspot.memory.*; | |
32 import sun.jvm.hotspot.runtime.*; | |
33 import sun.jvm.hotspot.types.*; | |
34 | |
35 // ArrayKlass is the abstract class for all array classes | |
36 | |
37 public class ArrayKlass extends Klass { | |
38 static { | |
39 VM.registerVMInitializedObserver(new Observer() { | |
40 public void update(Observable o, Object data) { | |
41 initialize(VM.getVM().getTypeDataBase()); | |
42 } | |
43 }); | |
44 } | |
45 | |
46 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
47 Type type = db.lookupType("ArrayKlass"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
48 dimension = new CIntField(type.getCIntegerField("_dimension"), 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
49 higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
50 lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
51 vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
52 componentMirror = new OopField(type.getOopField("_component_mirror"), 0); |
0 | 53 javaLangCloneableName = null; |
54 javaLangObjectName = null; | |
55 javaIoSerializableName = null; | |
56 } | |
57 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
58 public ArrayKlass(Address addr) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
59 super(addr); |
0 | 60 } |
61 | |
62 private static CIntField dimension; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
63 private static MetadataField higherDimension; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
64 private static MetadataField lowerDimension; |
0 | 65 private static CIntField vtableLen; |
66 private static OopField componentMirror; | |
67 | |
68 public Klass getJavaSuper() { | |
69 SystemDictionary sysDict = VM.getVM().getSystemDictionary(); | |
70 return sysDict.getObjectKlass(); | |
71 } | |
72 | |
73 public long getDimension() { return dimension.getValue(this); } | |
74 public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); } | |
75 public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); } | |
76 public long getVtableLen() { return vtableLen.getValue(this); } | |
77 public Oop getComponentMirror() { return componentMirror.getValue(this); } | |
78 | |
79 // constant class names - javaLangCloneable, javaIoSerializable, javaLangObject | |
80 // Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and SymbolTable | |
81 private static Symbol javaLangCloneableName; | |
82 private static Symbol javaLangObjectName; | |
83 private static Symbol javaIoSerializableName; | |
84 private static Symbol javaLangCloneableName() { | |
85 if (javaLangCloneableName == null) { | |
86 javaLangCloneableName = VM.getVM().getSymbolTable().probe("java/lang/Cloneable"); | |
87 } | |
88 return javaLangCloneableName; | |
89 } | |
90 | |
91 private static Symbol javaLangObjectName() { | |
92 if (javaLangObjectName == null) { | |
93 javaLangObjectName = VM.getVM().getSymbolTable().probe("java/lang/Object"); | |
94 } | |
95 return javaLangObjectName; | |
96 } | |
97 | |
98 private static Symbol javaIoSerializableName() { | |
99 if (javaIoSerializableName == null) { | |
100 javaIoSerializableName = VM.getVM().getSymbolTable().probe("java/io/Serializable"); | |
101 } | |
102 return javaIoSerializableName; | |
103 } | |
104 | |
105 public int getClassStatus() { | |
106 return JVMDIClassStatus.VERIFIED | JVMDIClassStatus.PREPARED | JVMDIClassStatus.INITIALIZED; | |
107 } | |
108 | |
109 public long computeModifierFlags() { | |
110 return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; | |
111 } | |
112 | |
113 public long getArrayHeaderInBytes() { | |
114 return Bits.maskBits(getLayoutHelper() >> LH_HEADER_SIZE_SHIFT, 0xFF); | |
115 } | |
116 | |
117 public int getLog2ElementSize() { | |
118 return Bits.maskBits(getLayoutHelper() >> LH_LOG2_ELEMENT_SIZE_SHIFT, 0xFF); | |
119 } | |
120 | |
121 public int getElementType() { | |
122 return Bits.maskBits(getLayoutHelper() >> LH_ELEMENT_TYPE_SHIFT, 0xFF); | |
123 } | |
124 | |
125 boolean computeSubtypeOf(Klass k) { | |
126 // An array is a subtype of Serializable, Clonable, and Object | |
127 Symbol name = k.getName(); | |
128 if (name != null && (name.equals(javaIoSerializableName()) || | |
129 name.equals(javaLangCloneableName()) || | |
130 name.equals(javaLangObjectName()))) { | |
131 return true; | |
132 } else { | |
133 return false; | |
134 } | |
135 } | |
136 | |
137 public void printValueOn(PrintStream tty) { | |
138 tty.print("ArrayKlass"); | |
139 } | |
140 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
141 public void iterateFields(MetadataVisitor visitor) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
142 super.iterateFields(visitor); |
0 | 143 visitor.doCInt(dimension, true); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
144 visitor.doMetadata(higherDimension, true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1552
diff
changeset
|
145 visitor.doMetadata(lowerDimension, true); |
0 | 146 visitor.doCInt(vtableLen, true); |
147 visitor.doOop(componentMirror, true); | |
148 } | |
149 } |