annotate c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotConstantPool.java @ 2062:231bf6b9f5ad

Added caching for constant pool entries.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Sat, 22 Jan 2011 17:31:11 +0100
parents 3c0a889a176b
children e5ba25730d9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.lang.reflect.*;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
24 import java.util.*;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
25
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
26 import com.sun.cri.ri.*;
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
27
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
28 /**
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
29 * Implementation of RiConstantPool for HotSpot.
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
30 *
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
31 * @author Thomas Wuerthinger, Lukas Stadler
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
32 */
2054
3c0a889a176b Added GC stats. Enabling intrinsics.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
33 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
34
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
35 private final long vmId;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
36
2062
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
37 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
38 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
39 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
40
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
41 public static class FastLRUIntCache<T> {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
42
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
43 private static final int InitialCapacity = 4;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
44 private int lastKey;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
45 private T lastObject;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
46
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
47 private int[] keys;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
48 private Object[] objects;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
49 private int count;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
50
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
51 @SuppressWarnings("unchecked")
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
52 private T access(int index) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
53 return (T) objects[index];
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
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
56 public T get(int key) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
57 if (key == lastKey) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
58 return lastObject;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
59 } else if (count > 1) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
60 for (int i = 0; i < count; ++i) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
61 if (keys[i] == key) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
62 lastObject = access(i);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
63 lastKey = key;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
64 return lastObject;
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 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
68 return null;
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
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
71 public void add(int key, T object) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
72 count++;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
73 if (count == 1) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
74 lastKey = key;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
75 lastObject = object;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
76 } else {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
77 ensureSize();
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
78 keys[count - 1] = key;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
79 objects[count - 1] = object;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
80 if (count == 2) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
81 keys[0] = lastKey;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
82 objects[0] = lastObject;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
83 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
84 lastKey = key;
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
85 lastObject = object;
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
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
89 private void ensureSize() {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
90 if (keys == null) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
91 keys = new int[InitialCapacity];
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
92 objects = new Object[InitialCapacity];
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
93 } else if (count > keys.length) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
94 keys = Arrays.copyOf(keys, keys.length * 2);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
95 objects = Arrays.copyOf(objects, objects.length * 2);
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 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
99
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
100 public HotSpotConstantPool(long vmId) {
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
101 this.vmId = vmId;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
102 }
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
103
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
104 @Override
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
105 public Object lookupConstant(int cpi) {
2062
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
106 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
107 return constant;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
108 }
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
109
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
110 @Override
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
111 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
112 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
113 }
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
114
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
115 @Override
2062
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
116 public RiMethod lookupMethod(int cpi, int byteCode) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
117 RiMethod result = methodCache.get(cpi);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
118 if (result == null) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
119 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
120 methodCache.add(cpi, result);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
121 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
122 return result;
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
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
125 @Override
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
126 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
127 RiType result = typeCache.get(cpi);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
128 if (result == null) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
129 result = Compiler.getVMEntries().RiConstantPool_lookupType(vmId, cpi);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
130 typeCache.add(cpi, result);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
131 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
132 return result;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
133 }
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
134
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
135 @Override
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
136 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
137 RiField result = fieldCache.get(cpi);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
138 if (result == null) {
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
139 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
140 fieldCache.add(cpi, result);
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
141 }
231bf6b9f5ad Added caching for constant pool entries.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2054
diff changeset
142 return result;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1417
diff changeset
143 }
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
144 }