Closed jrobsonchase closed 7 years ago
Thanks!
It seems a bit unfortunate to have to unwrap function pointers everywhere - will the JVM actually null out any of those pointers? I guess it might things that aren't supported on that JVM version?
That I don't know - I'm assuming that later JVMs simply add functions to the end of the struct, so an attempt to access an invalid function for your JVM would technically be out-of-bounds since the struct that your JNIEnv pointer points to would be shorter.
So you'd either get uninitialized data that doesn't point anywhere (or to somewhere else entirely), or they might have anticipated adding more functionality later and allocated/zeroed a much larger structure than needed, in which case, it would actually be null pointers.
Unless benchmarks show that the unwrapping causes a nontrivial performance penalty, I figure better safe than sorry.
Oh yeah, performance isn't the concern at all. I still hate that we have to option wrap function pointers in FFI, but here we are. :P
Anything else you want to get in before I cut an 0.2 release?
Nope, I'm good 👍
Done!
std::os::raw
for C typesOption
for the function pointers on theJNINativeInterface_
struct