Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
44 else | 44 else |
45 return getIndexU2(code(), false); | 45 return getIndexU2(code(), false); |
46 } | 46 } |
47 | 47 |
48 public int poolIndex() { | 48 public int poolIndex() { |
49 int i = rawIndex(); | 49 int index = rawIndex(); |
50 if (hasCacheIndex()) { | 50 if (hasCacheIndex()) { |
51 ConstantPoolCache cpCache = method().getConstants().getCache(); | 51 return method().getConstants().objectToCPIndex(index); |
52 return cpCache.getEntryAt(i).getConstantPoolIndex(); | 52 } else { |
53 } else { | 53 return index; |
54 return i; | |
55 } | 54 } |
56 } | 55 } |
57 | 56 |
58 public int cacheIndex() { | 57 public int cacheIndex() { |
59 if (hasCacheIndex()) { | 58 if (hasCacheIndex()) { |
70 } | 69 } |
71 | 70 |
72 private Oop getCachedConstant() { | 71 private Oop getCachedConstant() { |
73 int i = cacheIndex(); | 72 int i = cacheIndex(); |
74 if (i >= 0) { | 73 if (i >= 0) { |
75 ConstantPoolCache cpCache = method().getConstants().getCache(); | 74 throw new InternalError("invokedynamic not implemented yet"); |
76 return cpCache.getEntryAt(i).getF1(); | |
77 } | 75 } |
78 return null; | 76 return null; |
79 } | 77 } |
80 | 78 |
81 public void verify() { | 79 public void verify() { |
94 if (jcode == Bytecodes._ldc2_w) { | 92 if (jcode == Bytecodes._ldc2_w) { |
95 // has to be double or long | 93 // has to be double or long |
96 return (ctag.isDouble() || ctag.isLong()) ? true: false; | 94 return (ctag.isDouble() || ctag.isLong()) ? true: false; |
97 } else { | 95 } else { |
98 // has to be int or float or String or Klass | 96 // has to be int or float or String or Klass |
99 return (ctag.isUnresolvedString() || ctag.isString() | 97 return (ctag.isString() |
100 || ctag.isUnresolvedKlass() || ctag.isKlass() | 98 || ctag.isUnresolvedKlass() || ctag.isKlass() |
101 || ctag.isMethodHandle() || ctag.isMethodType() | 99 || ctag.isMethodHandle() || ctag.isMethodType() |
102 || ctag.isInt() || ctag.isFloat())? true: false; | 100 || ctag.isInt() || ctag.isFloat())? true: false; |
103 } | 101 } |
104 } | 102 } |
122 // We just look at the object at the corresponding index and | 120 // We just look at the object at the corresponding index and |
123 // decide based on the oop type. | 121 // decide based on the oop type. |
124 ConstantPool cpool = method().getConstants(); | 122 ConstantPool cpool = method().getConstants(); |
125 int cpIndex = poolIndex(); | 123 int cpIndex = poolIndex(); |
126 ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex); | 124 ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex); |
127 if (oop.isOop()) { | 125 if (oop.isResolved()) { |
128 return (Klass) oop.getOop(); | 126 return oop.getKlass(); |
129 } else if (oop.isMetaData()) { | 127 } else if (oop.isUnresolved()) { |
130 return oop.getSymbol(); | 128 return oop.getSymbol(); |
131 } else { | 129 } else { |
132 throw new RuntimeException("should not reach here"); | 130 throw new RuntimeException("should not reach here"); |
133 } | 131 } |
134 } | 132 } |
161 return "<long " + Long.toString(cpool.getLongAt(cpIndex)) + "L>"; | 159 return "<long " + Long.toString(cpool.getLongAt(cpIndex)) + "L>"; |
162 } else if (ctag.isFloat()) { | 160 } else if (ctag.isFloat()) { |
163 return "<float " + Float.toString(cpool.getFloatAt(cpIndex)) + "F>"; | 161 return "<float " + Float.toString(cpool.getFloatAt(cpIndex)) + "F>"; |
164 } else if (ctag.isDouble()) { | 162 } else if (ctag.isDouble()) { |
165 return "<double " + Double.toString(cpool.getDoubleAt(cpIndex)) + "D>"; | 163 return "<double " + Double.toString(cpool.getDoubleAt(cpIndex)) + "D>"; |
166 } else if (ctag.isString() || ctag.isUnresolvedString()) { | 164 } else if (ctag.isString()) { |
167 // tag change from 'unresolved' to 'string' does not happen atomically. | 165 // tag change from 'unresolved' to 'string' does not happen atomically. |
168 // We just look at the object at the corresponding index and | 166 // We just look at the object at the corresponding index and |
169 // decide based on the oop type. | 167 // decide based on the oop type. |
170 ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex); | 168 Symbol sym = cpool.getUnresolvedStringAt(cpIndex); |
171 if (obj.isMetaData()) { | |
172 Symbol sym = obj.getSymbol(); | |
173 return "<String \"" + sym.asString() + "\">"; | 169 return "<String \"" + sym.asString() + "\">"; |
174 } else if (obj.isOop()) { | |
175 return "<String \"" + OopUtilities.stringOopToString(obj.getOop()) + "\">"; | |
176 } else { | |
177 throw new RuntimeException("should not reach here"); | |
178 } | |
179 } else if (ctag.isKlass() || ctag.isUnresolvedKlass()) { | 170 } else if (ctag.isKlass() || ctag.isUnresolvedKlass()) { |
180 // tag change from 'unresolved' to 'klass' does not happen atomically. | 171 // tag change from 'unresolved' to 'klass' does not happen atomically. |
181 // We just look at the object at the corresponding index and | 172 // We just look at the object at the corresponding index and |
182 // decide based on the oop type. | 173 // decide based on the oop type. |
183 ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex); | 174 ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex); |
184 if (obj.isOop()) { | 175 if (obj.isResolved()) { |
185 Klass k = (Klass) obj.getOop(); | 176 Klass k = obj.getKlass(); |
186 return "<Class " + k.getName().asString() + "@" + k.getHandle() + ">"; | 177 return "<Class " + k.getName().asString() + "@" + k.getAddress() + ">"; |
187 } else if (obj.isMetaData()) { | 178 } else if (obj.isUnresolved()) { |
188 Symbol sym = obj.getSymbol(); | 179 Symbol sym = obj.getSymbol(); |
189 return "<Class " + sym.asString() + ">"; | 180 return "<Class " + sym.asString() + ">"; |
190 } else { | 181 } else { |
191 throw new RuntimeException("should not reach here"); | 182 throw new RuntimeException("should not reach here"); |
192 } | 183 } |