Trying to implement the approach described in there (see comment): Is it possible to use sun.misc.Unsafe to call C functions without JNI?
but can't get my JavaCritical_ method called.
this is the JNI part
JNIEXPORT void JNICALL JavaCritical_blas_BLAS_a(jint, jdouble *na) {
printf("!v!\n");
}
JNIEXPORT void JNICALL Java_blas_BLAS_a(JNIEnv *env, jclass, jdoubleArray a) {
}
and this is Java:
public class BLAS {
public static native void a(double[] a);
}
if I run my program with -XX:+TieredCompilation -XX:+PrintCompilation, I get this
3475 1488 n 0 blas.BLAS::a (native) (static)
and "!v!" is not printed. As I understand, "n" in the output means that JVM uses wrapper around Java_xx method of the JNI, not the CriticalJava one.
So can anyone suggest what do I do wrong? Btw, I run it under JVM v1.8.0_152 x86 mode under x64 bit Windows 10.