Arthur Peters wrote: > I'm a lurker, but I have a question. > > What makes guardWithTest better or faster than simply using a method > handle of a method with an if statement in it? > > Like: > Object meth(...args...) { > if(pred) > guard; > else > callTargetMethod; > } > > Can the JVM optimize the guardWithTest version better? Does it handle > primitive types better?
I believe the primary difference is that the JVM can "know" about guardWithTest and therefore it will not interfere in optimization/inlining of the associated handles. Writing your own Java implementation would introduce a single generic piece of code into many/most/all call paths, obscuring any unique, inlinable path. - Charlie _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev