use of org.graalvm.compiler.code.DataSection.RawData in project graal by oracle.
the class SimpleAssemblerTest method rawDoubleTest.
@Test
public void rawDoubleTest() {
CodeGenTest test = new CodeGenTest() {
@Override
public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) {
AMD64MacroAssembler asm = new AMD64MacroAssembler(target);
Register ret = registerConfig.getReturnRegister(JavaKind.Double);
byte[] rawBytes = new byte[8];
ByteBuffer.wrap(rawBytes).order(ByteOrder.nativeOrder()).putDouble(84.72);
Data data = new RawData(rawBytes, 8);
DataSectionReference ref = compResult.getDataSection().insertData(data);
compResult.recordDataPatch(asm.position(), ref);
asm.movdbl(ret, asm.getPlaceholder(-1));
asm.ret(0);
return asm.close(true);
}
};
assertReturn("doubleStub", test, 84.72);
}
Aggregations