On Tue, 23 Jan 2024 19:16:49 GMT, Doug Simon <dnsi...@openjdk.org> wrote:

>> This PR changes `jdk.internal.vm.ci` such that it is loaded by the platform 
>> class loader instead of the boot class loader. This allows Native Image to 
>> load a version of JVMCI different than the version on top of which Native 
>> Image is running. This capability is demonstrated and tested by 
>> `LoadAlternativeJVMCI.java`.
>
> Doug Simon has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   use null to denote boot class loader as delegation parent

The actual changes to load JVMCI via the platform loader seem fine.

I'm still puzzled by the need to do this as any non-delegating classloader 
would have allowed this even if JVMCI were loaded by the bootloader. And I 
don't understand how your test is working as it is using a delegating 
classloader.

test/hotspot/jtreg/compiler/jvmci/LoadAlternativeJVMCI.java line 54:

> 52: 
> 53:         ClassLoader pcl = ClassLoader.getPlatformClassLoader();
> 54:         URLClassLoader ucl = new URLClassLoader(cp, null);

I am missing something here, a `URLClassLoader` first delegates to its parent 
before searching its URLs, so how does this not find the platform loader 
versions of the JVMCI classes?

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

PR Review: https://git.openjdk.org/jdk/pull/17520#pullrequestreview-1840477028
PR Review Comment: https://git.openjdk.org/jdk/pull/17520#discussion_r1464348710

Reply via email to