# HG changeset patch # User Thomas Wuerthinger # Date 1365529884 -7200 # Node ID da39fb4f9b2e80f57e0083fedd28e131893c8e2b # Parent 50c63b0d858e0f8e9aec66562b4795e2dace965e Common base class for LIR runtime call ops. diff -r 50c63b0d858e -r da39fb4f9b2e 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:29:26 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Tue Apr 09 19:51:24 2013 +0200 @@ -65,8 +65,7 @@ } } - @Opcode("CALL_NEAR_RUNTIME") - public static class DirectNearRuntimeCallOp extends AMD64LIRInstruction { + public abstract static class RuntimeCallOp extends AMD64LIRInstruction { @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @@ -75,7 +74,7 @@ protected final RuntimeCallTarget callTarget; - public DirectNearRuntimeCallOp(RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + public RuntimeCallOp(RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { this.callTarget = callTarget; this.result = result; this.parameters = parameters; @@ -85,34 +84,31 @@ } @Override - public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - directCall(tasm, masm, callTarget, null, false, state); - } - - @Override public boolean hasCall() { return !callTarget.preservesRegisters(); } } - @Opcode("CALL_FAR_RUNTIME") - public static class DirectFarRuntimeCallOp extends AMD64LIRInstruction { + @Opcode("CALL_NEAR_RUNTIME") + public static class DirectNearRuntimeCallOp extends RuntimeCallOp { + + public DirectNearRuntimeCallOp(RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(callTarget, result, parameters, temps, state); + } - @Def({REG, ILLEGAL}) protected Value result; - @Use({REG, STACK}) protected Value[] parameters; - @Temp protected Value[] temps; - @State protected LIRFrameState state; + @Override + public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { + directCall(tasm, masm, callTarget, null, false, state); + } + } + + @Opcode("CALL_FAR_RUNTIME") + public static class DirectFarRuntimeCallOp extends RuntimeCallOp { + @Temp({REG}) protected AllocatableValue callTemp; - protected final RuntimeCallTarget callTarget; - public DirectFarRuntimeCallOp(LIRGeneratorTool gen, RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - this.callTarget = callTarget; - this.result = result; - this.parameters = parameters; - this.state = state; - this.temps = temps; - assert temps != null; + super(callTarget, result, parameters, temps, state); callTemp = gen.newVariable(Kind.Long); } @@ -120,11 +116,6 @@ public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { directCall(tasm, masm, callTarget, ((RegisterValue) callTemp).getRegister(), false, state); } - - @Override - public boolean hasCall() { - return !callTarget.preservesRegisters(); - } } @Opcode("CALL_INDIRECT")