use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.
the class SPARCHotSpotLIRGenerator method emitForeignCall.
@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
debugInfo = state;
assert debugInfo != null || getStub() != null;
}
if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
HotSpotRegistersProvider registers = getProviders().getRegisters();
Register thread = registers.getThreadRegister();
Value threadTemp = newVariable(LIRKind.value(SPARCKind.XWORD));
Register stackPointer = registers.getStackPointerRegister();
Variable spScratch = newVariable(LIRKind.value(target().arch.getWordKind()));
append(new SPARCHotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread, stackPointer, threadTemp, spScratch));
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
append(new SPARCHotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadJavaFrameAnchorFlagsOffset(), thread, threadTemp));
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
return result;
}
use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.
the class SPARCHotSpotNodeLIRBuilder method visitSafepointNode.
@Override
public void visitSafepointNode(SafepointNode i) {
LIRFrameState info = state(i);
Register thread = getGen().getProviders().getRegisters().getThreadRegister();
append(new SPARCHotSpotSafepointOp(info, getGen().config, thread, gen));
}
use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.
the class AMD64HotSpotLIRGenerator method emitForeignCall.
@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
boolean destroysRegisters = hotspotLinkage.destroysRegisters();
AMD64SaveRegistersOp save = null;
Stub stub = getStub();
if (destroysRegisters) {
if (stub != null && stub.preservesRegisters()) {
Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
save = emitSaveAllRegisters(savedRegisters, true);
}
}
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
debugInfo = state;
assert debugInfo != null || stub != null;
}
if (hotspotLinkage.needsJavaFrameAnchor()) {
Register thread = getProviders().getRegisters().getThreadRegister();
append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), config.threadLastJavaPcOffset(), thread));
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
if (destroysRegisters) {
if (stub != null) {
if (stub.preservesRegisters()) {
HotSpotLIRGenerationResult generationResult = getResult();
LIRFrameState key = currentRuntimeCallInfo;
if (key == null) {
key = LIRFrameState.NO_STATE;
}
assert !generationResult.getCalleeSaveInfo().containsKey(key);
generationResult.getCalleeSaveInfo().put(key, save);
emitRestoreRegisters(save);
}
}
}
return result;
}
use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.
the class AMD64HotSpotNodeLIRBuilder method visitSafepointNode.
@Override
public void visitSafepointNode(SafepointNode i) {
LIRFrameState info = state(i);
Register thread = getGen().getProviders().getRegisters().getThreadRegister();
append(new AMD64HotSpotSafepointOp(info, getGen().config, this, thread));
}
use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.
the class AArch64HotSpotLIRGenerator method emitForeignCall.
@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
debugInfo = state;
assert debugInfo != null || getStub() != null;
}
if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
HotSpotRegistersProvider registers = getProviders().getRegisters();
Register thread = registers.getThreadRegister();
Variable scratch = newVariable(LIRKind.value(target().arch.getWordKind()));
// We need a label for the return address.
label = new Label();
append(new AArch64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), thread, scratch, label));
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
append(new AArch64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
// Clear it out so it's not being reused later.
label = null;
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
return result;
}
Aggregations