Can't yield from within an instance created by reflection
forax at univ-mlv.fr
forax at univ-mlv.fr
Tue Apr 6 12:43:02 UTC 2021
> De: "Øystein Myhre Andersen" <o.myhre at gmail.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "loom-dev" <loom-dev at openjdk.java.net>
> Envoyé: Mardi 6 Avril 2021 14:38:51
> Objet: Re: Can't yield from within an instance created by reflection
> Thank you for the clarification. I will try rewriting the code. I will let you
> know later.
> - Øystein
Ok, cool !
Rémi
> On Tue, Apr 6, 2021 at 2:20 PM Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:
>> ----- Mail original -----
>>> De: "Øystein Myhre Andersen" < [ mailto:o.myhre at gmail.com | o.myhre at gmail.com ]
>> > >
>>> À: "loom-dev" < [ mailto:loom-dev at openjdk.java.net | 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