public CompileFunction createCustomCompileFunction() { return (debug, method, identifier, reason, config) -> { SubstrateBackend backend = config.getBackendForNormalMethod(); VMError.guarantee(backend.getTarget().arch instanceof AMD64, "currently only implemented on AMD64"); // Determine register for jmethodID argument HostedProviders providers = (HostedProviders) config.getProviders(); List<JavaType> parameters = new ArrayList<>(); parameters.add(providers.getMetaAccess().lookupJavaType(JNIEnvironment.class)); parameters.add(providers.getMetaAccess().lookupJavaType(JNIObjectHandle.class)); if (nonVirtual) { parameters.add(providers.getMetaAccess().lookupJavaType(JNIObjectHandle.class)); } parameters.add(providers.getMetaAccess().lookupJavaType(JNIMethodId.class)); ResolvedJavaType returnType = providers.getWordTypes().getWordImplType(); CallingConvention callingConvention = backend.getCodeCache().getRegisterConfig().getCallingConvention( SubstrateCallingConventionType.NativeCall, returnType, parameters.toArray(new JavaType[0]), backend); RegisterValue methodIdArg = (RegisterValue) callingConvention.getArgument(parameters.size() - 1); return backend.createJNITrampolineMethod(method, identifier, methodIdArg, getFieldOffset(providers)); }; }
@Override public RegisterAllocationConfig newRegisterAllocationConfig(RegisterConfig registerConfig, String[] allocationRestrictedTo) { RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; return new RegisterAllocationConfig(registerConfigNonNull, allocationRestrictedTo); }
@Override public <T extends Architecture> Backend getBackend(Class<T> arch) { assert arch.isInstance(GraalSupport.getRuntimeConfig().getBackendForNormalMethod().getTarget().arch); return GraalSupport.getRuntimeConfig().getBackendForNormalMethod(); } }
@Platforms(Platform.HOSTED_ONLY.class) public static void setRuntimeConfig(RuntimeConfiguration runtimeConfig, Suites suites, LIRSuites lirSuites, Suites firstTierSuites, LIRSuites firstTierLirSuites) { get().runtimeConfig = runtimeConfig; get().suites = suites; get().lirSuites = lirSuites; get().firstTierSuites = firstTierSuites; get().firstTierLirSuites = firstTierLirSuites; get().firstTierProviders = runtimeConfig.getBackendForNormalMethod().getProviders(); }
LIRSuites lirSuites = method.compilationInfo.isDeoptTarget() ? deoptTargetLIRSuites : regularLIRSuites; CompilationResult result = backend.newCompilationResult(compilationIdentifier, method.format("%H.%n(%p)")); GraalCompiler.compileGraph(graph, method, backend.getProviders(), backend, null, optimisticOpts, method.getProfilingInfo(), suites, lirSuites, result, new HostedCompilationResultBuilderFactory(), false);
@SuppressWarnings("unused") private static Suites modifySuites(SubstrateBackend backend, Suites suites, FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, SnippetReflectionProvider snippetReflection, boolean hosted, boolean firstTier) { Providers runtimeCallProviders = backend.getProviders();
OptionValues options = hosted ? HostedOptionValues.singleton() : RuntimeOptionValues.singleton(); Providers runtimeCallProviders = runtimeConfig != null ? runtimeConfig.getBackendForNormalMethod().getProviders() : providers; SubstrateForeignCallsProvider foreignCallsProvider = (SubstrateForeignCallsProvider) providers.getForeignCalls(); for (SubstrateForeignCallDescriptor descriptor : SnippetRuntime.getRuntimeCalls()) {
((HostedProviders) runtimeConfig.getProviders()).setGraphBuilderPlugins(plugins); for (SubstrateBackend backend : runtimeConfig.getBackends()) { ((HostedProviders) backend.getProviders()).setGraphBuilderPlugins(plugins);
Providers providers = runtimeConfig.lookupBackend(method).getProviders(); new CanonicalizerPhase().apply(graph, new PhaseContext(providers));
HostedProviders providers = (HostedProviders) config.lookupBackend(method).getProviders(); boolean needParsing = false; OptionValues options = HostedOptionValues.singleton();