Nicer way of interacting with upcalls?

Mark Hammons markehammons at gmail.com
Mon Jan 24 14:53:19 UTC 2022


Hi Panama development team!

Recently, I released v0.1.0 of my library Slinc(
https://mhammons.gitlab.io/slinc/blog/2021/01/22/V0-1-0-Released.html), and
so far using the foreign interface has been great. However, there's one
incongruity that really bugged me. Upcalls do not behave like other types
in foreign. For all the other types that can be passed to C, I've been able
to separate allocation of native space and writing data to native space.
The process to create an upcall does both at once though, which makes it
weird compared to other types (for example, can't replace an upcall without
copying (at least temporarily) the new upcall to an unrelated address. Is
there any way this could be rectified?

To be clear, I'd like two things if it's possible to add them: 1. a method
or memory layout that can take a function descriptor and let me know the
byte size needed to store 2. a method in MemoryAccess for writing a method
handle (or maybe have upcall take a memory address/segment that it write
stuff to).

If I had these two things, function pointers in my library would not be a
special case anymore.

Thanks in advance for the great addition to the java standard library,
looking forward to the improvements in java 18!

~Mark Hammons


More information about the panama-dev mailing list