/** * 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 void initializeNativeImageTruffleLocator() { assert TruffleOptions.AOT : "Only supported in AOT mode."; if (nativeImageLocator != null) { if (ImageInfo.inImageBuildtimeCode() || NATIVE_IMAGE_LOCATOR_INITIALIZED.compareAndSet(false, true)) { nativeImageLocator.locate(new Response(new HashSet<>())); } } }
/** * 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; }