public static HomeFinder getInstance() { if (TruffleOptions.AOT) { return nativeImageHomeFinder; } return Truffle.getRuntime().getCapability(HomeFinder.class); }
/** * Looks up the {@link HomeFinder} instance. * * NOTE: this method is called reflectively by downstream projects. * */ @SuppressWarnings("unused") private static void initializeNativeImageState() { assert TruffleOptions.AOT : "Only supported during image generation"; nativeImageHomeFinder = Truffle.getRuntime().getCapability(HomeFinder.class); }
@SuppressWarnings("unused") private static void initializeNativeImageState() { assert TruffleOptions.AOT : "Only supported during image generation"; nativeImageLocator = Truffle.getRuntime().getCapability(TruffleLocator.class); }
private static LayoutFactory loadLayoutFactory() { LayoutFactory layoutFactory = Truffle.getRuntime().getCapability(LayoutFactory.class); if (layoutFactory == null) { ServiceLoader<LayoutFactory> serviceLoader = ServiceLoader.load(LayoutFactory.class, Layout.class.getClassLoader()); layoutFactory = selectLayoutFactory(serviceLoader); if (layoutFactory == null) { throw new AssertionError("LayoutFactory not found"); } } return layoutFactory; }
private static LayoutFactory loadLayoutFactory() { LayoutFactory layoutFactory = Truffle.getRuntime().getCapability(LayoutFactory.class); if (layoutFactory == null) { ServiceLoader<LayoutFactory> serviceLoader = ServiceLoader.load(LayoutFactory.class, Layout.class.getClassLoader()); layoutFactory = selectLayoutFactory(serviceLoader); if (layoutFactory == null) { throw new AssertionError("LayoutFactory not found"); } } return layoutFactory; }
/** * Creates the set of classloaders to be used by the system. * * @return set of classloaders to search registrations in */ public static Set<ClassLoader> loaders() { Iterable<TruffleLocator> allLocators; TruffleLocator locator = Truffle.getRuntime().getCapability(TruffleLocator.class); if (locator != null) { allLocators = Collections.singleton(locator); } else { allLocators = Collections.emptyList(); } Set<ClassLoader> found = new LinkedHashSet<>(); Response response = new Response(found); for (TruffleLocator test : allLocators) { test.locate(response); } found.add(ClassLoader.getSystemClassLoader()); found.add(TruffleLocator.class.getClassLoader()); return found; }
static TruffleTestInvoker<?, ?> create() { TVMCI.Test<?, ?> testTvmci = Truffle.getRuntime().getCapability(TVMCI.Test.class); return new TruffleTestInvoker<>(testTvmci); }
static TruffleTestInvoker<?> create() { TVMCI.Test<?> testTvmci = Truffle.getRuntime().getCapability(TVMCI.Test.class); return new TruffleTestInvoker<>(testTvmci); }
/** * Creates the set of classloaders to be used by the system. * * @return set of classloaders to search registrations in */ public static Set<ClassLoader> loaders() { Iterable<TruffleLocator> allLocators; TruffleLocator locator = Truffle.getRuntime().getCapability(TruffleLocator.class); if (locator != null) { allLocators = Collections.singleton(locator); } else { allLocators = Collections.emptyList(); } Set<ClassLoader> found = new LinkedHashSet<>(); Response response = new Response(found); for (TruffleLocator test : allLocators) { test.locate(response); } found.add(ClassLoader.getSystemClassLoader()); found.add(TruffleLocator.class.getClassLoader()); return found; }