Mercurial > hg > graal-compiler
annotate graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java @ 2672:35453d725a2a
Add a BailoutOnException option on C1X to be able to tell expected exceptions (bailouts on jsr etc.) appart from true/unexpected exceptions
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Thu, 12 May 2011 17:57:58 +0200 |
parents | 569228710be8 |
children | 7ed72769d51a |
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.*; |
2538
e1ba5a93e997
Clean up on Value class and LIRGenerator/LIRItem-related things.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2509
diff
changeset
|
28 import com.sun.cri.bytecode.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
29 import com.sun.cri.ci.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
30 import com.sun.cri.ri.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
31 |
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 * 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
|
34 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
35 public final class Invoke extends StateSplit { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
36 |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
37 private final int argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
38 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
39 private static final int SUCCESSOR_COUNT = 0; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
40 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
41 @Override |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
42 protected int inputCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
43 return super.inputCount() + argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
44 } |
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 @Override |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
47 protected int successorCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
48 return super.successorCount() + SUCCESSOR_COUNT; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
49 } |
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 * 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
|
53 */ |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
54 public Value argument(int index) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
55 assert index >= 0 && index < argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
56 return (Value) inputs().get(super.inputCount() + index); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
57 } |
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 public Value setArgument(int index, Value n) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
60 assert index >= 0 && index < argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
61 return (Value) inputs().set(super.inputCount() + index, n); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
62 } |
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 public int argumentCount() { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
65 return argumentCount; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
66 } |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
67 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
68 public final int opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
69 public final RiMethod target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
70 public final RiType returnType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
71 |
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 * Constructs a new Invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
74 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
75 * @param opcode the opcode of the invoke |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
76 * @param result the result type |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
77 * @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
|
78 * @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
|
79 * @param target the target method being called |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
80 * @param stateBefore the state before executing the invocation |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
81 */ |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
82 public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, Graph graph) { |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
83 super(result, args.length, SUCCESSOR_COUNT, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
84 this.opcode = opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
85 this.target = target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
86 this.returnType = returnType; |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
87 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
88 this.argumentCount = args.length; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
89 for (int i = 0; i < args.length; i++) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
90 setArgument(i, args[i]); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
91 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
92 } |
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 * Gets the opcode of this invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
96 * @return the opcode |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
97 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
98 public int opcode() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
99 return opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
100 } |
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 * 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
|
104 * @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
|
105 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
106 public boolean isStatic() { |
2538
e1ba5a93e997
Clean up on Value class and LIRGenerator/LIRItem-related things.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2509
diff
changeset
|
107 return opcode == Bytecodes.INVOKESTATIC; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
108 } |
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 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
111 public RiType declaredType() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
112 return returnType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
113 } |
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 * 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
|
117 * @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
|
118 * invocation does not take a receiver object |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
119 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
120 public Value receiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
121 assert !isStatic(); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
122 return argument(0); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
123 } |
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 * Gets the target method for this invocation instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
127 * @return the target method |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
128 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
129 public RiMethod target() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
130 return target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
131 } |
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 * Checks whether this invocation has a receiver object. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
135 * @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
|
136 * static call |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
137 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
138 public boolean hasReceiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
139 return !isStatic(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
140 } |
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 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
143 public void accept(ValueVisitor v) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
144 v.visitInvoke(this); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
145 } |
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 public CiKind[] signature() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
148 CiKind receiver = isStatic() ? null : target.holder().kind(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
149 return Util.signatureToKinds(target.signature(), receiver); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
150 } |
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 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
153 public void print(LogStream out) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
154 int argStart = 0; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
155 if (hasReceiver()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
156 out.print(receiver()).print('.'); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
157 argStart = 1; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
158 } |
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 RiMethod target = target(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
161 out.print(target.name()).print('('); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
162 for (int i = argStart; i < argumentCount; i++) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
163 if (i > argStart) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
164 out.print(", "); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
165 } |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
166 out.print(argument(i)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
167 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
168 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
|
169 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
170 } |