Mercurial > hg > truffle
annotate graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java @ 2783:9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 12:04:58 +0200 |
parents | 80b024e75b29 |
children | 9ba6a8abe894 bd17ac598c6e |
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 */ |
2715
3ac3dd97d8df
Added ExceptionEdgeInstruction interface.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2707
diff
changeset
|
35 public final class Invoke extends StateSplit implements ExceptionEdgeInstruction { |
2507
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 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
39 private static final int SUCCESSOR_COUNT = 1; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
40 private static final int SUCCESSOR_EXCEPTION_EDGE = 0; |
2596
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 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
69 /** |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
70 * The entry to the exception dispatch chain for this invoke. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
71 */ |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
72 @Override |
2783
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2755
diff
changeset
|
73 public Instruction exceptionEdge() { |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2755
diff
changeset
|
74 return (Instruction) successors().get(super.successorCount() + SUCCESSOR_EXCEPTION_EDGE); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
75 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
76 |
2755
80b024e75b29
small fix for dead blocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
2715
diff
changeset
|
77 public Instruction setExceptionEdge(Instruction n) { |
80b024e75b29
small fix for dead blocks
Lukas Stadler <lukas.stadler@jku.at>
parents:
2715
diff
changeset
|
78 return (Instruction) successors().set(super.successorCount() + SUCCESSOR_EXCEPTION_EDGE, n); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
79 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2628
diff
changeset
|
80 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
81 public final int opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
82 public final RiMethod target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
83 public final RiType returnType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
84 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
85 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
86 * Constructs a new Invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
87 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
88 * @param opcode the opcode of the invoke |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
89 * @param result the result type |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
90 * @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
|
91 * @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
|
92 * @param target the target method being called |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
93 * @param stateBefore the state before executing the invocation |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
94 */ |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
95 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
|
96 super(result, args.length, SUCCESSOR_COUNT, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
97 this.opcode = opcode; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
98 this.target = target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
99 this.returnType = returnType; |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
100 |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
101 this.argumentCount = args.length; |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
102 for (int i = 0; i < args.length; i++) { |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
103 setArgument(i, args[i]); |
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
104 } |
2507
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 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
107 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
108 * Gets the opcode of this invoke instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
109 * @return the opcode |
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 public int opcode() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
112 return opcode; |
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 * 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
|
117 * @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
|
118 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
119 public boolean isStatic() { |
2538
e1ba5a93e997
Clean up on Value class and LIRGenerator/LIRItem-related things.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2509
diff
changeset
|
120 return opcode == Bytecodes.INVOKESTATIC; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
121 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
122 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
123 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
124 public RiType declaredType() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
125 return returnType; |
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 |
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 * 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
|
130 * @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
|
131 * invocation does not take a receiver object |
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 public Value receiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
134 assert !isStatic(); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
135 return argument(0); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
136 } |
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 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
139 * Gets the target method for this invocation instruction. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
140 * @return the target method |
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 public RiMethod target() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
143 return target; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
144 } |
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 * Checks whether this invocation has a receiver object. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
148 * @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
|
149 * static call |
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 public boolean hasReceiver() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
152 return !isStatic(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
153 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
154 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
155 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
156 public void accept(ValueVisitor v) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
157 v.visitInvoke(this); |
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 public CiKind[] signature() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
161 CiKind receiver = isStatic() ? null : target.holder().kind(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
162 return Util.signatureToKinds(target.signature(), receiver); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
163 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
164 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
165 @Override |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
166 public void print(LogStream out) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
167 int argStart = 0; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
168 if (hasReceiver()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
169 out.print(receiver()).print('.'); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
170 argStart = 1; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
171 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
172 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
173 RiMethod target = target(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
174 out.print(target.name()).print('('); |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
175 for (int i = argStart; i < argumentCount; i++) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
176 if (i > argStart) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
177 out.print(", "); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
178 } |
2596
1c36b17f7ee0
new node layout: AccessMonitor, Invoke
Lukas Stadler <lukas.stadler@jku.at>
parents:
2543
diff
changeset
|
179 out.print(argument(i)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
180 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
181 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
|
182 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
183 } |