equal
deleted
inserted
replaced
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 } |