Alex Rivera | Logout

Does JVM has its runtime branch prediction? If so, is there a way in Java code to hint branch results?

Asked 2012-07-16T23:33:27.843
8

As the title says:

I remember that in some C compilers (such as GCC), we're able to give hint to compiler about likely branch prediction results. Does JVM have such function?

Thank you!

Edit
Report

1 Answer

6

Unless there's some new annotation that's escaped me, no.

On the other hand, it's not clear how terribly useful such a feature would be. Remember that, unlike a language such as C/C++, "prediction" at the level of the source code isn't necessarily the best strategy because What The Code Is Actually Doing In Practice as it is running isn't a mystery: the JVM can potentially monitor critical behaviour and if necessary re-compile sections of code in accordance with its measurements.

answered 2012-07-16T23:47:26.063

Your Answer