Mercurial > hg > graal-compiler
comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiCallingConvention.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 | 9e0c1b4cfef5 |
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.ci; | |
24 | |
25 import com.sun.cri.ri.*; | |
26 | |
27 | |
28 /** | |
29 * A calling convention describes the locations in which the arguments for a call are placed. | |
30 */ | |
31 public class CiCallingConvention { | |
32 | |
33 /** | |
34 * Constants denoting the type of a call for which a calling convention is | |
35 * {@linkplain RiRegisterConfig#getCallingConvention(Type, CiKind[], CiTarget, boolean) requested}. | |
36 */ | |
37 public enum Type { | |
38 /** | |
39 * A request for the outgoing argument locations at a call site to Java code. | |
40 */ | |
41 JavaCall(true), | |
42 | |
43 /** | |
44 * A request for the incoming argument locations. | |
45 */ | |
46 JavaCallee(false), | |
47 | |
48 /** | |
49 * A request for the outgoing argument locations at a call site to the runtime (which may be Java or native code). | |
50 */ | |
51 RuntimeCall(true), | |
52 | |
53 /** | |
54 * A request for the outgoing argument locations at a call site to | |
55 * external native code that complies with the platform ABI. | |
56 */ | |
57 NativeCall(true); | |
58 | |
59 /** | |
60 * Determines if this is a request for the outgoing argument locations at a call site. | |
61 */ | |
62 public final boolean out; | |
63 | |
64 public static final Type[] VALUES = values(); | |
65 | |
66 private Type(boolean out) { | |
67 this.out = out; | |
68 } | |
69 } | |
70 | |
71 /** | |
72 * The amount of stack space (in bytes) required for the stack-based arguments of the call. | |
73 */ | |
74 public final int stackSize; | |
75 | |
76 /** | |
77 * The locations in which the arguments are placed. This array ordered by argument index. | |
78 */ | |
79 public final CiValue[] locations; | |
80 | |
81 public CiCallingConvention(CiValue[] locations, int stackSize) { | |
82 this.locations = locations; | |
83 this.stackSize = stackSize; | |
84 assert verify(); | |
85 } | |
86 | |
87 @Override | |
88 public String toString() { | |
89 StringBuilder result = new StringBuilder(); | |
90 result.append("CallingConvention["); | |
91 for (CiValue op : locations) { | |
92 result.append(op.toString()).append(" "); | |
93 } | |
94 result.append("]"); | |
95 return result.toString(); | |
96 } | |
97 | |
98 private boolean verify() { | |
99 for (int i = 0; i < locations.length; i++) { | |
100 CiValue location = locations[i]; | |
101 assert location.isStackSlot() || location.isRegister(); | |
102 } | |
103 return true; | |
104 } | |
105 } |