Mercurial > hg > truffle
annotate c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java @ 2107:e5ba25730d9b
Sync with CRI changes.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 04 Feb 2011 16:01:24 +0100 |
parents | 231bf6b9f5ad |
children | 569d3fe7d65c |
rev | line source |
---|---|
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1 /* |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
3 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
5 * that is described in this document. In particular, and without limitation, these intellectual property |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
7 * more additional patents or pending patent applications in the U.S. and in other countries. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
8 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
11 * supplements. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
12 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
16 * U.S. and other countries. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
17 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
19 * Company, Ltd. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
20 */ |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
21 package com.sun.hotspot.c1x; |
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
22 |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
23 import java.util.*; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
24 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
25 import com.sun.cri.ri.*; |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
26 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
27 /** |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
28 * Implementation of RiConstantPool for HotSpot. |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
29 * |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
30 * @author Thomas Wuerthinger, Lukas Stadler |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
31 */ |
2054
3c0a889a176b
Added GC stats. Enabling intrinsics.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1465
diff
changeset
|
32 public class HotSpotConstantPool extends CompilerObject implements RiConstantPool { |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
33 |
1445
a7b84a5e16c6
Remove caching for constant pool entries (same index can be used to retrieve e.g. type and field). Fast fail on bailout in C1X.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
34 private final long vmId; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
35 |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
36 private final FastLRUIntCache<RiMethod> methodCache = new FastLRUIntCache<RiMethod>(); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
37 private final FastLRUIntCache<RiField> fieldCache = new FastLRUIntCache<RiField>(); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
38 private final FastLRUIntCache<RiType> typeCache = new FastLRUIntCache<RiType>(); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
39 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
40 public static class FastLRUIntCache<T> { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
41 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
42 private static final int InitialCapacity = 4; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
43 private int lastKey; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
44 private T lastObject; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
45 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
46 private int[] keys; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
47 private Object[] objects; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
48 private int count; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
49 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
50 @SuppressWarnings("unchecked") |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
51 private T access(int index) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
52 return (T) objects[index]; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
53 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
54 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
55 public T get(int key) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
56 if (key == lastKey) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
57 return lastObject; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
58 } else if (count > 1) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
59 for (int i = 0; i < count; ++i) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
60 if (keys[i] == key) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
61 lastObject = access(i); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
62 lastKey = key; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
63 return lastObject; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
64 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
65 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
66 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
67 return null; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
68 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
69 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
70 public void add(int key, T object) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
71 count++; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
72 if (count == 1) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
73 lastKey = key; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
74 lastObject = object; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
75 } else { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
76 ensureSize(); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
77 keys[count - 1] = key; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
78 objects[count - 1] = object; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
79 if (count == 2) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
80 keys[0] = lastKey; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
81 objects[0] = lastObject; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
82 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
83 lastKey = key; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
84 lastObject = object; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
85 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
86 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
87 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
88 private void ensureSize() { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
89 if (keys == null) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
90 keys = new int[InitialCapacity]; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
91 objects = new Object[InitialCapacity]; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
92 } else if (count > keys.length) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
93 keys = Arrays.copyOf(keys, keys.length * 2); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
94 objects = Arrays.copyOf(objects, objects.length * 2); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
95 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
96 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
97 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
98 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
99 public HotSpotConstantPool(long vmId) { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
100 this.vmId = vmId; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
101 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
102 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
103 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
104 public Object lookupConstant(int cpi) { |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
105 Object constant = Compiler.getVMEntries().RiConstantPool_lookupConstant(vmId, cpi); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
106 return constant; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
107 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
108 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
109 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
110 public RiSignature lookupSignature(int cpi) { |
1445
a7b84a5e16c6
Remove caching for constant pool entries (same index can be used to retrieve e.g. type and field). Fast fail on bailout in C1X.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
111 return Compiler.getVMEntries().RiConstantPool_lookupSignature(vmId, cpi); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
112 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
113 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
114 @Override |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
115 public RiMethod lookupMethod(int cpi, int byteCode) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
116 RiMethod result = methodCache.get(cpi); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
117 if (result == null) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
118 result = Compiler.getVMEntries().RiConstantPool_lookupMethod(vmId, cpi, (byte) byteCode); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
119 methodCache.add(cpi, result); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
120 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
121 return result; |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
122 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
123 |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
124 @Override |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
125 public RiType lookupType(int cpi, int opcode) { |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
126 RiType result = typeCache.get(cpi); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
127 if (result == null) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
128 result = Compiler.getVMEntries().RiConstantPool_lookupType(vmId, cpi); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
129 typeCache.add(cpi, result); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
130 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
131 return result; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
132 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
133 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
134 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
135 public RiField lookupField(int cpi, int opcode) { |
2062
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
136 RiField result = fieldCache.get(cpi); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
137 if (result == null) { |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
138 result = Compiler.getVMEntries().RiConstantPool_lookupField(vmId, cpi, (byte) opcode); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
139 fieldCache.add(cpi, result); |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
140 } |
231bf6b9f5ad
Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2054
diff
changeset
|
141 return result; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
142 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
143 } |