use of org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage in project graal by oracle.
the class StubAVXTest method test.
@Test
public void test() {
HotSpotProviders providers = (HotSpotProviders) getProviders();
HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, true, HotSpotForeignCallLinkage.Transition.LEAF_NOFP);
linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
runTest("testStub");
}
use of org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage in project graal by oracle.
the class HotSpotForeignCallsProviderImpl method lookupForeignCall.
@Override
public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) {
assert foreignCalls != null : descriptor;
HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor);
callTarget.finalizeAddress(runtime.getHostBackend());
return callTarget;
}
use of org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage in project graal by oracle.
the class HotSpotForeignCallsProviderImpl method getStubs.
@Override
public List<Stub> getStubs() {
List<Stub> stubs = new ArrayList<>();
for (HotSpotForeignCallLinkage linkage : foreignCalls.getValues()) {
if (linkage.isCompiledStub()) {
Stub stub = linkage.getStub();
assert stub != null;
stubs.add(stub);
}
}
return stubs;
}
use of org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage in project graal by oracle.
the class Stub method checkStubInvariants.
/**
* Checks the conditions a compilation must satisfy to be installed as a RuntimeStub.
*/
private boolean checkStubInvariants(CompilationResult compResult) {
assert compResult.getExceptionHandlers().isEmpty() : this;
// assumptions and there is no point in recording evol_method dependencies
assert compResult.getAssumptions() == null : "stubs should not use assumptions: " + this;
for (DataPatch data : compResult.getDataPatches()) {
if (data.reference instanceof ConstantReference) {
ConstantReference ref = (ConstantReference) data.reference;
if (ref.getConstant() instanceof HotSpotMetaspaceConstant) {
HotSpotMetaspaceConstant c = (HotSpotMetaspaceConstant) ref.getConstant();
if (c.asResolvedJavaType() != null && c.asResolvedJavaType().getName().equals("[I")) {
// embedding the type '[I' is safe, since it is never unloaded
continue;
}
}
}
assert !(data.reference instanceof ConstantReference) : this + " cannot have embedded object or metadata constant: " + data.reference;
}
for (Infopoint infopoint : compResult.getInfopoints()) {
assert infopoint instanceof Call : this + " cannot have non-call infopoint: " + infopoint;
Call call = (Call) infopoint;
assert call.target instanceof HotSpotForeignCallLinkage : this + " cannot have non runtime call: " + call.target;
HotSpotForeignCallLinkage callLinkage = (HotSpotForeignCallLinkage) call.target;
assert !callLinkage.isCompiledStub() || callLinkage.getDescriptor().equals(UNCOMMON_TRAP_HANDLER) : this + " cannot call compiled stub " + callLinkage;
}
return true;
}
use of org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage 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;
}
Aggregations