A method, apparatus, and computer instructions are provided for inlining
native functions into compiled Java code. A conversion engine is provided
by the present invention for converting the intermediate representation
of native functions to the just-in-time (JIT) compiler's intermediate
representation. With the converted intermediate representation, an
inliner recursively inlines the converted JIT compiler's intermediate
representation into the native callsite to remove the need of invoking
the native function and subsequent native calls made by the function. The
inlining process continues until either a call to an opaque function is
encountered or until a JIT compiler intermediate representation growth
limits are reached. The inliner also replaces calls to most native
functions that are non-inlineable or opaque with calls to synthesized
native functions that provide access to native libraries containing
implementations of the original non-inlineable calls.