本文整理汇总了Java中jdk.vm.ci.code.site.DataSectionReference类的典型用法代码示例。如果您正苦于以下问题:Java DataSectionReference类的具体用法?Java DataSectionReference怎么用?Java DataSectionReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataSectionReference类属于jdk.vm.ci.code.site包,在下文中一共展示了DataSectionReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doubleTest
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@Test
public void doubleTest() {
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);
Data data = new SerializableData(JavaConstant.forDouble(84.72), 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);
}
示例2: rawDoubleTest
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@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);
}
示例3: emitLoadFloat
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@Override
public Register emitLoadFloat(float c) {
DataSectionReference ref = new DataSectionReference();
ref.setOffset(data.position());
data.emitFloat(c);
recordDataPatchInCode(ref);
Register ret = AMD64.xmm0;
emitREX(false, ret.encoding, 0, 0);
code.emitByte(0xF3);
code.emitByte(0x0F);
code.emitByte(0x10); // MOVSS xmm1, xmm2/m32
code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // xmm, [rip+offset]
code.emitInt(0xDEADDEAD);
return ret;
}
示例4: process
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
/**
* Process a {@link DataPatch} generated by the compiler and create all needed binary section
* constructs.
*/
void process(CompiledMethodInfo methodInfo, DataPatch dataPatch) {
Reference reference = dataPatch.reference;
if (reference instanceof ConstantReference) {
processConstantReference(dataPatch, methodInfo);
} else if (reference instanceof DataSectionReference) {
processDataSectionReference(dataPatch, methodInfo);
} else {
throw new InternalError("Unknown data patch reference: " + reference);
}
}
示例5: processDataSectionReference
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
private void processDataSectionReference(DataPatch dataPatch, CompiledMethodInfo methodInfo) {
DataSectionReference dataReference = (DataSectionReference) dataPatch.reference;
InstructionDecoder decoder = InstructionDecoder.getInstructionDecoder(target);
decoder.decodePosition(methodInfo.getCompilationResult().getTargetCode(), dataPatch.pcOffset);
int instructionEndOffset = decoder.currentEndOfInstruction();
int textBaseOffset = methodInfo.getTextSectionOffset();
int relocOffset = textBaseOffset + instructionEndOffset;
int dataOffset = dataReference.getOffset();
DataSection dataSection = methodInfo.getCompilationResult().getDataSection();
DataSection.Data data = dataSection.findData(dataReference);
int size = data.getSize();
int alignment = data.getAlignment();
byte[] value = new byte[size];
ByteBuffer buffer = ByteBuffer.wrap(value).order(ByteOrder.nativeOrder());
DataSection.emit(buffer, data, p -> {
});
String targetSymbol = "data.M" + methodInfo.getCodeId() + "." + dataOffset;
Symbol relocationSymbol = binaryContainer.getSymbol(targetSymbol);
if (relocationSymbol == null) {
int symSize = Math.max(8, size);
int symAlig = Math.max(8, alignment);
int offsetInConstantDataSection = binaryContainer.addConstantData(value, symAlig);
relocationSymbol = binaryContainer.getConstantDataContainer().createSymbol(offsetInConstantDataSection, Kind.OBJECT, Binding.LOCAL, symSize, targetSymbol);
}
Relocation reloc = new Relocation(relocOffset, RelocType.METASPACE_GOT_REFERENCE, 0, binaryContainer.getCodeContainer(), relocationSymbol);
binaryContainer.addRelocation(reloc);
}
示例6: insertData
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
/**
* Inserts a {@link Data} item into the data section. If the item is already in the data
* section, the same {@link DataSectionReference} is returned.
*
* @param data the {@link Data} item to be inserted
* @return a unique {@link DataSectionReference} identifying the {@link Data} item
*/
public DataSectionReference insertData(Data data) {
checkOpen();
synchronized (data) {
if (data.ref == null) {
data.ref = new DataSectionReference();
dataItems.add(data);
}
return data.ref;
}
}
示例7: findData
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
public Data findData(DataSectionReference ref) {
for (Data d : dataItems) {
if (d.ref == ref) {
return d;
}
}
return null;
}
示例8: emitLoadFloat
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
public Register emitLoadFloat(Register ret, float c) {
DataSectionReference ref = new DataSectionReference();
ref.setOffset(data.position());
data.emitFloat(c);
recordDataPatchInCode(ref);
emitREX(false, ret.encoding, 0, 0);
code.emitByte(0xF3);
code.emitByte(0x0F);
code.emitByte(0x10); // MOVSS xmm1, xmm2/m32
code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // xmm, [rip+offset]
code.emitInt(0xDEADDEAD);
return ret;
}
示例9: emitLoadDouble
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
public Register emitLoadDouble(Register ret, double c) {
DataSectionReference ref = new DataSectionReference();
ref.setOffset(data.position());
data.emitDouble(c);
recordDataPatchInCode(ref);
emitREX(false, ret.encoding, 0, 0);
code.emitByte(0xF2);
code.emitByte(0x0F);
code.emitByte(0x10); // MOVSD xmm1, xmm2/m32
code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // xmm, [rip+offset]
code.emitInt(0xDEADDEAD);
return ret;
}
示例10: emitLoadPointer
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
private Register emitLoadPointer(DataSectionReference ref, boolean narrow) {
recordDataPatchInCode(ref);
Register ret = newRegister();
emitREX(!narrow, ret.encoding, 0, 0);
code.emitByte(0x8B); // MOV r64,r/m64
code.emitByte(0x05 | ((ret.encoding & 0x7) << 3)); // r64, [rip+offset]
code.emitInt(0xDEADDEAD);
return ret;
}
示例11: emitDataItem
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
public DataSectionReference emitDataItem(HotSpotConstant c) {
DataSectionReference ref = new DataSectionReference();
ref.setOffset(data.position());
recordDataPatchInData(new ConstantReference((VMConstant) c));
if (c.isCompressed()) {
data.emitInt(0xDEADDEAD);
} else {
data.emitLong(0xDEADDEADDEADDEADL);
}
return ref;
}
示例12: loadLongToRegister
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
private void loadLongToRegister(long c, Register ret) {
DataSectionReference ref = new DataSectionReference();
data.align(8);
ref.setOffset(data.position());
data.emitLong(c);
emitLoadPointerToRegister(ref, ret);
}
示例13: emitLoadNarrowPointer
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@Override
public Register emitLoadNarrowPointer(DataSectionReference ref) {
Register ret = newRegister();
recordDataPatchInCode(ref);
emitPatchableSethi(ret, true);
emitOp3(0b11, ret, 0b000000, ret, 0); // LDUW [ret+0], ret
return ret;
}
示例14: emitDataItem
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@Override
public DataSectionReference emitDataItem(HotSpotConstant c) {
if (c.isCompressed()) {
data.align(4);
} else {
data.align(8);
}
return super.emitDataItem(c);
}
示例15: testDataSectionReference
import jdk.vm.ci.code.site.DataSectionReference; //导入依赖的package包/类
@Test
public void testDataSectionReference() {
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
DataSectionReference ref = asm.emitDataItem(c);
Register ret = asm.emitLoadPointer(ref);
asm.emitPointerRet(ret);
});
}