Re: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-11 Thread Mandy Chung

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 

[1] 
https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007578.html 



On Tue, May 11, 2021 at 1:03 AM Mandy Chung > 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
mailto:mandy.ch...@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

>>
>> Comments?
>>
>> Mandy





Re: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-11 Thread Attila Szegedi
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
[1]
https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007578.html

On Tue, May 11, 2021 at 1:03 AM Mandy Chung  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 
> 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
> >>
> >> Comments?
> >>
> >> Mandy
>
>


Re: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-10 Thread Mandy Chung

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  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

Comments?

Mandy




Re: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-10 Thread Paul Sandoz
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  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
> 
> Comments?
> 
> Mandy



Re: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-10 Thread Remi Forax
- Mail original -
> De: "mandy chung" 
> À: "core-libs-dev" , "valhalla-dev" 
> 
> Envoyé: Lundi 10 Mai 2021 21:26:33
> Objet: Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

> 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
> 
> Comments?

Do it.

I will be brave and not cry too much :)

> 
> Mandy

Rémi


Review CSR JDK-8266760: Remove sun.misc.Unsafe::defineAnonymousClass

2021-05-10 Thread Mandy Chung
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

Comments?

Mandy