annotate agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 2090c623107e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.interpreter;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import sun.jvm.hotspot.oops.*;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
28 import sun.jvm.hotspot.runtime.*;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.utilities.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
31 public class BytecodeLoadConstant extends Bytecode {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 BytecodeLoadConstant(Method method, int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
33 super(method, bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
34 }
a61af66fc99e Initial load
duke
parents:
diff changeset
35
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
36 public boolean hasCacheIndex() {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
37 // normal ldc uses CP index, but fast_aldc uses swapped CP cache index
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
38 return code() >= Bytecodes.number_of_java_codes;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
39 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
40
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
41 int rawIndex() {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
42 if (javaCode() == Bytecodes._ldc)
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
43 return getIndexU1();
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
44 else
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
45 return getIndexU2(code(), false);
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
46 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
47
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
48 public int poolIndex() {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
49 int index = rawIndex();
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
50 if (hasCacheIndex()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
51 return method().getConstants().objectToCPIndex(index);
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
52 } else {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
53 return index;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
54 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
55 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
56
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
57 public int cacheIndex() {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
58 if (hasCacheIndex()) {
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
59 return rawIndex();
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
60 } else {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
61 return -1; // no cache index
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
62 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
63 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
64
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
65 public BasicType resultType() {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
66 int index = poolIndex();
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
67 ConstantTag tag = method().getConstants().getTagAt(index);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
68 return tag.basicType();
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
69 }
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
70
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
71 private Oop getCachedConstant() {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
72 int i = cacheIndex();
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
73 if (i >= 0) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
74 throw new InternalError("invokedynamic not implemented yet");
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
75 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
76 return null;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 }
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 public void verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 Assert.that(isValid(), "check load constant");
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 public boolean isValid() {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 int jcode = javaCode();
a61af66fc99e Initial load
duke
parents:
diff changeset
87 boolean codeOk = jcode == Bytecodes._ldc || jcode == Bytecodes._ldc_w ||
a61af66fc99e Initial load
duke
parents:
diff changeset
88 jcode == Bytecodes._ldc2_w;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 if (! codeOk) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
90
3904
2090c623107e 7016881: JSR 292: JDI: sun.jvm.hotspot.utilities.AssertionFailure: index out of bounds
never
parents: 3838
diff changeset
91 ConstantTag ctag = method().getConstants().getTagAt(poolIndex());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (jcode == Bytecodes._ldc2_w) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // has to be double or long
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return (ctag.isDouble() || ctag.isLong()) ? true: false;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // has to be int or float or String or Klass
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
97 return (ctag.isString()
0
a61af66fc99e Initial load
duke
parents:
diff changeset
98 || ctag.isUnresolvedKlass() || ctag.isKlass()
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
99 || ctag.isMethodHandle() || ctag.isMethodType()
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100 || ctag.isInt() || ctag.isFloat())? true: false;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 public boolean isKlassConstant() {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 int jcode = javaCode();
a61af66fc99e Initial load
duke
parents:
diff changeset
106 if (jcode == Bytecodes._ldc2_w) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
110 ConstantTag ctag = method().getConstants().getTagAt(poolIndex());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 return ctag.isKlass() || ctag.isUnresolvedKlass();
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // return Symbol (if unresolved) or Klass (if resolved)
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
115 public Object getKlass() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
116 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 Assert.that(isKlassConstant(), "not a klass literal");
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // tag change from 'unresolved' to 'klass' does not happen atomically.
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // We just look at the object at the corresponding index and
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // decide based on the oop type.
a61af66fc99e Initial load
duke
parents:
diff changeset
122 ConstantPool cpool = method().getConstants();
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 2426
diff changeset
123 int cpIndex = poolIndex();
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
124 ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
125 if (oop.isResolved()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
126 return oop.getKlass();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
127 } else if (oop.isUnresolved()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
128 return oop.getSymbol();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
129 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 throw new RuntimeException("should not reach here");
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 public static BytecodeLoadConstant at(Method method, int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 BytecodeLoadConstant b = new BytecodeLoadConstant(method, bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
136 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
137 b.verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
138 }
a61af66fc99e Initial load
duke
parents:
diff changeset
139 return b;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 /** Like at, but returns null if the BCI is not at ldc or ldc_w or ldc2_w */
a61af66fc99e Initial load
duke
parents:
diff changeset
143 public static BytecodeLoadConstant atCheck(Method method, int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 BytecodeLoadConstant b = new BytecodeLoadConstant(method, bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
145 return (b.isValid() ? b : null);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 public static BytecodeLoadConstant at(BytecodeStream bcs) {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 return new BytecodeLoadConstant(bcs.method(), bcs.bci());
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 public String getConstantValue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 ConstantPool cpool = method().getConstants();
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
154 int cpIndex = poolIndex();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
155 ConstantTag ctag = cpool.getTagAt(cpIndex);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 if (ctag.isInt()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
157 return "<int " + Integer.toString(cpool.getIntAt(cpIndex)) +">";
a61af66fc99e Initial load
duke
parents:
diff changeset
158 } else if (ctag.isLong()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return "<long " + Long.toString(cpool.getLongAt(cpIndex)) + "L>";
a61af66fc99e Initial load
duke
parents:
diff changeset
160 } else if (ctag.isFloat()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 return "<float " + Float.toString(cpool.getFloatAt(cpIndex)) + "F>";
a61af66fc99e Initial load
duke
parents:
diff changeset
162 } else if (ctag.isDouble()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 return "<double " + Double.toString(cpool.getDoubleAt(cpIndex)) + "D>";
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
164 } else if (ctag.isString()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // tag change from 'unresolved' to 'string' does not happen atomically.
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // We just look at the object at the corresponding index and
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // decide based on the oop type.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
168 Symbol sym = cpool.getUnresolvedStringAt(cpIndex);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
169 return "<String \"" + sym.asString() + "\">";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
170 } else if (ctag.isKlass() || ctag.isUnresolvedKlass()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // tag change from 'unresolved' to 'klass' does not happen atomically.
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // We just look at the object at the corresponding index and
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // decide based on the oop type.
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
174 ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
175 if (obj.isResolved()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
176 Klass k = obj.getKlass();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
177 return "<Class " + k.getName().asString() + "@" + k.getAddress() + ">";
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3904
diff changeset
178 } else if (obj.isUnresolved()) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
179 Symbol sym = obj.getSymbol();
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1913
diff changeset
180 return "<Class " + sym.asString() + ">";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
181 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 throw new RuntimeException("should not reach here");
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
184 } else if (ctag.isMethodHandle()) {
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
185 Oop x = getCachedConstant();
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
186 int refidx = cpool.getMethodHandleIndexAt(cpIndex);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
187 int refkind = cpool.getMethodHandleRefKindAt(cpIndex);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
188 return "<MethodHandle kind=" + Integer.toString(refkind) +
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
189 " ref=" + Integer.toString(refidx)
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
190 + (x == null ? "" : " @" + x.getHandle()) + ">";
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
191 } else if (ctag.isMethodType()) {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
192 Oop x = getCachedConstant();
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
193 int refidx = cpool.getMethodTypeIndexAt(cpIndex);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
194 return "<MethodType " + cpool.getSymbolAt(refidx).asString()
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
195 + (x == null ? "" : " @" + x.getHandle()) + ">";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
196 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 Assert.that(false, "invalid load constant type");
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }
a61af66fc99e Initial load
duke
parents:
diff changeset
200 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
201 }
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 public String toString() {
a61af66fc99e Initial load
duke
parents:
diff changeset
205 StringBuffer buf = new StringBuffer();
a61af66fc99e Initial load
duke
parents:
diff changeset
206 buf.append(getJavaBytecodeName());
a61af66fc99e Initial load
duke
parents:
diff changeset
207 buf.append(spaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
208 buf.append('#');
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
209 buf.append(Integer.toString(poolIndex()));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
210 if (hasCacheIndex()) {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
211 buf.append('(');
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
212 buf.append(Integer.toString(cacheIndex()));
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
213 buf.append(')');
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
214 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
215 buf.append(spaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
216 buf.append(getConstantValue());
a61af66fc99e Initial load
duke
parents:
diff changeset
217 if (code() != javaCode()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
218 buf.append(spaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 buf.append('[');
a61af66fc99e Initial load
duke
parents:
diff changeset
220 buf.append(getBytecodeName());
a61af66fc99e Initial load
duke
parents:
diff changeset
221 buf.append(']');
a61af66fc99e Initial load
duke
parents:
diff changeset
222 }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 return buf.toString();
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }