comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiConstantPool.java @ 4199:aaac4894175c

Renamed cri packages from sun to oracle.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 03 Jan 2012 16:29:28 +0100
parents graal/com.oracle.max.cri/src/com/sun/cri/ri/RiConstantPool.java@e233f5660da4
children
comparison
equal deleted inserted replaced
4198:8c9c0e1eaab1 4199:aaac4894175c
1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.max.cri.ri;
24
25 /**
26 * Represents the runtime representation of the constant pool that is
27 * used by the compiler when parsing bytecode. The {@code lookupXXX} methods look up a constant
28 * pool entry without performing resolution, and are used during compilation.
29 */
30 public interface RiConstantPool {
31
32 /**
33 * Makes sure that the type referenced by the specified constant pool entry is loaded and
34 * initialized. This can be used to compile time resolve a type. It works for field, method,
35 * or type constant pool entries.
36 * @param cpi the index of the constant pool entry that references the type
37 * @param opcode the opcode of the instruction that references the type
38 */
39 void loadReferencedType(int cpi, int opcode);
40
41 /**
42 * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
43 * specific to the JVM instruction it denotes are performed if the field is already resolved.
44 * Should any of these checks fail, an {@linkplain RiField#isResolved() unresolved}
45 * field reference is returned.
46 *
47 * @param cpi the constant pool index
48 * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
49 * @return a reference to the field at {@code cpi} in this pool
50 * @throws ClassFormatError if the entry at {@code cpi} is not a field
51 */
52 RiField lookupField(int cpi, int opcode);
53
54 /**
55 * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
56 * specific to the JVM instruction it denotes are performed if the method is already resolved.
57 * Should any of these checks fail, an {@linkplain RiMethod#isResolved() unresolved}
58 * method reference is returned.
59 *
60 * @param cpi the constant pool index
61 * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
62 * @return a reference to the method at {@code cpi} in this pool
63 * @throws ClassFormatError if the entry at {@code cpi} is not a method
64 */
65 RiMethod lookupMethod(int cpi, int opcode);
66
67 /**
68 * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks
69 * specific to the JVM instruction it denotes are performed if the type is already resolved.
70 * Should any of these checks fail, an {@linkplain RiType#isResolved() unresolved}
71 * type reference is returned.
72 *
73 * @param cpi the constant pool index
74 * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
75 * @return a reference to the compiler interface type
76 */
77 RiType lookupType(int cpi, int opcode);
78
79 /**
80 * Looks up a method signature.
81 *
82 * @param cpi the constant pool index
83 * @return the method signature at index {@code cpi} in this constant pool
84 */
85 RiSignature lookupSignature(int cpi);
86
87 /**
88 * Looks up a constant at the specified index.
89 * @param cpi the constant pool index
90 * @return the {@code CiConstant} instance representing the constant
91 */
92 Object lookupConstant(int cpi);
93 }