groostav
08/14/2017, 9:31 PMnullptr since most of our return values are arrays. Our fortran code then tries to index into that array which then causes SIG_SEGV.
I read somewhere that one of the performance optimizations the java does is implicit null pointer violations, where it will actually simply incur a SIG_SEGV, capture it, and raise a NullPointerException in java-friendly exception fashion. Can I do this? Thus I want something like:
1. Java starts
2. Java creates a dynamic proxy into a dll
3. java -> proxy -> dll
4. dll attempts to invoke a callback
5. java -> proxy -> dll -> java callback
6. the java callback throws an exception, this is handled by JNA and null is returned to the dll
7 java -> proxy -> dll -> (null from callback)
8. the native code attempts to index into the null value
9. some device captures the SIG_SEGV, and "jumps" over all the native code back up to a device in the proxy, and sets the isInException flag on the appropriate jvm thread
10.java -> proxy -> throws exception
11. what comes back to the Java side caller of the dll is a standard looking exception
does anybody know how to do something like this (with kotlin native or otherwise)?
--also, I assume that the native code will use the same stack pointer as java does, and thus this jump should be stack-memory-safe since that memory will be reclaimed by the standard stack-memory means. Heap memory ofc is a different issue but we can tidy that up by other means.
Is this sane? Can it be done? can any Clang-gurus here point me in the right direction?