RFR: 8327624: Remove VM implementation that bypass verification for core reflection [v2]

David Holmes dholmes at openjdk.org
Fri Oct 18 02:37:40 UTC 2024


On Thu, 17 Oct 2024 22:44:05 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> The old core reflection implementation generates dynamic classes that are special cases in the VM to bypass bytecode verification to workaround various issues [1] [2] [3].
>> 
>> The old core reflection implementation was [removed in JDK 22](https://bugs.openjdk.org/browse/JDK-8305104).   It's time to remove these VM hacks along with the old implementation of  `sun.reflect.ReflectionFactory::newConstructorForSerialization`.   
>> 
>> After this change, `jdk.internal.reflect.DelegatingClassLoader` no longer exists.   Hence the special metaspace for reflection is no longer needed.  GTests will need to be updated when `Metaspace::ReflectionMetaspaceType` is removed.  Such clean up can be done separately (JDK-8342561).
>> 
>> [1] [JDK-4486457](https://bugs.openjdk.org/browse/JDK-4486457)
>> [2] [JDK-4474172](https://bugs.openjdk.org/browse/JDK-4474172)
>> [3] [JDK-6790209](https://bugs.openjdk.org/browse/JDK-6790209)
>
> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove unused classes

Nice cleanup! Great to see all this old code go. Just one mistake ...

Thanks

src/hotspot/share/classfile/classFileParser.cpp line 4098:

> 4096:       }
> 4097:     }
> 4098: 

This code should not be removed. The spec for this code should now be:

  // If the loader is not the boot loader then throw an exception if its
  // superclass is in package jdk.internal.reflect 

All we need do is remove the check:

&& !java_lang_ClassLoader::is_reflection_class_loader

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21571#pullrequestreview-2376812107
PR Review Comment: https://git.openjdk.org/jdk/pull/21571#discussion_r1805745905


More information about the core-libs-dev mailing list