< prev index next >
test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java
Print this page
rev 28792 : 8159368: [JVMCI] SPARChotSpotRegisterConfig.callingConvention gives incorrect calling convention for native calls containing fp args
@@ -26,14 +26,16 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
+import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.DebugInfo;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.ValueKindFactory;
import jdk.vm.ci.code.site.Call;
import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataPatch;
import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.site.Infopoint;
@@ -44,10 +46,11 @@
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
import jdk.vm.ci.hotspot.HotSpotCompiledNmethod;
import jdk.vm.ci.hotspot.HotSpotConstant;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.Assumptions.Assumption;
import jdk.vm.ci.meta.InvokeTarget;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.PlatformKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -163,10 +166,15 @@
* Emit code to return from a function, returning a 32-bit integer.
*/
public abstract void emitIntRet(Register a);
/**
+ * Emit code to return from a function, returning a single precision float.
+ */
+ public abstract void emitFloatRet(Register a);
+
+ /**
* Emit code to return from a function, returning a wide oop pointer.
*/
public abstract void emitPointerRet(Register a);
/**
@@ -191,11 +199,17 @@
private int stackAlignment;
private int curStackSlot;
private StackSlot deoptRescue;
- private static class TestValueKind extends ValueKind<TestValueKind> {
+ public ValueKindFactory<TestValueKind> valueKindFactory = new ValueKindFactory<TestAssembler.TestValueKind>() {
+ public TestValueKind getValueKind(JavaKind javaKind) {
+ return (TestValueKind) TestAssembler.this.getValueKind(javaKind);
+ }
+ };
+
+ static class TestValueKind extends ValueKind<TestValueKind> {
TestValueKind(PlatformKind kind) {
super(kind);
}
@@ -334,10 +348,15 @@
public void emitFloat(float f) {
ensureSize(data.position() + 4);
data.putFloat(f);
}
+ public void emitDouble(double f) {
+ ensureSize(data.position() + 8);
+ data.putDouble(f);
+ }
+
public void align(int alignment) {
int pos = data.position();
int misaligned = pos % alignment;
if (misaligned != 0) {
pos += alignment - misaligned;
@@ -347,6 +366,29 @@
private byte[] finish() {
return Arrays.copyOf(data.array(), data.position());
}
}
+
+ /**
+ * Loads a primitive into the Allocatable <code>av</code>. Implementors may only implement
+ * primitive types.
+ */
+ public abstract void emitLoad(AllocatableValue av, Object prim);
+
+ /**
+ * Emit a call to a fixed address <code>addr</code>
+ */
+ public abstract void emitCall(long addr);
+
+ /**
+ * Emit code which is necessary to call a method with {@link CallingConvention} <code>cc</code>
+ * and arguments <coe>prim</code>.
+ */
+ public abstract void emitCallPrologue(CallingConvention cc, Object... prim);
+
+ /**
+ * Emit code which is necessary after calling a method with CallingConvention <code>cc</code>.
+ */
+ public abstract void emitCallEpilogue(CallingConvention cc);
+
}
< prev index next >