use of org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation in project graal by oracle.
the class SPARCTruffleCallBoundaryInstumentationFactory method createBuilder.
@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, OptionValues options, DebugContext debug, CompilationResult compilationResult) {
return new TruffleCallBoundaryInstrumentation(metaAccess, codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, config, registers) {
@Override
protected void injectTailCallCode(int installedCodeOffset, int entryPointOffset) {
SPARCMacroAssembler masm = (SPARCMacroAssembler) this.asm;
try (ScratchRegister scratch = masm.getScratchRegister()) {
Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, Object).get(0);
Register spillRegister = scratch.getRegister();
Label doProlog = new Label();
if (config.useCompressedOops) {
CompressEncoding encoding = config.getOopEncoding();
masm.ld(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister, 4, false);
Register baseReg = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
SPARCHotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, baseReg, encoding.getShift(), true);
} else {
masm.ldx(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister);
}
masm.ldx(new SPARCAddress(spillRegister, entryPointOffset), spillRegister);
masm.compareBranch(spillRegister, 0, Equal, Xcc, doProlog, PREDICT_NOT_TAKEN, null);
masm.jmp(spillRegister);
masm.nop();
masm.bind(doProlog);
}
}
};
}
use of org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation in project graal by oracle.
the class AMD64TruffleCallBoundaryInstrumentationFactory method createBuilder.
@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, OptionValues options, DebugContext debug, CompilationResult compilationResult) {
return new TruffleCallBoundaryInstrumentation(metaAccess, codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, config, registers) {
@Override
protected void injectTailCallCode(int installedCodeOffset, int entryPointOffset) {
AMD64MacroAssembler masm = (AMD64MacroAssembler) this.asm;
Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, JavaKind.Object).get(0);
Register spillRegister = AMD64.r10;
Label doProlog = new Label();
int pos = masm.position();
if (config.useCompressedOops) {
// First instruction must be at least 5 bytes long to be safe for patching
masm.movl(spillRegister, new AMD64Address(thisRegister, installedCodeOffset), true);
assert masm.position() - pos >= AMD64HotSpotBackend.PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE;
CompressEncoding encoding = config.getOopEncoding();
Register heapBaseRegister = AMD64Move.UncompressPointerOp.hasBase(options, encoding) ? registers.getHeapBaseRegister() : null;
AMD64Move.UncompressPointerOp.emitUncompressCode(masm, spillRegister, encoding.getShift(), heapBaseRegister, true);
} else {
// First instruction must be at least 5 bytes long to be safe for patching
masm.movq(spillRegister, new AMD64Address(thisRegister, installedCodeOffset), true);
assert masm.position() - pos >= AMD64HotSpotBackend.PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE;
}
masm.movq(spillRegister, new AMD64Address(spillRegister, entryPointOffset));
masm.testq(spillRegister, spillRegister);
masm.jcc(ConditionFlag.Equal, doProlog);
masm.jmp(spillRegister);
masm.bind(doProlog);
}
};
}
use of org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation in project graal by oracle.
the class AArch64TruffleCallBoundaryInstumentationFactory method createBuilder.
@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, OptionValues options, DebugContext debug, CompilationResult compilationResult) {
return new TruffleCallBoundaryInstrumentation(metaAccess, codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, config, registers) {
@Override
protected void injectTailCallCode(int installedCodeOffset, int entryPointOffset) {
AArch64MacroAssembler masm = (AArch64MacroAssembler) this.asm;
AArch64HotSpotBackend.emitInvalidatePlaceholder(this, masm);
try (ScratchRegister scratch = masm.getScratchRegister()) {
Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, Object).get(0);
Register spillRegister = scratch.getRegister();
Label doProlog = new Label();
if (config.useCompressedOops) {
CompressEncoding encoding = config.getOopEncoding();
masm.ldr(32, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
Register base = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
AArch64HotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, base, encoding.getShift(), true);
} else {
masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
}
masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(spillRegister, entryPointOffset));
masm.cbz(64, spillRegister, doProlog);
masm.jmp(spillRegister);
masm.nop();
masm.bind(doProlog);
}
}
};
}
Aggregations