Making native calls from the JVM
Samuel Audet
samuel.audet at gmail.com
Wed Dec 17 04:26:08 UTC 2014
On 12/16/2014 07:35 PM, John Rose wrote:
> On Dec 16, 2014, at 2:21 AM, John Rose <john.r.rose at oracle.com> wrote:
>>
>> Here are some thoughts on building native calls from inside the JVM. Comments, please? This paper is a WIP. — John
>
>
> P.S. A good HTML rendering is here:
> http://cr.openjdk.java.net/~jrose/draft/native-call-primitive.html
>
Thanks for writing down your thoughts! Always interesting to hear about
what's happening on that front.
I appreciate how problematic it can be to call efficiently native C
functions, but I'm still wondering where C++ fits in all this. The way I
see it, when needing to call some C++ function, we are still going to
have to write wrappers manually in C, so in that case I fail to see the
advantage libffi and JNR have over plain old JNI. Any thoughts about that?
About safety, even if native function calls are made distinct somehow, I
feel we are going to run into issues where higher-end users start making
calls to wrapper libraries that make use of "unsafe" function calls. If
the low-level developers fails to make the "unsafe" layer safe, then
anything using libraries this way can potentially crash the JVM. This
has been an issue from day one with C#'s unsafe context, whose use cases
BTW have a lot in common with JNI. Both can be restricted by the end
user's security settings, for applets and what not. Can we do better
than that? I don't know... Anyway, if C# is still having problems
dealing with this even after tagging everything, I feel we should be
thinking of dealing with this in some other way...
Samuel
More information about the panama-dev
mailing list