All, Some of API methods like java/lang/Math or Integer/Long bits related ones on some platforms could be replaced with effective native instructions. I call these methods API magics, because they are close to vmmagics we use to inline VM helper: when a set of known Java methods is replaced by JIT with associated native code. Some of API magics like Math.min/max/abs are processed in translator to HIR -> they have analogous ops in HIR. In http://issues.apache.org/jira/browse/HARMONY-2778 I have added codegenerator's part of the framework for the methods that have LIR analogues. Now code contains inlining for some bits manipulation methods for IA32/EM64T platform for Integer and Long classes. I chose these methods because of the SpecJBB2000 impact (rather small but measurable).
I'm asking to review the code of fast-path methods versions and to collect the whole list of API magics JIT can inline. The implementation of new "api magics" could be an interesting task for new JIT developers. AFAIK the current list is *java/lang/Math:[any platform] max min abs *java/lang/Integer:[x86] numberOfTrailingZeros numberOfLeadingZeros *java/lang/Long:[x86] numberOfTrailingZeros numberOfLeadingZeros So it's very, very short today. -- Mikhail Fursov
