I wrote a small static JNI function which is only 5 instructions long. Is it possible for the JVM to inline this code into the body of a method which calls it frequently or will it always generate a call
instruction in the JITed method?
For example:
public class SomeClass {
private static native long func();
public void doLoop() {
for(int i = 0; i < 0xFFFFFF; i++) {
func();
}
}
public static void main(String[] args) {
for(int i = 0; i < 0xFFFFFF; i++) {
doLoop();
}
}
}
Is it possible for the JVM to inline the code of func
into doLoop
or will it just compile it as call func