Mercurial > hg > truffle
annotate graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java @ 2630:c93adece95d2
Small clean up.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 10 May 2011 16:47:49 +0200 |
parents | 91d3952f7eb7 |
children | 569228710be8 |
rev | line source |
---|---|
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1 /* |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
4 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
8 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
13 * accompanied this code). |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
14 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
18 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
21 * questions. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
22 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
23 package com.sun.c1x.ir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
24 |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
25 import com.oracle.graal.graph.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
26 import com.sun.c1x.debug.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
27 import com.sun.c1x.util.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
28 import com.sun.c1x.value.*; |
2538
e1ba5a93e997
Clean up on Value class and LIRGenerator/LIRItem-related things.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2509
diff
changeset
|
29 import com.sun.cri.bytecode.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
30 import com.sun.cri.ci.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
31 import com.sun.cri.ri.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
32 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
33 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
34 * The {@code Invoke} instruction represents all kinds of method calls. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
35 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
36 public final class Invoke extends StateSplit { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
37 |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
38 private final int argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
39 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
40 private static final int SUCCESSOR_COUNT = 0; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
41 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
42 @Override |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
43 protected int inputCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
44 return super.inputCount() + argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
45 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
46 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
47 @Override |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
48 protected int successorCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
49 return super.successorCount() + SUCCESSOR_COUNT; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
50 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
51 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
52 /** |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
53 * The list of instructions that produce input for this instruction. |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
54 */ |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
55 public Value argument(int index) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
56 assert index >= 0 && index < argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
57 return (Value) inputs().get(super.inputCount() + index); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
58 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
59 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
60 public Value setArgument(int index, Value n) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
61 assert index >= 0 && index < argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
62 return (Value) inputs().set(super.inputCount() + index, n); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
63 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
64 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
65 public int argumentCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
66 return argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
67 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
68 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
69 public final int opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
70 public final RiMethod target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
71 public final RiType returnType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
72 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
73 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
74 * Constructs a new Invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
75 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
76 * @param opcode the opcode of the invoke |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
77 * @param result the result type |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
78 * @param args the list of instructions producing arguments to the invocation, including the receiver object |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
79 * @param isStatic {@code true} if this call is static (no receiver object) |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
80 * @param target the target method being called |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
81 * @param stateBefore the state before executing the invocation |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
82 */ |
2622
91d3952f7eb7
Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2596
diff
changeset
|
83 public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateAfter, Graph graph) { |
91d3952f7eb7
Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2596
diff
changeset
|
84 super(result, stateAfter, args.length, SUCCESSOR_COUNT, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
85 this.opcode = opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
86 this.target = target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
87 this.returnType = returnType; |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
88 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
89 this.argumentCount = args.length; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
90 for (int i = 0; i < args.length; i++) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
91 setArgument(i, args[i]); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
92 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
93 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
94 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
95 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
96 * Gets the opcode of this invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
97 * @return the opcode |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
98 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
99 public int opcode() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
100 return opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
101 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
102 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
103 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
104 * Checks whether this is an invocation of a static method. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
105 * @return {@code true} if the invocation is a static invocation |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
106 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
107 public boolean isStatic() { |
2538
e1ba5a93e997
Clean up on Value class and LIRGenerator/LIRItem-related things.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2509
diff
changeset
|
108 return opcode == Bytecodes.INVOKESTATIC; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
109 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
110 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
111 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
112 public RiType declaredType() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
113 return returnType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
114 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
115 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
116 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
117 * Gets the instruction that produces the receiver object for this invocation, if any. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
118 * @return the instruction that produces the receiver object for this invocation if any, {@code null} if this |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
119 * invocation does not take a receiver object |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
120 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
121 public Value receiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
122 assert !isStatic(); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
123 return argument(0); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
124 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
125 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
126 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
127 * Gets the target method for this invocation instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
128 * @return the target method |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
129 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
130 public RiMethod target() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
131 return target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
132 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
133 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
134 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
135 * Checks whether this invocation has a receiver object. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
136 * @return {@code true} if this invocation has a receiver object; {@code false} otherwise, if this is a |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
137 * static call |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
138 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
139 public boolean hasReceiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
140 return !isStatic(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
141 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
142 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
143 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
144 public void accept(ValueVisitor v) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
145 v.visitInvoke(this); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
146 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
147 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
148 public CiKind[] signature() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
149 CiKind receiver = isStatic() ? null : target.holder().kind(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
150 return Util.signatureToKinds(target.signature(), receiver); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
151 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
152 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
153 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
154 public void print(LogStream out) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
155 int argStart = 0; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
156 if (hasReceiver()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
157 out.print(receiver()).print('.'); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
158 argStart = 1; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
159 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
160 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
161 RiMethod target = target(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
162 out.print(target.name()).print('('); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
163 for (int i = argStart; i < argumentCount; i++) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
164 if (i > argStart) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
165 out.print(", "); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
166 } |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
167 out.print(argument(i)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
168 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
169 out.print(CiUtil.format(") [method: %H.%n(%p):%r]", target, false)); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
170 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
171 } |