Short feedback on the linker (CLinker)
Ty Young
youngty1997 at gmail.com
Mon Dec 21 12:55:41 UTC 2020
On 12/21/20 5:32 AM, Maurizio Cimadamore wrote:
>
>>
>> Tcl:
>> ----
>> Works great so far.
>>
>> Tcl uses something called ClientData (just a typedef for void*) to
>> pass application specific structures around. It doesn't try to
>> dereference that pointer. The ClientData is only passed to upcalls.
>>
>> It might be nice to be able to get a "handle" for a java object -
>> otherwise you have to implement the bookkeeping yourself.
>>
>> It would avoid creating new downcall handles just because you changed
>> one
> We have in the past discussed ways to "pin" heap memory, so that heap
> addresses could stay stable across a native call. This would be useful
> to implement logic like the one currently implemented in JNI critical
> sections, but I think it would always help in your case. That said,
> pinning heap objects would need to be made an unsafe operation (e.g.
> foreign restricted), given that it has the potential to undermine the
> correct behavior of the garbage collector, if abused. But yes,
> obtaining pointers from Java objects is something that is on our radar
> - it's technically not too hard to do that - the safety implication
> are the difficult part (as in many other areas of this project).
Drive by question: would it be possible to share this pointer in a
mapped file and get a usable Java object with it between or the same
JVMs? For example, controlling a JavaFX button via struct functions
including life cycle(struct liveliness == button liveliness)? It would
be really nice if this was possible.
>
> Cheers
> Maurizio
>
>>
>> - Johannes
More information about the panama-dev
mailing list