use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class SubstrateAMD64Backend method newLIRGenerationResult.
@Override
public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, StructuredGraph graph, Object stub) {
SharedMethod method = (SharedMethod) graph.method();
CallingConvention callingConvention = CodeUtil.getCallingConvention(getCodeCache(), method.isEntryPoint() ? SubstrateCallingConventionType.NativeCallee : SubstrateCallingConventionType.JavaCallee, method, this);
return new SubstrateLIRGenerationResult(compilationId, lir, frameMapBuilder, callingConvention, method);
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class HotSpotForeignCallLinkageImpl method create.
/**
* Creates a {@link HotSpotForeignCallLinkage}.
*
* @param descriptor the descriptor of the call
* @param address the address of the code to call
* @param effect specifies if the call destroys or preserves all registers (apart from
* temporaries which are always destroyed)
* @param outgoingCcType outgoing (caller) calling convention type
* @param incomingCcType incoming (callee) calling convention type (can be null)
* @param transition specifies if this is a {@linkplain #needsDebugInfo() leaf} call
* @param reexecutable specifies if the call can be re-executed without (meaningful) side
* effects. Deoptimization will not return to a point before a call that cannot be
* re-executed.
* @param killedLocations the memory locations killed by the call
*/
public static HotSpotForeignCallLinkage create(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, WordTypes wordTypes, HotSpotForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Type outgoingCcType, Type incomingCcType, Transition transition, boolean reexecutable, LocationIdentity... killedLocations) {
CallingConvention outgoingCc = createCallingConvention(metaAccess, codeCache, wordTypes, foreignCalls, descriptor, outgoingCcType);
CallingConvention incomingCc = incomingCcType == null ? null : createCallingConvention(metaAccess, codeCache, wordTypes, foreignCalls, descriptor, incomingCcType);
HotSpotForeignCallLinkageImpl linkage = new HotSpotForeignCallLinkageImpl(descriptor, address, effect, transition, outgoingCc, incomingCc, reexecutable, killedLocations);
if (outgoingCcType == HotSpotCallingConventionType.NativeCall) {
linkage.temporaries = foreignCalls.getNativeABICallerSaveRegisters();
}
return linkage;
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class HotSpotHostBackend method makeCallingConvention.
protected CallingConvention makeCallingConvention(StructuredGraph graph, Stub stub) {
if (stub != null) {
return stub.getLinkage().getIncomingCallingConvention();
}
CallingConvention cc = getCallingConvention(getCodeCache(), HotSpotCallingConventionType.JavaCallee, graph.method(), this);
if (graph.getEntryBCI() != JVMCICompiler.INVOCATION_ENTRY_BCI) {
// for OSR, only a pointer is passed to the method.
JavaType[] parameterTypes = new JavaType[] { getMetaAccess().lookupJavaType(long.class) };
CallingConvention tmp = getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.JavaCallee, getMetaAccess().lookupJavaType(void.class), parameterTypes, this);
cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
}
return cc;
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class FrameMapBuilderImpl method buildFrameMap.
@Override
@SuppressWarnings("try")
public FrameMap buildFrameMap(LIRGenerationResult res) {
DebugContext debug = res.getLIR().getDebug();
if (debug.areScopesEnabled()) {
verifyStackSlotAllocation(res);
}
for (CallingConvention cc : calls) {
frameMap.callsMethod(cc);
}
frameMap.finish();
return frameMap;
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class NodeLIRBuilder method emitPrologue.
protected void emitPrologue(StructuredGraph graph) {
CallingConvention incomingArguments = gen.getResult().getCallingConvention();
Value[] params = new Value[incomingArguments.getArgumentCount()];
for (int i = 0; i < params.length; i++) {
params[i] = incomingArguments.getArgument(i);
if (ValueUtil.isStackSlot(params[i])) {
StackSlot slot = ValueUtil.asStackSlot(params[i]);
if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) {
gen.getResult().getLIR().setHasArgInCallerFrame();
}
}
}
gen.emitIncomingValues(params);
for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) {
Value paramValue = params[param.index()];
assert paramValue.getValueKind().equals(getLIRGeneratorTool().getLIRKind(param.stamp(NodeView.DEFAULT))) : paramValue + " " + getLIRGeneratorTool().getLIRKind(param.stamp(NodeView.DEFAULT));
setResult(param, gen.emitMove(paramValue));
}
}
Aggregations