Mercurial > hg > graal-jvmci-8
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java @ 1434:72cfb36c6bb2
* enabled all jtt tests
* added proxy that counts jni calls
* honor hotspot stackshadowpages
* constant pool caching
* monitor enter/exit
* arithmetic stubs (frem, drem, ...)
* create stack values for debug info
* some doc
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 30 Sep 2010 17:19:48 -0700 |
parents | 760213a60e8b |
children | 9e5e83ca2259 |
comparison
equal
deleted
inserted
replaced
1433:efba53f86c4f | 1434:72cfb36c6bb2 |
---|---|
15 * | 15 * |
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. | 16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. |
17 */ | 17 */ |
18 package com.sun.hotspot.c1x; | 18 package com.sun.hotspot.c1x; |
19 | 19 |
20 import java.util.*; | |
21 | |
20 import com.sun.cri.ci.*; | 22 import com.sun.cri.ci.*; |
21 import com.sun.cri.ri.*; | 23 import com.sun.cri.ri.*; |
22 | 24 |
23 /** | 25 /** |
24 * Implementation of RiConstantPool for HotSpot. | 26 * Implementation of RiConstantPool for HotSpot. |
26 * @author Thomas Wuerthinger, Lukas Stadler | 28 * @author Thomas Wuerthinger, Lukas Stadler |
27 */ | 29 */ |
28 public class HotSpotConstantPool implements RiConstantPool, CompilerObject { | 30 public class HotSpotConstantPool implements RiConstantPool, CompilerObject { |
29 | 31 |
30 long vmId; | 32 long vmId; |
33 HashMap<Integer, Object> cache = new HashMap<Integer, Object>(); | |
31 | 34 |
32 public HotSpotConstantPool(long vmId) { | 35 public HotSpotConstantPool(long vmId) { |
33 this.vmId = vmId; | 36 this.vmId = vmId; |
34 } | 37 } |
35 | 38 |
39 return CiConstant.forObject(vmId); | 42 return CiConstant.forObject(vmId); |
40 } | 43 } |
41 | 44 |
42 @Override | 45 @Override |
43 public Object lookupConstant(int cpi) { | 46 public Object lookupConstant(int cpi) { |
44 return Compiler.getVMEntries().RiConstantPool_lookupConstant(vmId, cpi); | 47 Object value = cache.get(cpi); |
48 if (value == null) { | |
49 value = Compiler.getVMEntries().RiConstantPool_lookupConstant(vmId, cpi); | |
50 cache.put(cpi, value); | |
51 } | |
52 return value; | |
45 } | 53 } |
46 | 54 |
47 @Override | 55 @Override |
48 public RiMethod lookupMethod(int cpi, int byteCode) { | 56 public RiMethod lookupMethod(int cpi, int byteCode) { |
49 return Compiler.getVMEntries().RiConstantPool_lookupMethod(vmId, cpi, (byte) byteCode); | 57 RiMethod value = (RiMethod) cache.get(cpi); |
58 if (value == null) { | |
59 value = Compiler.getVMEntries().RiConstantPool_lookupMethod(vmId, cpi, (byte) byteCode); | |
60 cache.put(cpi, value); | |
61 } | |
62 return value; | |
50 } | 63 } |
51 | 64 |
52 @Override | 65 @Override |
53 public RiSignature lookupSignature(int cpi) { | 66 public RiSignature lookupSignature(int cpi) { |
54 return Compiler.getVMEntries().RiConstantPool_lookupSignature(vmId, cpi); | 67 RiSignature value = (RiSignature) cache.get(cpi); |
68 if (value == null) { | |
69 value = Compiler.getVMEntries().RiConstantPool_lookupSignature(vmId, cpi); | |
70 cache.put(cpi, value); | |
71 } | |
72 return value; | |
55 } | 73 } |
56 | 74 |
57 @Override | 75 @Override |
58 public RiType lookupType(int cpi, int opcode) { | 76 public RiType lookupType(int cpi, int opcode) { |
59 return Compiler.getVMEntries().RiConstantPool_lookupType(vmId, cpi); | 77 RiType value = (RiType) cache.get(cpi); |
78 if (value == null) { | |
79 value = Compiler.getVMEntries().RiConstantPool_lookupType(vmId, cpi); | |
80 cache.put(cpi, value); | |
81 } | |
82 return value; | |
60 } | 83 } |
61 | 84 |
62 @Override | 85 @Override |
63 public RiField lookupField(int cpi, int opcode) { | 86 public RiField lookupField(int cpi, int opcode) { |
64 return Compiler.getVMEntries().RiConstantPool_lookupField(vmId, cpi); | 87 RiField value = (RiField) cache.get(cpi); |
88 if (value == null) { | |
89 value = Compiler.getVMEntries().RiConstantPool_lookupField(vmId, cpi); | |
90 cache.put(cpi, value); | |
91 } | |
92 return value; | |
65 } | 93 } |
66 | 94 |
67 } | 95 } |