comparison graal/com.oracle.max.cri/src/com/sun/cri/ri/RiSignature.java @ 3733:e233f5660da4

Added Java files from Maxine project.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 17 Dec 2011 19:59:18 +0100
parents
children
comparison
equal deleted inserted replaced
3732:3e2e8b8abdaf 3733:e233f5660da4
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.sun.cri.ri;
24
25 import com.sun.cri.ci.*;
26
27 /**
28 * Represents a method signature provided by the runtime.
29 *
30 * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#7035">Method Descriptors</a>
31 */
32 public interface RiSignature {
33 /**
34 * Gets the number of arguments in this signature, adding 1 for a receiver if requested.
35 *
36 * @param receiver true if 1 is to be added to the result for a receiver
37 * @return the number of arguments + 1 iff {@code receiver == true}
38 */
39 int argumentCount(boolean receiver);
40
41 /**
42 * Gets the argument type at the specified position. This method will return a
43 * {@linkplain RiType#isResolved() resolved} type if possible but without
44 * triggering any class loading or resolution.
45 *
46 * @param index the index into the parameters, with {@code 0} indicating the first parameter
47 * @param accessingClass the context of the type lookup. If accessing class is resolved, its class loader
48 * is used to retrieve an existing resolved type. This value can be {@code null} if the caller does
49 * not care for a resolved type.
50 * @return the {@code index}'th argument type
51 */
52 RiType argumentTypeAt(int index, RiType accessingClass);
53
54 /**
55 * Gets the argument kind at the specified position.
56 * @param index the index into the parameters, with {@code 0} indicating the first parameter
57 * @param architecture When true, the architecture-specific kind used for emitting machine code is returned.
58 * When false, the kind according to the Java specification is returned.
59 * @return the kind of the argument at the specified position
60 */
61 CiKind argumentKindAt(int index, boolean architecture);
62
63 /**
64 * Gets the return type of this signature. This method will return a
65 * {@linkplain RiResolvedType resolved} type if possible but without
66 * triggering any class loading or resolution.
67 *
68 * @param accessingClass the context of the type lookup. If accessing class is resolved, its class loader
69 * is used to retrieve an existing resolved type. This value can be {@code null} if the caller does
70 * not care for a resolved type.
71 * @return the compiler interface type representing the return type
72 */
73 RiType returnType(RiType accessingClass);
74
75 /**
76 * Gets the return kind of this signature.
77 * @param architectureSpecific When true, the architecture-specific kind used for emitting machine code is returned.
78 * When false, the kind according to the Java specification is returned.
79 * @return the return kind
80 */
81 CiKind returnKind(boolean architectureSpecific);
82
83 /**
84 * Converts this signature to a string.
85 * @return the signature as a string
86 */
87 String asString();
88
89 /**
90 * Gets the size, in Java slots, of the arguments to this signature.
91 * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the receiver
92 * @return the size of the arguments in slots
93 */
94 int argumentSlots(boolean withReceiver);
95 }