Re:JITs are un-ergonomic
by pgrulich on Sunday March 29, 2020 @04:56AM
(#22717403)
So for getters and setters a Jit can inline the function call and in the end you have a direct memory access.
In your example you have to cast because URLConnection could be a HttpURLConnection or JarURLConnection.
But again a good Jit would speculate that it is always a HttpURLConnection and deoptimize if not.
[ Parent
| on HN ]
Re:JITs are un-ergonomic
by imtringued on Sunday March 29, 2020 @09:29AM
(#22718843)
The JVM also has full information about the class hierarchy at runtime. If you add a class that overrides a function it will deoptimize that overriden function to a virtual function but otherwise the JVM will just treat it as a static function and inline it if necessary.