Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCacheEntry.java @ 18665:96861e3f8cc5
made CFGPrinterObserver reset (upon close) properly
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 11 Dec 2014 22:14:30 +0100 |
parents | da91efe96a93 |
children |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
2 * Copyright (c) 2001, 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.util.*; | |
28 import sun.jvm.hotspot.debugger.*; | |
29 import sun.jvm.hotspot.runtime.*; | |
30 import sun.jvm.hotspot.types.*; | |
1602 | 31 import sun.jvm.hotspot.utilities.*; |
0 | 32 |
33 public class ConstantPoolCacheEntry { | |
34 private static long size; | |
35 private static long baseOffset; | |
36 private static CIntegerField indices; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
37 private static AddressField f1; |
0 | 38 private static CIntegerField f2; |
39 private static CIntegerField flags; | |
40 | |
41 private ConstantPoolCache cp; | |
42 private long offset; | |
43 | |
44 static { | |
45 VM.registerVMInitializedObserver(new Observer() { | |
46 public void update(Observable o, Object data) { | |
47 initialize(VM.getVM().getTypeDataBase()); | |
48 } | |
49 }); | |
50 } | |
51 | |
52 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | |
53 Type type = db.lookupType("ConstantPoolCacheEntry"); | |
54 size = type.getSize(); | |
55 | |
56 indices = type.getCIntegerField("_indices"); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
57 f1 = type.getAddressField ("_f1"); |
0 | 58 f2 = type.getCIntegerField("_f2"); |
59 flags = type.getCIntegerField("_flags"); | |
60 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
61 type = db.lookupType("ConstantPoolCache"); |
0 | 62 baseOffset = type.getSize(); |
63 } | |
64 | |
65 ConstantPoolCacheEntry(ConstantPoolCache cp, int index) { | |
66 this.cp = cp; | |
67 offset = baseOffset + index * size; | |
68 } | |
69 | |
70 public int getConstantPoolIndex() { | |
1602 | 71 if (Assert.ASSERTS_ENABLED) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
72 Assert.that((getIndices() & 0xFFFF) != 0, "must be main entry"); |
1602 | 73 } |
0 | 74 return (int) (getIndices() & 0xFFFF); |
75 } | |
76 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
77 private long getIndices() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
78 return cp.getAddress().getCIntegerAt(indices.getOffset() + offset, indices.getSize(), indices.isUnsigned()); |
1602 | 79 } |
80 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
81 public Metadata getF1() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
82 return Metadata.instantiateWrapperFor(cp.getAddress().getAddressAt(f1.getOffset() + offset)); |
0 | 83 } |
84 | |
85 public int getF2() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
86 return cp.getAddress().getJIntAt(f1.getOffset() + offset); |
0 | 87 } |
88 | |
89 public int getFlags() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
90 return cp.getAddress().getJIntAt(flags.getOffset() + offset); |
0 | 91 } |
92 | |
93 static NamedFieldIdentifier f1FieldName = new NamedFieldIdentifier("_f1"); | |
94 static NamedFieldIdentifier f2FieldName = new NamedFieldIdentifier("_f2"); | |
95 static NamedFieldIdentifier flagsFieldName = new NamedFieldIdentifier("_flags"); | |
96 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2042
diff
changeset
|
97 public void iterateFields(MetadataVisitor visitor) { |
0 | 98 visitor.doOop(new OopField(f1FieldName, f1.getOffset() + offset, true), true); |
99 visitor.doInt(new IntField(f2FieldName, f2.getOffset() + offset, true), true); | |
100 visitor.doInt(new IntField(flagsFieldName, flags.getOffset() + offset, true), true); | |
101 } | |
102 } |