3 ms·
What do you mean by "does absolutely nothing"? It does something, namely load a dynamic library that presumably implements its methods. Now maybe that library h
by tom_mellior 5y ago
What do you mean by "does absolutely nothing"? It does something, namely load a dynamic library that presumably implements its methods. Now maybe that library has never done anything, but that's impossible to tell from the code you linked.
- twic 5y agoI mean that the native methods it ultimately calls do nothing, and never have. The early versions of the JVM didn't include a compiler, they were purely interpreting, so those calls had to be no-ops. Later versions included a JIT, but the decision of which classes and methods to compile was made by the JVM, and again, those calls were no-ops. As far as i know, there was never a JVM from Sun / Oracle where those methods did anything. It's possible that IBM's or some of the other JVMs did something with those calls. But in general, having user code be involved in the decision of which methods to JIT is the wrong approach. I vaguely remember that in the 1.0 era, the plan was that JIT compilers would be third-party plug-ins to the Sun JVM. So you'd buy a compiler from, say, Borland, install it into your JVM installation, and then when java.lang.Compiler was used, it would load your shiny new Borland compiler, which would somehow magically interact with the JVM to compile bytecode. I never heard of this happening. There wasn't a published JVM API for the compiler to talk to, so it would have required a lot of close cooperation between Sun and the compiler vendor.