comparison graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java @ 2538:e1ba5a93e997

Clean up on Value class and LIRGenerator/LIRItem-related things.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Apr 2011 20:13:54 +0200
parents 16b9a8b5ad39
children 3fc322165071
comparison
equal deleted inserted replaced
2537:4a016ff4d2df 2538:e1ba5a93e997
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 package com.sun.c1x.ir; 23 package com.sun.c1x.ir;
24 24
25 import java.lang.reflect.*;
26
25 import com.sun.c1x.debug.*; 27 import com.sun.c1x.debug.*;
26 import com.sun.c1x.util.*; 28 import com.sun.c1x.util.*;
27 import com.sun.c1x.value.*; 29 import com.sun.c1x.value.*;
30 import com.sun.cri.bytecode.*;
28 import com.sun.cri.ci.*; 31 import com.sun.cri.ci.*;
29 import com.sun.cri.ri.*; 32 import com.sun.cri.ri.*;
30 33
31 /** 34 /**
32 * The {@code Invoke} instruction represents all kinds of method calls. 35 * The {@code Invoke} instruction represents all kinds of method calls.
33 *
34 * @author Ben L. Titzer
35 */ 36 */
36 public final class Invoke extends StateSplit { 37 public final class Invoke extends StateSplit {
37 38
38 public final int opcode; 39 public final int opcode;
39 public final Value[] arguments; 40 public final Value[] arguments;
48 * @param args the list of instructions producing arguments to the invocation, including the receiver object 49 * @param args the list of instructions producing arguments to the invocation, including the receiver object
49 * @param isStatic {@code true} if this call is static (no receiver object) 50 * @param isStatic {@code true} if this call is static (no receiver object)
50 * @param target the target method being called 51 * @param target the target method being called
51 * @param stateBefore the state before executing the invocation 52 * @param stateBefore the state before executing the invocation
52 */ 53 */
53 public Invoke(int opcode, CiKind result, Value[] args, boolean isStatic, RiMethod target, RiType returnType, FrameState stateBefore) { 54 public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateBefore) {
54 super(result, stateBefore); 55 super(result, stateBefore);
55 this.opcode = opcode; 56 this.opcode = opcode;
56 this.arguments = args; 57 this.arguments = args;
57 this.target = target; 58 this.target = target;
58 this.returnType = returnType; 59 this.returnType = returnType;
59 if (isStatic) { 60 if (isStatic() || args[0].isNonNull() || args[0].kind.isWord()) {
60 setFlag(Flag.IsStatic);
61 eliminateNullCheck();
62 } else if (args[0].isNonNull() || args[0].kind.isWord()) {
63 eliminateNullCheck(); 61 eliminateNullCheck();
64 } 62 }
65 } 63 }
66 64
67 /** 65 /**
75 /** 73 /**
76 * Checks whether this is an invocation of a static method. 74 * Checks whether this is an invocation of a static method.
77 * @return {@code true} if the invocation is a static invocation 75 * @return {@code true} if the invocation is a static invocation
78 */ 76 */
79 public boolean isStatic() { 77 public boolean isStatic() {
80 return checkFlag(Flag.IsStatic); 78 return opcode == Bytecodes.INVOKESTATIC;
81 } 79 }
82 80
83 @Override 81 @Override
84 public RiType declaredType() { 82 public RiType declaredType() {
85 return returnType; 83 return returnType;