RFR: 8350550: Preload classes from AOT cache during VM bootstrap

Ioi Lam iklam at openjdk.org
Fri Aug 22 04:19:52 UTC 2025


On Wed, 20 Aug 2025 16:59:45 GMT, Dan Heidinga <heidinga at openjdk.org> wrote:

>> src/java.base/share/classes/java/net/URL.java line 1768:
>> 
>>> 1766: 
>>> 1767:     @AOTRuntimeSetup
>>> 1768:     private static void runtimeSetup() {
>> 
>> Slightly concerned with this for reasons I'm still trying to track down - Mostly around the `URLStreamHandler` that each URL instance holds onto.
>> 
>> Can we create cases were the cached URLStreamHandler for a URL from the assembly phase would be different than the URLStreamHandler looked up in the production run?
>
> Are there limits on the types of URLs we allow in the archived heap?  ie: only file or jar?

This code basically adds an entrypoint in the `SharedSecrets` class for other JDK core lib classes to call into package-private API in this package. It doesn't do anything else.

There are several other classes where we have to do the same `SharedSecrets` set-up.


    @AOTRuntimeSetup
    private static void runtimeSetup() {
        SharedSecrets.setJavaNetURLAccess(
                new JavaNetURLAccess() {
                    @Override
                    public URLStreamHandler getHandler(URL u) {
                        return u.handler;
                    }
                }
        );
    }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2292648610


More information about the hotspot-dev mailing list