Can't yield from within an instance created by reflection

Øystein Myhre Andersen o.myhre at gmail.com
Tue Apr 6 12:38:51 UTC 2021


Thank you for the clarification. I will try rewriting the code. I will let
you know later.

 - Øystein

On Tue, Apr 6, 2021 at 2:20 PM Remi Forax <forax at univ-mlv.fr> wrote:

> ----- Mail original -----
> > De: "Øystein Myhre Andersen" <o.myhre at gmail.com>
> > À: "loom-dev" <loom-dev at openjdk.java.net>
> > Envoyé: Mardi 6 Avril 2021 13:51:39
> > Objet: Can't yield from within an instance created by reflection
>
> > From: Øystein Myhre Andersen.
> >
> > Can't yield from within an instance created by reflection
>
> Constructor.newInstance() is using NativeConstructorAccessorImpl which
> calls a C code that will invoke the constructor,
> so once you are in the constructor you have a C function stack just below
> you on the stack.
> The current implementation can only yield if there is no C function on the
> stack because yield copy the content on the stack and a C function may
> contain pointer to the stack that will be invalid when the content of the
> stack is copied back.
>
> A simple solution is to not use Constructor.newInstance but
> MethodHandle.invoke() from a Lookup.findConstructor(),
> as far as i know, it doesn't use a C function to call the constructor so
> it should be fine.
>
> regards,
> Rémi
>


More information about the loom-dev mailing list