Mercurial > hg > graal-jvmci-8
changeset 8971:da39fb4f9b2e
Common base class for LIR runtime call ops.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 09 Apr 2013 19:51:24 +0200 |
parents | 50c63b0d858e |
children | 14c629440b1a |
files | graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java |
diffstat | 1 files changed, 18 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- 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")