Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCacheEntry.java @ 1602:136b78722a08
6939203: JSR 292 needs method handle constants
Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode.
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Wed, 09 Jun 2010 18:50:45 -0700 |
parents | c18cbe5936b8 |
children | 0a8e0d4345b3 |
comparison
equal
deleted
inserted
replaced
1585:49fac4acd688 | 1602:136b78722a08 |
---|---|
26 | 26 |
27 import java.util.*; | 27 import java.util.*; |
28 import sun.jvm.hotspot.debugger.*; | 28 import sun.jvm.hotspot.debugger.*; |
29 import sun.jvm.hotspot.runtime.*; | 29 import sun.jvm.hotspot.runtime.*; |
30 import sun.jvm.hotspot.types.*; | 30 import sun.jvm.hotspot.types.*; |
31 import sun.jvm.hotspot.utilities.*; | |
31 | 32 |
32 public class ConstantPoolCacheEntry { | 33 public class ConstantPoolCacheEntry { |
33 private static long size; | 34 private static long size; |
34 private static long baseOffset; | 35 private static long baseOffset; |
35 private static CIntegerField indices; | 36 private static CIntegerField indices; |
65 this.cp = cp; | 66 this.cp = cp; |
66 offset = baseOffset + index * size; | 67 offset = baseOffset + index * size; |
67 } | 68 } |
68 | 69 |
69 public int getConstantPoolIndex() { | 70 public int getConstantPoolIndex() { |
71 if (Assert.ASSERTS_ENABLED) { | |
72 Assert.that(!isSecondaryEntry(), "must not be a secondary CP entry"); | |
73 } | |
70 return (int) (getIndices() & 0xFFFF); | 74 return (int) (getIndices() & 0xFFFF); |
75 } | |
76 | |
77 public boolean isSecondaryEntry() { | |
78 return (getIndices() & 0xFFFF) == 0; | |
79 } | |
80 | |
81 public int getMainEntryIndex() { | |
82 if (Assert.ASSERTS_ENABLED) { | |
83 Assert.that(isSecondaryEntry(), "must be a secondary CP entry"); | |
84 } | |
85 return (int) (getIndices() >>> 16); | |
71 } | 86 } |
72 | 87 |
73 private long getIndices() { | 88 private long getIndices() { |
74 return cp.getHandle().getCIntegerAt(indices.getOffset() + offset, indices.getSize(), indices.isUnsigned()); | 89 return cp.getHandle().getCIntegerAt(indices.getOffset() + offset, indices.getSize(), indices.isUnsigned()); |
75 } | 90 } |