# HG changeset patch # User Thomas Wuerthinger # Date 1365530190 -7200 # Node ID 14c629440b1a9d0a7e0c499400392e709ba59993 # Parent da39fb4f9b2e80f57e0083fedd28e131893c8e2b Common base LIR instruction for call ops. diff -r da39fb4f9b2e -r 14c629440b1a graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Tue Apr 09 19:51:24 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Tue Apr 09 19:56:30 2013 +0200 @@ -35,18 +35,14 @@ public class AMD64Call { - @Opcode("CALL_DIRECT") - public static class DirectCallOp extends AMD64LIRInstruction { + public abstract static class CallOp extends AMD64LIRInstruction { @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @Temp protected Value[] temps; @State protected LIRFrameState state; - protected final ResolvedJavaMethod callTarget; - - public DirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - this.callTarget = callTarget; + public CallOp(Value result, Value[] parameters, Value[] temps, LIRFrameState state) { this.result = result; this.parameters = parameters; this.state = state; @@ -55,32 +51,34 @@ } @Override - public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - directCall(tasm, masm, callTarget, null, true, state); - } - - @Override public boolean hasCall() { return true; } } - public abstract static class RuntimeCallOp extends AMD64LIRInstruction { + @Opcode("CALL_DIRECT") + public static class DirectCallOp extends CallOp { + + protected final ResolvedJavaMethod callTarget; - @Def({REG, ILLEGAL}) protected Value result; - @Use({REG, STACK}) protected Value[] parameters; - @Temp protected Value[] temps; - @State protected LIRFrameState state; + public DirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(result, parameters, temps, state); + this.callTarget = callTarget; + } + + @Override + public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { + directCall(tasm, masm, callTarget, null, true, state); + } + } + + public abstract static class RuntimeCallOp extends CallOp { protected final RuntimeCallTarget callTarget; public RuntimeCallOp(RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(result, parameters, temps, state); this.callTarget = callTarget; - this.result = result; - this.parameters = parameters; - this.state = state; - this.temps = temps; - assert temps != null; } @Override @@ -119,24 +117,16 @@ } @Opcode("CALL_INDIRECT") - public static class IndirectCallOp extends AMD64LIRInstruction { + public static class IndirectCallOp extends CallOp { - @Def({REG, ILLEGAL}) protected Value result; - @Use({REG, STACK}) protected Value[] parameters; @Use({REG}) protected Value targetAddress; - @Temp protected Value[] temps; - @State protected LIRFrameState state; protected final InvokeTarget callTarget; public IndirectCallOp(InvokeTarget callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, LIRFrameState state) { + super(result, parameters, temps, state); this.callTarget = callTarget; - this.result = result; - this.parameters = parameters; this.targetAddress = targetAddress; - this.state = state; - this.temps = temps; - assert temps != null; } @Override @@ -149,11 +139,6 @@ super.verify(); assert isRegister(targetAddress) : "The current register allocator cannot handle variables to be used at call sites, it must be in a fixed register for now"; } - - @Override - public boolean hasCall() { - return true; - } } public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, InvokeTarget callTarget, Register scratch, boolean align, LIRFrameState info) {