Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @ 210:05712c37c828
6676016: ParallelOldGC leaks memory
Summary: ensure that GCTask threads release resource and handle memory
Reviewed-by: jmasa, chrisphi
author | jcoomes |
---|---|
date | Wed, 18 Jun 2008 18:36:47 -0700 |
parents | ba764ed4b6f2 |
children | d1605aabd0a1 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. | |
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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 package sun.jvm.hotspot.oops; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
30 import sun.jvm.hotspot.runtime.*; | |
31 import sun.jvm.hotspot.types.*; | |
32 import sun.jvm.hotspot.utilities.*; | |
33 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
34 // A ConstantPool is an oop containing class constants |
0 | 35 // as described in the class file |
36 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
37 public class ConstantPool extends Oop implements ClassConstants { |
0 | 38 // Used for debugging this code |
39 private static final boolean DEBUG = false; | |
40 | |
41 protected void debugMessage(String message) { | |
42 System.out.println(message); | |
43 } | |
44 | |
45 static { | |
46 VM.registerVMInitializedObserver(new Observer() { | |
47 public void update(Observable o, Object data) { | |
48 initialize(VM.getVM().getTypeDataBase()); | |
49 } | |
50 }); | |
51 } | |
52 | |
53 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | |
54 Type type = db.lookupType("constantPoolOopDesc"); | |
55 tags = new OopField(type.getOopField("_tags"), 0); | |
56 cache = new OopField(type.getOopField("_cache"), 0); | |
57 poolHolder = new OopField(type.getOopField("_pool_holder"), 0); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
58 length = new CIntField(type.getCIntegerField("_length"), 0); |
0 | 59 headerSize = type.getSize(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
60 elementSize = 0; |
0 | 61 } |
62 | |
63 ConstantPool(OopHandle handle, ObjectHeap heap) { | |
64 super(handle, heap); | |
65 } | |
66 | |
67 public boolean isConstantPool() { return true; } | |
68 | |
69 private static OopField tags; | |
70 private static OopField cache; | |
71 private static OopField poolHolder; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
72 private static CIntField length; // number of elements in oop |
0 | 73 |
74 private static long headerSize; | |
75 private static long elementSize; | |
76 | |
77 public TypeArray getTags() { return (TypeArray) tags.getValue(this); } | |
78 public ConstantPoolCache getCache() { return (ConstantPoolCache) cache.getValue(this); } | |
79 public Klass getPoolHolder() { return (Klass) poolHolder.getValue(this); } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
80 public int getLength() { return (int)length.getValue(this); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
81 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 private long getElementSize() { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
83 if (elementSize !=0 ) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 return elementSize; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
86 elementSize = VM.getVM().getOopSize(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
87 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
88 return elementSize; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
89 } |
0 | 90 |
91 private long indexOffset(long index) { | |
92 if (Assert.ASSERTS_ENABLED) { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
93 Assert.that(index > 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); |
0 | 94 } |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
95 return (index * getElementSize()) + headerSize; |
0 | 96 } |
97 | |
98 public ConstantTag getTagAt(long index) { | |
99 return new ConstantTag(getTags().getByteAt((int) index)); | |
100 } | |
101 | |
102 public Oop getObjAt(long index){ | |
103 return getHeap().newOop(getHandle().getOopHandleAt(indexOffset(index))); | |
104 } | |
105 | |
106 public Symbol getSymbolAt(long index) { | |
107 return (Symbol) getObjAt(index); | |
108 } | |
109 | |
110 public int getIntAt(long index){ | |
111 return getHandle().getJIntAt(indexOffset(index)); | |
112 } | |
113 | |
114 public float getFloatAt(long index){ | |
115 return getHandle().getJFloatAt(indexOffset(index)); | |
116 } | |
117 | |
118 public long getLongAt(long index) { | |
119 int oneHalf = getHandle().getJIntAt(indexOffset(index + 1)); | |
120 int otherHalf = getHandle().getJIntAt(indexOffset(index)); | |
121 // buildLongFromIntsPD accepts higher address value, lower address value | |
122 // in that order. | |
123 return VM.getVM().buildLongFromIntsPD(oneHalf, otherHalf); | |
124 } | |
125 | |
126 public double getDoubleAt(long index) { | |
127 return Double.longBitsToDouble(getLongAt(index)); | |
128 } | |
129 | |
130 public int getFieldOrMethodAt(int which) { | |
131 if (DEBUG) { | |
132 System.err.print("ConstantPool.getFieldOrMethodAt(" + which + "): new index = "); | |
133 } | |
134 int i = -1; | |
135 ConstantPoolCache cache = getCache(); | |
136 if (cache == null) { | |
137 i = which; | |
138 } else { | |
139 // change byte-ordering and go via cache | |
140 i = cache.getEntryAt(0xFFFF & VM.getVM().getBytes().swapShort((short) which)).getConstantPoolIndex(); | |
141 } | |
142 if (Assert.ASSERTS_ENABLED) { | |
143 Assert.that(getTagAt(i).isFieldOrMethod(), "Corrupted constant pool"); | |
144 } | |
145 if (DEBUG) { | |
146 System.err.println(i); | |
147 } | |
148 int res = getIntAt(i); | |
149 if (DEBUG) { | |
150 System.err.println("ConstantPool.getFieldOrMethodAt(" + i + "): result = " + res); | |
151 } | |
152 return res; | |
153 } | |
154 | |
155 public int getNameAndTypeAt(int which) { | |
156 if (Assert.ASSERTS_ENABLED) { | |
157 Assert.that(getTagAt(which).isNameAndType(), "Corrupted constant pool"); | |
158 } | |
159 int i = getIntAt(which); | |
160 if (DEBUG) { | |
161 System.err.println("ConstantPool.getNameAndTypeAt(" + which + "): result = " + i); | |
162 } | |
163 return i; | |
164 } | |
165 | |
166 public Symbol getNameRefAt(int which) { | |
167 int refIndex = getNameAndTypeAt(getNameAndTypeRefIndexAt(which)); | |
168 int nameIndex = extractLowShortFromInt(refIndex); | |
169 return getSymbolAt(nameIndex); | |
170 } | |
171 | |
172 public Symbol getSignatureRefAt(int which) { | |
173 int refIndex = getNameAndTypeAt(getNameAndTypeRefIndexAt(which)); | |
174 int sigIndex = extractHighShortFromInt(refIndex); | |
175 return getSymbolAt(sigIndex); | |
176 } | |
177 | |
178 // returns null, if not resolved. | |
179 public Klass getKlassRefAt(int which) { | |
180 if( ! getTagAt(which).isKlass()) return null; | |
181 return (Klass) getObjAt(which); | |
182 } | |
183 | |
184 // returns null, if not resolved. | |
185 public InstanceKlass getFieldOrMethodKlassRefAt(int which) { | |
186 int refIndex = getFieldOrMethodAt(which); | |
187 int klassIndex = extractLowShortFromInt(refIndex); | |
188 return (InstanceKlass) getKlassRefAt(klassIndex); | |
189 } | |
190 | |
191 // returns null, if not resolved. | |
192 public Method getMethodRefAt(int which) { | |
193 InstanceKlass klass = getFieldOrMethodKlassRefAt(which); | |
194 if (klass == null) return null; | |
195 Symbol name = getNameRefAt(which); | |
196 Symbol sig = getSignatureRefAt(which); | |
197 return klass.findMethod(name, sig); | |
198 } | |
199 | |
200 // returns null, if not resolved. | |
201 public Field getFieldRefAt(int which) { | |
202 InstanceKlass klass = getFieldOrMethodKlassRefAt(which); | |
203 if (klass == null) return null; | |
204 Symbol name = getNameRefAt(which); | |
205 Symbol sig = getSignatureRefAt(which); | |
206 return klass.findField(name, sig); | |
207 } | |
208 | |
209 public int getNameAndTypeRefIndexAt(int index) { | |
210 int refIndex = getFieldOrMethodAt(index); | |
211 if (DEBUG) { | |
212 System.err.println("ConstantPool.getNameAndTypeRefIndexAt(" + index + "): refIndex = " + refIndex); | |
213 } | |
214 int i = extractHighShortFromInt(refIndex); | |
215 if (DEBUG) { | |
216 System.err.println("ConstantPool.getNameAndTypeRefIndexAt(" + index + "): result = " + i); | |
217 } | |
218 return i; | |
219 } | |
220 | |
221 /** Lookup for entries consisting of (name_index, signature_index) */ | |
222 public int getNameRefIndexAt(int index) { | |
223 int refIndex = getNameAndTypeAt(index); | |
224 if (DEBUG) { | |
225 System.err.println("ConstantPool.getNameRefIndexAt(" + index + "): refIndex = " + refIndex); | |
226 } | |
227 int i = extractLowShortFromInt(refIndex); | |
228 if (DEBUG) { | |
229 System.err.println("ConstantPool.getNameRefIndexAt(" + index + "): result = " + i); | |
230 } | |
231 return i; | |
232 } | |
233 | |
234 /** Lookup for entries consisting of (name_index, signature_index) */ | |
235 public int getSignatureRefIndexAt(int index) { | |
236 int refIndex = getNameAndTypeAt(index); | |
237 if (DEBUG) { | |
238 System.err.println("ConstantPool.getSignatureRefIndexAt(" + index + "): refIndex = " + refIndex); | |
239 } | |
240 int i = extractHighShortFromInt(refIndex); | |
241 if (DEBUG) { | |
242 System.err.println("ConstantPool.getSignatureRefIndexAt(" + index + "): result = " + i); | |
243 } | |
244 return i; | |
245 } | |
246 | |
247 final private static String[] nameForTag = new String[] { | |
248 }; | |
249 | |
250 private String nameForTag(int tag) { | |
251 switch (tag) { | |
252 case JVM_CONSTANT_Utf8: return "JVM_CONSTANT_Utf8"; | |
253 case JVM_CONSTANT_Unicode: return "JVM_CONSTANT_Unicode"; | |
254 case JVM_CONSTANT_Integer: return "JVM_CONSTANT_Integer"; | |
255 case JVM_CONSTANT_Float: return "JVM_CONSTANT_Float"; | |
256 case JVM_CONSTANT_Long: return "JVM_CONSTANT_Long"; | |
257 case JVM_CONSTANT_Double: return "JVM_CONSTANT_Double"; | |
258 case JVM_CONSTANT_Class: return "JVM_CONSTANT_Class"; | |
259 case JVM_CONSTANT_String: return "JVM_CONSTANT_String"; | |
260 case JVM_CONSTANT_Fieldref: return "JVM_CONSTANT_Fieldref"; | |
261 case JVM_CONSTANT_Methodref: return "JVM_CONSTANT_Methodref"; | |
262 case JVM_CONSTANT_InterfaceMethodref: return "JVM_CONSTANT_InterfaceMethodref"; | |
263 case JVM_CONSTANT_NameAndType: return "JVM_CONSTANT_NameAndType"; | |
264 case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid"; | |
265 case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass"; | |
266 case JVM_CONSTANT_ClassIndex: return "JVM_CONSTANT_ClassIndex"; | |
267 case JVM_CONSTANT_UnresolvedString: return "JVM_CONSTANT_UnresolvedString"; | |
268 case JVM_CONSTANT_StringIndex: return "JVM_CONSTANT_StringIndex"; | |
269 } | |
270 throw new InternalError("unknown tag"); | |
271 } | |
272 | |
273 public void iterateFields(OopVisitor visitor, boolean doVMFields) { | |
274 super.iterateFields(visitor, doVMFields); | |
275 if (doVMFields) { | |
276 visitor.doOop(tags, true); | |
277 visitor.doOop(cache, true); | |
278 visitor.doOop(poolHolder, true); | |
279 | |
280 final int length = (int) getLength(); | |
281 // zero'th pool entry is always invalid. ignore it. | |
282 for (int index = 1; index < length; index++) { | |
283 int ctag = (int) getTags().getByteAt((int) index); | |
284 switch (ctag) { | |
285 case JVM_CONSTANT_ClassIndex: | |
286 case JVM_CONSTANT_StringIndex: | |
287 case JVM_CONSTANT_Integer: | |
288 visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
289 break; | |
290 | |
291 case JVM_CONSTANT_Float: | |
292 visitor.doFloat(new FloatField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
293 break; | |
294 | |
295 case JVM_CONSTANT_Long: | |
296 visitor.doLong(new LongField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
297 // long entries occupy two slots | |
298 index++; | |
299 break; | |
300 | |
301 case JVM_CONSTANT_Double: | |
302 visitor.doDouble(new DoubleField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
303 // double entries occupy two slots | |
304 index++; | |
305 break; | |
306 | |
307 case JVM_CONSTANT_UnresolvedClass: | |
308 case JVM_CONSTANT_Class: | |
309 case JVM_CONSTANT_UnresolvedString: | |
310 case JVM_CONSTANT_Utf8: | |
311 visitor.doOop(new OopField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
312 break; | |
313 | |
314 case JVM_CONSTANT_Fieldref: | |
315 case JVM_CONSTANT_Methodref: | |
316 case JVM_CONSTANT_InterfaceMethodref: | |
317 case JVM_CONSTANT_NameAndType: | |
318 visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); | |
319 break; | |
320 } | |
321 } | |
322 } | |
323 /* | |
324 int length = getLength(); | |
325 for (int index = 0; index < length; index++) { | |
326 long offset = baseOffset + (index + typeDataBase.getOopSize()); | |
327 visitor.doOop(new IndexableField(index, offset, false), getObjAt(index)); | |
328 } | |
329 */ | |
330 } | |
331 | |
332 public void writeBytes(OutputStream os) throws IOException { | |
333 // Map between any modified UTF-8 and it's constant pool index. | |
334 Map utf8ToIndex = new HashMap(); | |
335 DataOutputStream dos = new DataOutputStream(os); | |
336 TypeArray tags = getTags(); | |
337 int len = (int)getLength(); | |
338 int ci = 0; // constant pool index | |
339 | |
340 // collect all modified UTF-8 Strings from Constant Pool | |
341 | |
342 for (ci = 1; ci < len; ci++) { | |
343 byte cpConstType = tags.getByteAt(ci); | |
344 if(cpConstType == JVM_CONSTANT_Utf8) { | |
345 Symbol sym = getSymbolAt(ci); | |
346 utf8ToIndex.put(sym.asString(), new Short((short) ci)); | |
347 } | |
348 else if(cpConstType == JVM_CONSTANT_Long || | |
349 cpConstType == JVM_CONSTANT_Double) { | |
350 ci++; | |
351 } | |
352 } | |
353 | |
354 | |
355 for(ci = 1; ci < len; ci++) { | |
356 int cpConstType = (int)tags.getByteAt(ci); | |
357 // write cp_info | |
358 // write constant type | |
359 switch(cpConstType) { | |
360 case JVM_CONSTANT_Utf8: { | |
361 dos.writeByte(cpConstType); | |
362 Symbol sym = getSymbolAt(ci); | |
363 dos.writeShort((short)sym.getLength()); | |
364 dos.write(sym.asByteArray()); | |
365 if (DEBUG) debugMessage("CP[" + ci + "] = modified UTF-8 " + sym.asString()); | |
366 break; | |
367 } | |
368 | |
369 case JVM_CONSTANT_Unicode: | |
370 throw new IllegalArgumentException("Unicode constant!"); | |
371 | |
372 case JVM_CONSTANT_Integer: | |
373 dos.writeByte(cpConstType); | |
374 dos.writeInt(getIntAt(ci)); | |
375 if (DEBUG) debugMessage("CP[" + ci + "] = int " + getIntAt(ci)); | |
376 break; | |
377 | |
378 case JVM_CONSTANT_Float: | |
379 dos.writeByte(cpConstType); | |
380 dos.writeFloat(getFloatAt(ci)); | |
381 if (DEBUG) debugMessage("CP[" + ci + "] = float " + getFloatAt(ci)); | |
382 break; | |
383 | |
384 case JVM_CONSTANT_Long: { | |
385 dos.writeByte(cpConstType); | |
386 long l = getLongAt(ci); | |
387 // long entries occupy two pool entries | |
388 ci++; | |
389 dos.writeLong(l); | |
390 break; | |
391 } | |
392 | |
393 case JVM_CONSTANT_Double: | |
394 dos.writeByte(cpConstType); | |
395 dos.writeDouble(getDoubleAt(ci)); | |
396 // double entries occupy two pool entries | |
397 ci++; | |
398 break; | |
399 | |
400 case JVM_CONSTANT_Class: { | |
401 dos.writeByte(cpConstType); | |
402 // Klass already resolved. ConstantPool constains klassOop. | |
403 Klass refKls = (Klass) getObjAt(ci); | |
404 String klassName = refKls.getName().asString(); | |
405 Short s = (Short) utf8ToIndex.get(klassName); | |
406 dos.writeShort(s.shortValue()); | |
407 if (DEBUG) debugMessage("CP[" + ci + "] = class " + s); | |
408 break; | |
409 } | |
410 | |
411 // case JVM_CONSTANT_ClassIndex: | |
412 case JVM_CONSTANT_UnresolvedClass: { | |
413 dos.writeByte(JVM_CONSTANT_Class); | |
414 String klassName = getSymbolAt(ci).asString(); | |
415 Short s = (Short) utf8ToIndex.get(klassName); | |
416 dos.writeShort(s.shortValue()); | |
417 if (DEBUG) debugMessage("CP[" + ci + "] = class " + s); | |
418 break; | |
419 } | |
420 | |
421 case JVM_CONSTANT_String: { | |
422 dos.writeByte(cpConstType); | |
423 String str = OopUtilities.stringOopToString(getObjAt(ci)); | |
424 Short s = (Short) utf8ToIndex.get(str); | |
425 dos.writeShort(s.shortValue()); | |
426 if (DEBUG) debugMessage("CP[" + ci + "] = string " + s); | |
427 break; | |
428 } | |
429 | |
430 // case JVM_CONSTANT_StringIndex: | |
431 case JVM_CONSTANT_UnresolvedString: { | |
432 dos.writeByte(JVM_CONSTANT_String); | |
433 String val = getSymbolAt(ci).asString(); | |
434 | |
435 Short s = (Short) utf8ToIndex.get(val); | |
436 dos.writeShort(s.shortValue()); | |
437 if (DEBUG) debugMessage("CP[" + ci + "] = string " + s); | |
438 break; | |
439 } | |
440 | |
441 // all external, internal method/field references | |
442 case JVM_CONSTANT_Fieldref: | |
443 case JVM_CONSTANT_Methodref: | |
444 case JVM_CONSTANT_InterfaceMethodref: { | |
445 dos.writeByte(cpConstType); | |
446 int value = getIntAt(ci); | |
447 short klassIndex = (short) extractLowShortFromInt(value); | |
448 short nameAndTypeIndex = (short) extractHighShortFromInt(value); | |
449 dos.writeShort(klassIndex); | |
450 dos.writeShort(nameAndTypeIndex); | |
451 if (DEBUG) debugMessage("CP[" + ci + "] = ref klass = " + | |
452 klassIndex + ", N&T = " + nameAndTypeIndex); | |
453 break; | |
454 } | |
455 | |
456 case JVM_CONSTANT_NameAndType: { | |
457 dos.writeByte(cpConstType); | |
458 int value = getIntAt(ci); | |
459 short nameIndex = (short) extractLowShortFromInt(value); | |
460 short signatureIndex = (short) extractHighShortFromInt(value); | |
461 dos.writeShort(nameIndex); | |
462 dos.writeShort(signatureIndex); | |
463 if (DEBUG) debugMessage("CP[" + ci + "] = N&T name = " + nameIndex | |
464 + ", type = " + signatureIndex); | |
465 break; | |
466 } | |
467 } // switch | |
468 } | |
469 dos.flush(); | |
470 return; | |
471 } | |
472 | |
473 public void printValueOn(PrintStream tty) { | |
474 tty.print("ConstantPool for " + getPoolHolder().getName().asString()); | |
475 } | |
476 | |
477 public long getObjectSize() { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
478 return alignObjectSize(headerSize + (getLength() * getElementSize())); |
0 | 479 } |
480 | |
481 //---------------------------------------------------------------------- | |
482 // Internals only below this point | |
483 // | |
484 | |
485 private static int extractHighShortFromInt(int val) { | |
486 return (val >> 16) & 0xFFFF; | |
487 } | |
488 | |
489 private static int extractLowShortFromInt(int val) { | |
490 return val & 0xFFFF; | |
491 } | |
492 } |