75
76 public HotSpotHostBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
77 super(runtime, providers);
78 this.config = config;
79 }
80
81 @Override
82 @SuppressWarnings("try")
83 public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
84 final HotSpotProviders providers = getProviders();
85 HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls();
86 final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
87
88 try (InitTimer st = timer("foreignCalls.initialize")) {
89 foreignCalls.initialize(providers, options);
90 }
91 try (InitTimer st = timer("lowerer.initialize")) {
92 Iterable<DebugHandlersFactory> factories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection()));
93 lowerer.initialize(options, factories, providers, config);
94 }
95 }
96
97 protected CallingConvention makeCallingConvention(StructuredGraph graph, Stub stub) {
98 if (stub != null) {
99 return stub.getLinkage().getIncomingCallingConvention();
100 }
101
102 CallingConvention cc = getCallingConvention(getCodeCache(), HotSpotCallingConventionType.JavaCallee, graph.method(), this);
103 if (graph.getEntryBCI() != JVMCICompiler.INVOCATION_ENTRY_BCI) {
104 // for OSR, only a pointer is passed to the method.
105 JavaType[] parameterTypes = new JavaType[]{getMetaAccess().lookupJavaType(long.class)};
106 CallingConvention tmp = getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.JavaCallee, getMetaAccess().lookupJavaType(void.class), parameterTypes, this);
107 cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
108 }
109 return cc;
110 }
111
112 public void emitStackOverflowCheck(CompilationResultBuilder crb) {
113 if (config.useStackBanging) {
114 // Each code entry causes one stack bang n pages down the stack where n
|
75
76 public HotSpotHostBackend(GraalHotSpotVMConfig config, HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
77 super(runtime, providers);
78 this.config = config;
79 }
80
81 @Override
82 @SuppressWarnings("try")
83 public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
84 final HotSpotProviders providers = getProviders();
85 HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls();
86 final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
87
88 try (InitTimer st = timer("foreignCalls.initialize")) {
89 foreignCalls.initialize(providers, options);
90 }
91 try (InitTimer st = timer("lowerer.initialize")) {
92 Iterable<DebugHandlersFactory> factories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection()));
93 lowerer.initialize(options, factories, providers, config);
94 }
95 providers.getReplacements().closeSnippetRegistration();
96 }
97
98 protected CallingConvention makeCallingConvention(StructuredGraph graph, Stub stub) {
99 if (stub != null) {
100 return stub.getLinkage().getIncomingCallingConvention();
101 }
102
103 CallingConvention cc = getCallingConvention(getCodeCache(), HotSpotCallingConventionType.JavaCallee, graph.method(), this);
104 if (graph.getEntryBCI() != JVMCICompiler.INVOCATION_ENTRY_BCI) {
105 // for OSR, only a pointer is passed to the method.
106 JavaType[] parameterTypes = new JavaType[]{getMetaAccess().lookupJavaType(long.class)};
107 CallingConvention tmp = getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.JavaCallee, getMetaAccess().lookupJavaType(void.class), parameterTypes, this);
108 cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
109 }
110 return cc;
111 }
112
113 public void emitStackOverflowCheck(CompilationResultBuilder crb) {
114 if (config.useStackBanging) {
115 // Each code entry causes one stack bang n pages down the stack where n
|