Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass
Mandy Chung
mandy.chung at oracle.com
Tue May 11 20:39:48 UTC 2021
Hi Attila,
Thanks for the input. I added the Nashorn use case in JDK-8212620.
Mandy
On 5/11/21 3:41 AM, Attila Szegedi wrote:
> I'm fine with the removal, although if you remember we use it in
> Nashorn too[0], and when I tried to replace it with the hidden classes
> facility the issue we run into was that hidden classes' methods didn't
> show up in stack traces the way anonymous classes' methods did[1].
> Since Nashorn uses anonymous classes to install compiled JavaScript
> application code, it is important to be able to report stack traces
> from them. It unfortunately can't just use StackWalker, as it has to
> post-edit traces of already thrown exceptions.
>
> So ensuring JDK-8212620 is implemented as well, and/or maybe having
> a MethodHandles.Lookup.ClassOption to specify the class should show up
> in stack traces would be important to implement alongside the removal.
> It's not a show-stopper, Nashorn will be able to gracefully fail over
> to ordinary class loading in absence of anonymous class loading, but
> I'd really like to be able to transition to using hidden classes if we
> could get them to show up in stack traces.
>
> Attila.
>
> [0]
> https://github.com/openjdk/nashorn/blob/main/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/runtime/Context.java#L329
> <https://urldefense.com/v3/__https://github.com/openjdk/nashorn/blob/main/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/runtime/Context.java*L329__;Iw!!GqivPVa7Brio!LQB5qhHavp8DtWhCLdw4CJAYuNYZhhEGY65H9uA3sx_xqMOriXmvlH9VQibTLkCtHQ$>
> [1]
> https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007578.html
> <https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007578.html>
>
> On Tue, May 11, 2021 at 1:03 AM Mandy Chung <mandy.chung at oracle.com
> <mailto:mandy.chung at oracle.com>> wrote:
>
> Thank you all.
>
> Mandy
>
> On 5/10/21 2:27 PM, Paul Sandoz wrote:
> > Looks good, I took the liberty of making some minor edits,
> mostly fixing some typos.
> >
> > Paul.
> >
> >> On May 10, 2021, at 12:26 PM, Mandy Chung
> <mandy.chung at oracle.com <mailto:mandy.chung at oracle.com>> wrote:
> >>
> >> Hidden classes were added in Java SE 15. Class data support was
> added in 16. `sun.misc.Unsafe::defineAnonymousClass` was
> deprecated in JDK 15 and deprecated for terminally removal in JDK 16.
> >>
> >> I propose to remove `sun.misc.Unsafe::defineAnonymousClass`
> from JDK 17:
> >> CSR: https://bugs.openjdk.java.net/browse/JDK-8266760
> <https://bugs.openjdk.java.net/browse/JDK-8266760>
> >>
> >> Comments?
> >>
> >> Mandy
>
More information about the core-libs-dev
mailing list