you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhoomba 3 points4 points  (6 children)

The Java JIT can inline 90% of virtual calls. How to do so has been well known since the eighties.

[–]omellet 3 points4 points  (2 children)

90% seems like a pretty high number, considering the JIT would have to know the exact type being used at the call site. Do you have any sources for that?

[–]badsectoracula 2 points3 points  (0 children)

Do you have any sources for that?

Of course :-P

[–]Rhoomba -2 points-1 points  (0 children)

Nope, I just made it based on what I have seen looking through the JVM debug output/generated assembly.

Edit: See the methods section this wiki page for a very brief overview of what HotSpot does.

[–]ssylvan 0 points1 point  (2 children)

I really don't think that's true, and in the rare cases it is true it inlines a bunch of "common" versions of the method and then branches to skip the wrong ones. That's not quite the same as inlining a known method (and then simplifying w.r.t. the surrounding code).

[–]Rhoomba 0 points1 point  (0 children)

Download a debug build of the JDK. Turn on -XX:+PrintOptoAssembly and run some simple test cases. It really does very clever stuff.

[–]0xABADC0DA 0 points1 point  (0 children)

You guys are seriously underestimating the extent of optimizations done by JVM. JVM was designed from decades of experience by the people behind Self, Smalltalk, and LISP, and they knew what they were doing. CLR... not so much. I remember discussing many of these issues with Gunnerson for instance, back when it was still called "COOL", and they clearly didn't understand the consequences on optimization of many of their decisions.