<<

US 20060190934A1 (19) United States (12) Patent Application Publication (10) Pub. No.: US 2006/0190934 A1 Kielstra et al. (43) Pub. Date: Aug. 24, 2006

(54) METHOD AND APPARATUS FOR INLINING Publication Classi?cation NATIVE FUNCTIONS INTO COMPILED CODE (51) Int. Cl. G06F 9/45 (2006.01) (52) US. Cl...... 717/148 (75) Inventors: Allan Henry Kielstra, Ajax (CA); Levon Sassoon Stepanian, Toronto (CA); Kevin Alexander Stoodley, (57) ABSTRACT Richmond Hill (CA) A method, apparatus, and computer instructions are pro vided for inlining native functions into compiled Java code. Correspondence Address: A conversion engine is provided by the present invention for IBM CORP (YA) converting the intermediate representation of native func /O YEE & ASSOCIATES PC tions to the just-in-time (JIT) compiler’s intermediate rep PO. BOX 802333 resentation. With the converted intermediate representation, DALLAS, TX 75380 (US) 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 (73) Assignee: International Business Machines Cor native calls made by the function. The inlining process poration, Armonk, NY continues until either a call to an opaque function is encoun tered or until a JIT compiler intermediate representation groWth limits are reached. The inliner also replaces calls to (21) Appl. No.: 11/062,293 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 (22) Filed: Feb. 18, 2005 non-inlineable calls. 100 Patent Application Publication Aug. 24, 2006 Sheet 1 0f 6 US 2006/0190934 A1

100 \ x104

C558" 202 208 204 216 \ \ I \ -/ / HOST/PCI MAIN AUDIO PROCESSOR CACHE/BRIDGE MEMORY ADAPTER BUS ? 1? < U> 206/ l} U U ii > SCSI HOST LAN EXPQFEION GRAPH'CS é/Lfgég/ BUS ADAPTER ADAPTER INTERFACE ADAPTER ADAPTER / F \ \ \ 212 210 214 218 219 < ' ' > < U > DISK /226 U U 220\ KEYBOARD AND TAPE MOUSE ADAPTER MODEM MEMORY \ 228 CD Rom \ \ ' \230 FIG. 2 222 224 Patent Application Publication Aug. 24, 2006 Sheet 2 0f 6 US 2006/0190934 A1 /3OO 304 \ PLATFORM [302 6 JAVA VIRTUAL SPECIFIC \ MACHINE (JVM) OPERATING ‘ JAVA SYSTEM FIG 3 APPLICATION/APPLET -

402\ CLASS LOAOER SUBSYSTEM HEILLQES 400 '

410 416 418 420 422 424 \ \ \ / / / MEMORY hg'éiTTk'éEn JAVA PC METHOD HEAP MANAGEMENT STACKS STACKS REGIsTERs AREA

RuNTIME DATA AREAS 404/4 ? i} I 406/ EXECUTION ENGINE v NATIvE NATIvE COMPILER < > METHOD <—METFIOO FIG' 4 INTERFACE LIBRARIES / \ \ 414 412 408 Patent Application Publication Aug. 24, 2006 Sheet 3 0f 6 US 2006/0190934 A1

500 504 502 506 508 \ / / NATIvE CODE INTERNAL a = b + C; NAT'VE 'R CONVERSION JIT IR ENGINE

FIG. 5

602\ NATIVE CALLSITE 11”", NATNE IR /606

II \ \ IN ENCOUNTERS v

JIT COMPILER / CONVERSION 600 INLINER ENGINE 604

INLINES OUT

V ’ V zz” INTERNAL NATIVE CALLSITE' :: \ 610/ ~‘~\\_ JITIR 608 FIG. 6 Patent Application Publication Aug. 24, 2006 Sheet 4 0f 6 US 2006/0190934 A1

704

l l l I 703 NATIVE LIBRARY 1 / CONTAINING I z SYNTHESIZED IMPLEMENTATIONs ' <2 5’3 NATIVE FOR FUNCTIONS ' 6 i FUNCTION A A AND B

I B QLLI l E 5 SYNTHESIZED ' 5 <21 NATIVE \705 i <2‘ % FUNCTION B |: “gQ QE SYNTHESIZED O I Z = NATIvE I FUNCTION C NATIvE LIBRARY l \ CONTAINING l 707 IMPLEMENTATION l FOR FUNCTION 0 l | i 706 |

LIBRARY MEMORY SPACE

306 \ 812 800 JAVA FUN C TION '/ 810\ 802 SYNTHES'ZED N’ETI'IYIEIIKIZIF?SY NATIvE \ FUNCTION IMPLEMENTATION E z ifiiPFQP/WT'QN.PFFN'QXQZFE READ/WR'TE ( Q 7 // /// / /// // TOX Ez (2'- j////OPAOUE /////////// NATIvE CALL/ /\ 808 E E ~ ' 804 2 / \\ MEMORY FOR \ DATA ITEMX FIG. 8 Patent Application Publication Aug. 24, 2006 Sheet 5 0f 6 US 2006/0190934 A1

@ 900 RUN JIT COMPILER TO / FIG. 9 STANDARD INLINING PHASE

'II A CALL TO NATIVE / 902 FUNCTION IS ENCOUNTERED 904 ' OPAOUE NO FUNCTION CALL?

906 924 ORIGINAL FUNCTION CALL CALLSITE THAT YES FROM JAVA TO NATIVE STARTED INLINING CODE? PROCESS? 918 \ SYNTHESIZE NON-INLINEABLE CONvERT NATIvE IR TO / 908 NATIvE FUNCTION JIT COMPILER's IR

REPLACE FUNCTION CALL REPLACE NATIvE FUNCTION WITH CALL TO SYNTHESIZED CALL WITH ACTLIAL \ 910 NATIvE FUNCTION IIvIPLEIvIENTATION / I 920 MATERIALIZED JNIEnv POINTER Is PASSED T0 INLINED CODE \ 912

JIT CDMPILER YES 922 GROWTH LIMIT 7V / REACHED'? RESUME JIT COMPILER PROCESSING DOES INLINED CODE HAVE ANY MORE @ CALLS? YES Patent Application Publication Aug. 24, 2006 Sheet 6 of 6 US 2006/0190934 A1

class DummyCall \1000 public static native mt dummy(); \ 1002 public static void main(String [] args)\1004 FIG. 1 0A { int x = dummy() + dummy(); } / \ \ } 1006 1008 1010

#include #include "DummyCallh" 1/020 JNIEXPORTJimJNICALL?x??ovumgwrxlcité ggrgmy FIG, 10B { , return100; }

Method: (main)_/ 1030 Integer-store into automatic variable [] - Integer add 1032 E>o Function-callLoad-address tostatic[

] / 1 1;’) Function-call to method DummyCall.dummy()l \ 1034 o Load-address static[
]

Method: (maln)_/‘ 1040 Integer-store into automatic variable [] - integer100 add (NOTE: Function-call eliminated) F] 1 100 (NOTE: Function-call eliminated)

Method: (main) integer-store 200into automatic variable [] I US 2006/0190934 A1 Aug. 24, 2006

METHOD AND APPARATUS FOR INLINING as a Java application or applet on a Web Server, Where it can NATIVE FUNCTIONS INTO COMPILED JAVA be doWnloaded over a netWork to a user’s machine and CODE executed on a local JVM. [0008] The Java run-time environment is speci?cally CROSS-REFERENCE TO RELATED designed to limit the harm that a Java application can cause APPLICATION to the system that it is running on. This is especially important With the World Wide Web, Where Java applets are [0001] The present invention is related to the co-pending doWnloaded and executed automatically When a user visits application entitled “METHOD AND APPARATUS FOR a Web page that contains Java applets. Normally one Would TRANSFORMING JAVA NATIVE INTERFACE FUNC not Want to execute random programs; they might contain TION CALLS INTO SIMPLER OPERATIONS DURING viruses, or they might even be potentially malicious them JUST-IN-TIME COMPILATION”, Ser. no. , attor selves and not merely carrying unWelcome code uninten ney docket no. CA920050002US1 ?led on tionally. Unless the user speci?cally alloWs it (by setting the appropriate ?ags in the user-interface to the JVM), a Java BACKGROUND OF THE INVENTION applet cannot read or Write to attached storage devices [0002] 1. Technical Field (except perhaps to a speci?c, restricted area), nor can it read or Write to memory locations (except to a speci?c, restricted [0003] The present invention relates to an improved data area). processing system. In particular, the present invention [0009] Not only are Java applets designed for doWnload relates to Java native functions in a data processing system. ing over the network, standard Java libraries also speci? Still more particular, the present invention relates to inlining cally support client-server computing. The Java language Java native function calls in compiled Java code in a data includes provisions for multi-threading and for netWork processing system. communications. Compared to other languages (such as C), [0004] 2. Description of Related Art it is much easier to Write a pair of programs, one executing locally on the user’s computer that is handling the user [0005] Java is an object oriented programming language interaction, and the other executing remotely on a server, and environment focusing on de?ning data as objects and Which is performing potentially more sophisticated and the methods that may be applied to those objects. Java processor-intensive Work. supports only single inheritance, meaning that each class can [0010] While the Java language is designed to be plat inherit from only one other class at any given time. Java also form-independent, and to execute primarily in a secure alloWs for the creation of totally abstract classes knoWn as environment, programmers can extend Java applications interfaces, Which alloW the de?ning of methods that may be through the use of compiled native binary code on the host shared With several classes Without regard for hoW other operating system using C-style calling conventions through classes are handling the methods. Java provides a mecha the Java Native Interface (JNI). In this fashion, a Java nism to distribute softWare and extends the capabilities of a application can have complete access to the host operating Web broWser because programmers can Write an applet once system, including reading and Writing to attached I/O and the applet can be run on any Java enabled machine on devices, memory, etc. Because of this, Java programs can the Web. accomplish tasks that are not normally alloWed via the JVM [0006] The (JV M) is a virtual com at the cost of being platform-speci?c. HoWever, With a puter component that resides only in memory. The JVM Well-designed architecture, a Java language programmer can alloWs Java programs to be executed on different platforms cleanly isolate the platform-independent portion, and as opposed to only the one platform for Which the code Was present a clean, platform-independent object API to other compiled. Java programs are compiled for the JVM. In this Java components While at the same time accomplishing manner Java is able to support applications for many types platform-speci?c tasks. of data processing systems, Which may contain a variety of [0011] When invoking native function calls in the com central processing units and operating systems architectures. piled Java code through the JNI, overheads are associated. To enable a Java application to execute on different types of For example, Work must be performed at run time in order data processing systems, a compiler typically generates an to prepare the call for invocation. Generally, a native library architecture-neutral ?le formatithe compiled code is containing the native function must be loaded on or before executable on many processors, given the presence of the being called. The native function must also be resolved in Java run time system. The Java compiler generates Bytecode the runtime system, and related JV M data structures must be instructions that are non-speci?c to particular computer updated to indicate the use of the native function. architectures. A Bytecode is a machine independent code [0012] In addition, the JVM must also set up native stacks generated by the Java compiler and interpreted by a Java and/or registers according to the functional calling conven interpreter. A Java interpreter is a module in the JVM that tion of the underlying operating system architecture and alternatively decodes and executes a Bytecode or Bytecodes. perform null-checking on reference arguments. For some These Bytecode instructions are designed to be easy to JVMs, set up is also needed to add information for garbage interpret on any machine and easily translated on the ?y into collection. Upon returning from the native code, the used native . stack and/ or registers must be restored after the return value [0007] A development environment, such as the Java from the native code is returned to the Java runtime envi Development Kit (JDK) available from , ronment. Inc., may be used to build from Java language [0013] Several attempts have been made to minimize the source code and libraries. This Java Bytecode may be stored overhead of invoking native functions. The ?rst of Which are US 2006/0190934 A1 Aug. 24, 2006

programmer-based optimizations that put the onus on the [0020] Responsive to determining that the native function application programmer to practice ef?cient coding tech call is not to an opaque function, the inliner replaces the niques When Writing Java code that uses native functions. native function call With the actual implementation of the For example, batching native calls and passing as much data native function using the intermediate just-in-time compiler as possible to native code per function call, such that intermediate representation, and materializes a JN I environ boundary crossing in Java programs may be reduced. ment pointer and passes the pointer to the actual implemen tation of the native function call. [0014] Another attempt to minimize the overhead involves restricting the type of functionality offered in the native [0021] Responsive to determining that the native function code. For example, mechanisms Which bypass construction call is to an opaque function and that the native function call of special Wrapper code that Would otherWise be found does not represent a call from Java to a native function, the preceding native call frames on the call stack. HoWever, inliner synthesizes a neW call to a Java callable function such mechanisms can only be used for methods that are Whose purpose is to call the native function, and replaces the guaranteed not to require stack-Walking support, including original native function call With a call to the synthesized garbage collection, exception handling, synchronization or native function, Wherein the synthesized native function security, since these are services that the Wrapper code helps provides access to a native library containing the implemen to provide. tation of the opaque function target. [0015] In yet another attempt to minimize overhead, Work BRIEF DESCRIPTION OF THE DRAWINGS is performed to introduce unmanaged memory into the JVM [0022] The novel features believed characteristic of the by mapping Bytecodes to loW-level assembly statements. invention are set forth in the appended claims. The invention With high speed access to unmanaged memory, shared itself, hoWever, as Well as a preferred mode of use, further memory segments, memory mapped ?les, communication objectives and advantages thereof, Will best be understood and I/O bulfers and memory mapped hardWare devices may by reference to the folloWing detailed description of an be implemented. HoWever, this attempt does not recognize illustrative embodiment When read in conjunction With the and map long complex sequences of Bytecodes, or apply accompanying draWings, Wherein: mappings to virtual method invocations, since code map pings cannot handle dynamic class loading. [0023] FIG. 1 is a pictorial representation of a data processing system in Which the present invention may be [0016] While the above attempts minimize some overhead implemented in accordance With a preferred embodiment of of native function calls, each of the attempts has its oWn the present invention; draWback. Therefore, it Would be advantageous to have an [0024] FIG. 2 is a block diagram of a data processing improved method, apparatus, and computer instructions that system in Which the present invention may be implemented; target optimization of native function calls, in order to minimize the overhead. [0025] FIG. 3 is a block diagram illustrating a data processing system in Which the present invention may be SUMMARY OF THE INVENTION implemented; [0026] FIG. 4 is a block diagram of a JVM in accordance [0017] The present invention provides a method, an appa With a preferred embodiment of the present invention; ratus, and computer instructions for inlining native functions into compiled Java code. When a native function call in a [0027] FIG. 5 is a diagram illustrating a conversion pro Java program is detected, a conversion engine provided by cess for converting the intermediate representation of the the present invention is used to convert an intermediate native function to the JIT compiler’s intermediate represen representation of the native function to a just-in-time com tation in accordance With a preferred embodiment of the piler intermediate representation. Next, the just-in-time present invention; compiler intermediate representation is inlined into the Java [0028] FIG. 6 is a diagram illustrating one step in the native callsite by a J IT compiler inliner, and any native calls recursive native inlining process in accordance With a pre Which are contained in the inlined code are also recursively ferred embodiment of the present invention; inlined. [0029] FIG. 7 is a diagram illustrating synthesized native [0018] If, during inlining, the inliner determines that a functions in accordance With a preferred embodiment of the just-in-time compiler groWth limit is reached, a native call is present invention; made to an opaque function, or no additional native function [0030] FIG. 8 is a diagram illustrating linkage betWeen call is present in the native function implementation, the inlined and synthesized native functions in accordance With recursive inlining process terminates. An opaque function is a preferred embodiment of the present invention; one for Which the just-in-time compiler can not render an intermediate representation. [0031] FIG. 9 is a ?owchart of an exemplary process for inlining native functions into compiled Java code in accor [0019] The conversion engine converts the intermediate dance With a preferred embodiment of the present invention; representation of the native function by iterating through the intermediate representation (Which Was produced by the [0032] FIG. 10A is a diagram illustrating an exemplary high-level language compiler) and generating a just-in-time native function call in accordance With a preferred embodi compiler intermediate representation for each instruction in ment of the present invention; the intermediate representation. The intermediate represen [0033] FIG. 10B is a diagram illustrating an exemplary tation of the native function is retrieved from a native library native function call implemented in a non-Java language in containing both native binaries and the intermediate repre accordance With a preferred embodiment of the present sentation of the native function. invention; US 2006/0190934 A1 Aug. 24, 2006

[0034] FIG. 10C is a diagram illustrating an annotated 224. SCSI host bus adapter 212 provides a connection for tree-based intermediate representation Without inlining for hard disk drive 226, tape drive 228, and CD-ROM drive 230. the main method in the DummyCall class in accordance With Typical PCI local bus implementations Will support three or a preferred embodiment of the present invention; four PCI expansion slots or add-in connectors. [0035] FIG. 10D is a diagram illustrating an annotated [0039] An operating system runs on processor 202 and is tree-based intermediate representation With inlining for the used to coordinate and provide control of various compo main method in DummyCall class in accordance With a nents Within data processing system 200 in FIG. 2. The preferred embodiment of the present invention; and operating system may be a commercially available operating system such as WindoWs XP, Which is available from [0036] FIG. 10E is a diagram illustrating an optimiZed Microsoft Corporation. An object oriented programming tree-based intermediate representation With inlining for the system such as Java may run in conjunction With the main method in DummyCall class in accordance With a operating system and provides calls to the operating system preferred embodiment of the present invention. from Java programs or applications executing on the data processing system 200. “Java” is a trademark of Sun Micro DETAILED DESCRIPTION OF THE systems, Inc. Instructions for the operating system, the PREFERRED EMBODIMENT object-oriented programming system, and applications or [0037] With reference noW to the ?gures and in particular programs are located on storage devices, such as hard disk With reference to FIG. 1, a pictorial representation of a data drive 226, and may be loaded into main memory 204 for processing system in Which the present invention may be execution by processor 202. implemented is depicted in accordance With a preferred [0040] Those of ordinary skill in the art Will appreciate embodiment of the present invention. A computer 100 is that the hardWare in FIG. 2 may vary depending on the depicted Which includes system unit 102, video display implementation. Other internal hardWare or peripheral terminal 104, keyboard 106, storage devices 108, Which may devices, such as ?ash read-only memory (ROM), equivalent include ?oppy drives and other types of permanent and nonvolatile memory, or optical disk drives and the like, may removable storage media, and mouse 110. Additional input be used in addition to or in place of the hardWare depicted devices may be included With personal computer 100, such in FIG. 2. Also, the processes of the present invention may as, for example, a joystick, touchpad, touch screen, track be applied to a multiprocessor data processing system. ball, microphone, and the like. Computer 100 can be imple mented using any suitable computer, such as an IBM eServer [0041] For example, data processing system 200, if computer or IntelliStation computer, Which are products of optionally con?gured as a netWork computer, may not International Business Machines Corporation, located in include SCSI host bus adapter 212, hard disk drive 226, tape Armonk, NY. Although the depicted representation shoWs a drive 228, and CD-ROM 230. In that case, the computer, to computer, other embodiments of the present invention may be properly called a client computer, includes some type of be implemented in other types of data processing systems, netWork communication interface, such as LAN adapter such as a netWork computer. Computer 100 also preferably 210, modern 222, or the like. As another example, data includes a graphical user interface (GUI) that may be processing system 200 may be a stand-alone system con implemented by means of systems softWare residing in ?gured to be bootable Without relying on some type of computer readable media in operation Within computer 100. netWork communication interface, Whether or not data pro cessing system 200 comprises some type of netWork com [0038] With reference noW to FIG. 2, a block diagram of munication interface. As a further example, data processing a data processing system is shoWn in Which the present system 200 may be a personal digital assistant (PDA), Which invention may be implemented. Data processing system 200 is con?gured With ROM and/or ?ash ROM to provide is an example of a computer, such as computer 100 in FIG. non-volatile memory for storing operating system ?les and/ 1, in Which code or instructions implementing the processes or user-generated data. of the present invention may be located. Data processing system 200 employs a peripheral component interconnect [0042] The depicted example in FIG. 2 and above-de (PCI) local bus architecture. Although the depicted example scribed examples are not meant to imply architectural limi employs a PCI bus, other bus architectures such as Accel tations. For example, data processing system 200 also may erated Graphics Port (AGP) and Industry Standard Archi be a notebook computer or hand held computer in addition tecture (ISA) may be used. Processor 202 and main memory to taking the form of a PDA. Data processing system 200 204 are connected to PCI local bus 206 through PCI bridge also may be a kiosk or a Web appliance. 208. PCI bridge 208 also may include an integrated memory [0043] The processes of the present invention are per controller and cache memory for processor 202. Additional formed by processor 202 using computer implemented connections to PCI local bus 206 may be made through instructions, Which may be located in a memory such as, for direct component interconnection or through add-in connec example, main memory 204, memory 224, or in one or more tors. In the depicted example, local area netWork (LAN) peripheral devices 226-230. adapter 210, small computer system interface (SCSI) host bus adapter 212, and expansion bus interface 214 are con [0044] With reference noW to FIG. 3, a block diagram nected to PCI local bus 206 by direct component connection. illustrating the relationship of softWare components operat In contrast, audio adapter 216, graphics adapter 218, and ing Within a computer system that may implement the audio/video adapter 219 are connected to PCI local bus 206 present invention. Java-based system 300 contains a plat by add-in boards inserted into expansion slots. Expansion form speci?c operating system 302 that provides hardWare bus interface 214 provides a connection for a keyboard and and system support to softWare executing on a speci?c mouse adapter 220, modern 222, and additional memory hardWare platform. JVM 304 is one softWare application US 2006/0190934 A1 Aug. 24, 2006

that may execute in conjunction With the operating system. then cached and reused upon the next invocation of the JVM 304 provides a Java run-time environment With the method. The execution engine may also be implemented in ability to execute a Java application or applet 306, Which is hardWare and embedded on a chip so that the Java Bytecodes a program, servlet, or software component Written in the are executed natively. JV Ms usually interpret Bytecodes, but Java programming language. The computer system in Which JVMs may also use other techniques, such as just-in-time JVM 304 operates may be similar to data processing system compiling, to execute Bytecodes. 200 or computer 100 described above. HoWever, JVM 304 [0050] When an application is executed on a JVM that is may be implemented in dedicated hardWare on a so-called implemented in softWare on a platform-speci?c operating Java chip, Java-on-silicon, or Java processor With an embed system, a Java application may interact With the host oper ded picoJava core. ating system by invoking native methods. A Java method is [0045] At the center of a Java run-time environment is the Written in the Java language, compiled to Bytecodes, and JVM, Which supports all aspects of Java’s environment, stored in class ?les. Anative method is Written in some other including its architecture, security features, mobility across language and compiled to the native machine code of a networks, and platform independence. particular processor. Native methods are stored in a dynami cally linked library Whose exact form is platform speci?c. [0046] The JVM is a virtual computer, ie a computer that is speci?ed abstractly. The speci?cation de?nes certain [0051] With reference noW to FIG. 4, a block diagram of features that every JVM must implement, With some range a JVM is depicted in accordance With a preferred embodi of design choices that may depend upon the platform on ment of the present invention. JVM 400 includes class Which the JV M is designed to execute. For example, all loader subsystem 402, Which is a mechanism for loading JVMs must execute Java Bytecodes and may use a range of types, such as classes and interfaces, given fully quali?ed techniques to execute the instructions represented by the names. JVM 400 also contains runtime data areas 404, Bytecodes. A JVM may be implemented completely in execution engine 406, native method interface 408, and softWare or someWhat in hardWare. This ?exibility alloWs memory management 410. Execution engine 406 is a di?ferent JVMs to be designed for mainframe computers and mechanism for interpreting or executing instructions con PDAs. tained in the methods of classes loaded by class loader subsystem 402. Execution engine 406 may be, for example, [0047] The JVM is the name of a virtual computer com Java interpreter 412 or just-in-time compiler 414. Native ponent that actually executes Java programs. Java programs method interface 408 alloWs access to resources in the are not run directly by the central processor but instead by underlying operating system. Native method interface 408 the JV M, Which is itself a piece of softWare running on the may be, for example, the Java Native Interface (JNI). processor. The JV M alloWs Java programs to be executed on a different platform as opposed to only the one platform for [0052] Runtime data areas 404 contain native method Which the code Was compiled. Java programs are compiled stacks 416, Java stacks 418, PC registers 420, method area for the JVM. In this manner, Java is able to support appli 422, and heap 424. These different data areas represent the cations for many types of data processing systems, Which organiZation of memory needed by JVM 400 to execute a may contain a variety of central processing units and oper program. ating systems architectures. To enable a Java application to [0053] Java stacks 418 are used to store the state of Java execute on different types of data processing systems, a method invocations. When a neW thread is launched, the compiler typically generates an architecture-neutral ?le for JVM creates a neW Java stack for the thread. The JVM matithe compiled code is executable on many processors, performs only tWo operations directly on Java stacks: it given the presence of the Java run-time system. The Java pushes and pops frames. A thread’s Java stack stores the compiler generates Bytecode instructions that are nonspe state of Java method invocations for the thread. The state of ci?c to a particular computer architecture. A Bytecode is a a Java method invocation includes its local variables, the machine independent code generated by the Java compiler parameters With Which it Was invoked, its return value, if and executed by a Java interpreter. A Java interpreter is part any, and intermediate calculations. Java stacks are composed of the JVM that altemately decodes and interprets a Byte of stack frames. A stack frame contains the state of a single code or Bytecodes. These Bytecode instructions are Java method invocation. When a thread invokes a method, designed to be easy to interpret on any computer and easily the JV M pushes a neW frame onto the Java stack of the translated on the ?y into native machine code. Bytecodes are thread. When the method is complete, the JV M pops the may be translated into native code by a just-in-time (JIT) frame for that method and discards it. The JVM does not compiler. have any registers for holding intermediate values; any Java [0048] A JVM loads class ?les and executes the Bytecodes instruction that requires or produces an intermediate value Within them. The class ?les are loaded by a class loader in uses the stack for holding the intermediate values. In this the JVM. The class loader loads class ?les from an appli manner, the Java instruction set is Well-de?ned for a variety cation and the class ?les from the Java application program of platform architectures. ming interfaces (APIs) Which are needed by the application. [0054] Program counter (PC) registers 420 are used to The execution engine that executes the Bytecodes may vary indicate the next instruction to be executed. across platforms and implementations. [0055] Native method stacks 416 stores the state of invo [0049] One type of softWare-based execution engine is a cations of native methods. The state of native method JIT compiler. With this type of execution, the Bytecodes of invocations is stored in an implementation-dependent Way in a method are compiled into native machine code upon native method stacks, registers, or other implementation successful ful?llment of some type of criteria for JIT com dependent memory areas. In some JV M implementations, piling a method. The native machine code for the method is native method stacks 416 and Java stacks 418 are combined. US 2006/0190934 A1 Aug. 24, 2006

[0056] Method area 422 contains class data While heap representation into the native callsite to remove the need to 424 contains all instantiated objects. The constant pool is invoke the native function. The inlining process, Which is located in method area 422 in these examples. The JVM recursive, includes examining native callsites and determin speci?cation strictly de?nes data types and operations. Most ing if a native function call may be replaced With an actual JVMs choose to have one method area and one heap, each implementation of the function. The actual implementation of Which is shared by all threads running inside the JVM, of the function is the body of the function in the JIT such as JVM 400. When JVM 400 loads a class ?le, it parses intermediate representation format. information about a type from the binary data contained in the class ?le. JV M 400 places this type of information into [0061] If the native function call is replaceable With the the method area. Each time a class instance or array is actual implementation of the function in the J IT intermediate created, the memory for the neW object is allocated from representation format, the inlining process continues to heap 424. JVM 400 includes an instruction that allocates perform inlining Work, such as mapping parameters to memory space Within the memory for heap 424 but includes arguments, merging native compiler and J IT compiler inter no instruction for freeing that space Within the memory. mediate representations, control ?oW graphs, and material Memory management 410 in the depicted example manages iZing a pointer to JNIEnv structure so that it can be used by memory space Within the memory allocated to heap 424. inlined statements making calls to the Java Native Interface Memory management 410 may include a garbage collector, to perform normal system activities. Which automatically reclaims memory used by objects that [0062] HoWever, if the native function call is not replace are no longer referenced. Additionally, a garbage collector able With the actual implementation of the function in the also may move objects to reduce heap fragmentation. J IT intermediate representation, the present invention takes [0057] The present invention provides a method, an appa one of tWo paths: (i) if the callsite Was created While ratus, and computer instructions for recursively inlining processing Bytecodes (i.e. the callsite represents a call from native functions in compiled Java code. The present inven Java to a native method), no further processing is performed tion avoids Java programs from making native function calls on the callsite or (ii) if the callsite occurs Within a native by replacing the intermediate representation of the invoca context (i.e. Within inlined non-Java callable native code), tion of native functions With an intermediate representation the native function call is replaced by a call to a synthesiZed of the corresponding method body during JIT compilation. native function that provides access to the native libraries. An intermediate representation is an internal representation Such a non-inlinable function is knoWn as an opaque func of source code generated by the JIT compiler and includes tion. The native libraries include implementations of the program constructs that are used to perform optimiZation original native function calls. In this Way, calls to the opaque When the source code is compiled to generate binary method may be replaced With direct calls to the function machine code. implementation in the native libraries. [0058] In a preferred embodiment, the present invention [0063] In order to synchroniZe data that is shared betWeen enables any compiler trying to inline a Java callable native inlined native functions and other functions, such as syn callsite to consume the intermediate representation of the thesiZed native functions, the present invention provides the native function and convert it to its oWn intermediate proper linkage to shared memory, such that inlined native representation to perform optimiZation. A native callsite is a function and non-inlined native functions are able to read Java statement in any program that calls a native function. and Write to the same data segment. Using the present invention, a JIT compiler inliner inlines a native function by converting the intermediate representa [0064] Furthermore, the present invention inserts code to tion of the native function to the J IT compiler’s intermediate provide interaction betWeen inlined native functions and representation thereby treating native method bodies as JVM components. For example, instructions to perform conceptually as Java function bodies although maintaining handshaking With garbage collection components are the semantics of the original source language of the native inserted after inlining is performed. method, and recursively inlines any native calls (in particu [0065] Turning noW to FIG. 5, a diagram illustrating a lar, non-Java callable ones) the inlined native code may conversion process for converting intermediate representa contain. tion of the native function to JIT compiler intermediate [0059] The present invention includes a conversion engine representation is depicted in accordance With a preferred that utiliZes the generated native function intermediate rep embodiment of the present invention. As depicted in FIG. 5, resentation to embed into the JIT compiler environment native front end 500 provides native intermediate represen native libraries that contain intermediate representation of tation 502 for native code 504. An example of native front native functions in addition to the binary representation of end 500 may be a C/C++ compiler. the compiled code. In other Words, the conversion engine [0066] Conversion engine 506 of the present invention imports the intermediate representation of the native func iterates over native intermediate representation 502 gener tions stored in native libraries into the J IT compiler. For each ated by native front end 500 and generates neW J IT compiler instruction encountered, the engine generates neW J IT com intermediate representation 508 for each instruction that is piler intermediate representation statements. The JIT com encountered for the native code. Thus, instead of using Java piler subsequently treats the intermediate representation as if Bytecodes as an input, conversion engine 506 uses native it Was derived from Java Bytecodes While maintaining intermediate representation 502 as an input. Once the native adherence to the semantics of the original source language intermediate representation 502 is processed, the JIT com of the native method. piler subsequently treats the generated JIT compiler inter [0060] In addition, the present invention includes an mediate representation 508 as if it Were derived from Java inliner that inlines the converted JIT compiler intermediate Bytecodes While maintaining adherence to the semantics of US 2006/0190934 Al Aug. 24, 2006

the original source language of the native method. Conver [0073] Within a Java function, there may be inlined and sion engine 506 also provides linkages appropriate to the non-inlined native function calls, such as synthesized native language that has been inlined, for example, arguments that function, another function in the same library, or a function are called by the function. de?ned in a different library. The present invention protects [0067] Turning noW to FIG. 6, a diagram illustrating one data that is shared betWeen inlined and non-inlined native step in the recursive native inlining process is depicted in functions, such as global variables accessed by the program, accordance With a preferred embodiment of the present by providing correct linkages to the shared data and ensuring invention. As shoWn in FIG. 6, JIT compiler inliner 600 that both the inlined and the non-inlined native function calls analyzes callsite 602 to determine if it is a native function are able to read and Write to the same portion of shared call. If 602 is a native function call, JIT compiler inliner 600 memory Where the shared data is stored. Shared data may be uses conversion engine 604 to convert the native interme any external or static data, as Well as addresses of variables diate representation 606 of the native function to JIT com that may be passed by an inlined native function call to a piler intermediate representation 608. synthesized function call. [0068] With the JIT compiler intermediate representation [0074] Turning noW to FIG. 8, a diagram illustrating 608, JIT compiler inliner 600 inlines the native function call linkage betWeen inlined and synthesized native functions is in the compiled Java code by replacing the function call of depicted in accordance With a preferred embodiment of the callsite 610 With the actual implementation of the function, present invention. As shoWn in FIG. 8, Java function 800 Which is the body of the function in the JIT compiler includes inlined native function 802. Inlined native function intermediate representation 608 format. In addition, JIT 802 includes a declaration of static variable x and a Write to compiler inliner 600 performs inlining Work, such as map the same variable x. Memory for static variable x 804 is ping parameters to arguments, merging native compiler and stored Within library memory space 806. JIT compiler intermediate representations, control How [0075] In addition, inlined native function 802 includes a graph, and materialization of a pointer to JNIEnv structure, call to an opaque native function 808. As mentioned above, such that inlined statements may make calls the Java Native the JIT compiler inliner replaces the native call 808 With Interface (JNI). It is noted that C or C++ compiler interme synthesized native function call 810, such that access to the diate representation 608 may be stored along side With native library containing the implementation of reading and program libraries. Writing to x 812 in library memory space 806 is provided. [0069] During the inlining process, JIT compiler inliner 600 may detect native intermediate representation 606 that [0076] The present invention provides linkages from both cannot proceed through the rest of the JIT compiler pro inlined native function 802 and actual native function cessing, since it may make calls to procedures for Which the (Which Will be called by the synthesized function 810) 812 J IT compiler cannot render an intermediate representation. to memory for static variable x 804. In this Way, inlined For example, When a system call made into an operating native function 802 is able to read and Write to the same system kernel could not be inlined by the JIT compiler. portion of memory that non-inlined native functions in 812 do, Where 812 Was reached via 810. [0070] Turning noW to FIG. 7, a diagram illustrating synthesized Java callable native functions is depicted in [0077] Since the inlined native functions are executed in a accordance With a preferred embodiment of the present Java runtime environment, the program code must be con invention. As depicted in FIG. 7, in cases Where an inter ditioned to interact With the appropriate JVM requirements. mediate representation cannot proceed through the J IT com In particular, instructions to perform handshaking With com piler processing, JIT compiler inliner replaces calls to the ponents, such as garbage collection, are inserted by the native functions that are non-inlineable or opaque With calls present invention after inlining and before the remainder of to synthesized Java callable native functions that provide the JIT compiler processing. access to native libraries containing implementations of the [0078] In the preferred embodiment, the present invention original non-inlineable calls. recursively inlines native functions into the native callsite [0071] In this illustrative example, Java runtime 700 until either a call to an opaque function is encountered or includes one inlined native function 702. Within inlined until intermediate representation groWth limits are reached. native function 702, calls to opaque native functions a, b, The intermediate representation groWth limits indicate hoW and c are present. Since function calls a, b, and c are not many native functions may be inlined. Since inlining inlineable, the JIT compiler inliner, such as JIT compiler increases the size of program data, a groWth limit may be inliner 600 in FIG. 6, replaces the native function calls a, b, used, for example, to limit negative side-effects on an and c With synthesized native function calls a 703, b 705, instruction cache. The resulting JIT compiler intermediate and c 707. Synthesized native functions a 703 and b 705 representation is examined, and the JIT compiler proceeds provide access to native library containing implementations normally. for functions a and b 704, While synthesized native function c 707 provides access to native library container implemen [0079] Turning noW to FIG. 9, a ?owchart of an exem tation for function c 706. plary process for inlining native functions into compiled Java code is depicted in accordance With a preferred [0072] In order to ensure that the Java runtime is updated embodiment of the present invention. As depicted in FIG. 9, to indicate existence of the synthesized native functions, the process begins When the JIT compiler is run by the Java synthesized auxiliary data 709 is also generated by the JIT runtime environment to its standard inlining phase (step compiler inliner. For some cases Where the opaque function is a Well knoWn library function, the call to the function may 900). be effected Without going through the entire intermediate [0080] During this phase, a native function call is encoun native method. tered (step 902). Since the intermediate representation of the US 2006/0190934 A1 Aug. 24, 2006

native function is stored along side its binary representations [0088] Turning noW to FIG. 10B, a diagram illustrating an in native libraries, the intermediate representation generated exemplary native function implemented in a non-Java lan by the native compiler is used. However, other schemes, guage is depicted in accordance With a preferred embodi such as analyzing native function’s binary code may be ment of the present invention. In this illustrative example, used. The key is to map the native function to the JIT dummy( ) method 1002 from FIG. 10A is implemented compiler’s intermediate representation. When the native using a non-Java language, such as C. function call is encountered, the conversion engine of the [0089] As a result, dummy( ) method 1020 is shoWn in present invention makes a determination as to Whether or not FIG. 10B. dummy( ) method 1020 returns a value of ‘100’. the native function call is opaque (step 904). If the native function call is to an opaque function, the process continues [0090] Turning noW to FIG. 10C, a diagram illustrating an to step 906. annotated tree-based intermediate representation Without [0081] At step 906, the JIT compiler inliner determines inlining for the main method in DummyCall class is Whether the callsite Was created While processing Java depicted in accordance With a preferred embodiment of the Bytecodes (i.e. the callsite represents a call from Java to a present invention. As shoWn in FIG. 10C, main method native function). If the callsite Was created While processing 1030 is the intermediate representation for main method Java Bytecodes, it proceeds to step 924 to check Whether the 1004 in FIG. 10A generated by a compiler Without inlining. callsite is the original one that started the entire inlining [0091] In this intermediate representation, main method process. If it is, the JIT compiler proceeds to step 922, 1030 ?rst sums return values from tWo consecutive function avoiding inlining the callsite. Returning to step 924, if the calls to native function dummy 1032 and dummy 1034. callsite Was not the original one, then it proceeds to step 908 Main method 1030 then stores the result to a temporary Where it commences the intermediate conversion process. variable x. With main method 1030, overhead is incurred at [0082] Back at step 906, if the callsite does not represent run time When the native function is invoked for reasons a call from Java to a native function, meaning that the call mentioned earlier in this docket. to an opaque function occurs Within inlined native code, the [0092] Turning noW to FIG. 10D, a diagram illustrating an compiler process proceeds to step 918. At step 918, the JIT annotated tree-based intermediate representation With inlin compiler inliner synthesiZes a Java callable native function ing for the main method in the DummyCall class is depicted Whose purpose is to invoke the original actual function and in accordance With a preferred embodiment of the present then replaces the native function call With a call to the invention. As shoWn in FIG. 10D, main method 1040 is synthesiZed native ?lnction (step 920) and continues to step generated by a JIT compiler Which inlines native functions 914. at compile time. [0083] Turning back to step 904, if the native function call [0093] Thus, instead of invoking native function dummy is not to an opaque function, the inliner converts the native 1032 or 1034 at runtime, main method 1040 includes the intermediate representation into JIT compiler intermediate actual implementation of dummy method 1032 and 1034. representation (step 908) and ensures that references to This technique is enabled, because the JIT compiler inter symbols or storage in the JIT compiler’s intermediate rep mediate representation is knoWn at compile time and opti resentation correspond correctly to symbols or storage ref miZation may be performed to expand What used to be an erenced by the original code. It also replaces the native opaque callsite to an actual implementation of the function. function call With the actual implementation of the function (step 910) and then materialiZes the JNIEnv pointer and [0094] In this example, native function calls to native passes it to the inlined code (step 912). The process then functions dummy 1032 and 1034 are eliminated and continues to step 914. replaced With constant values 100. [0084] At step 914, the inliner makes a determination as to [0095] Turning noW to FIG. 10E, a diagram illustrating an Whether the JIT compiler groWth limit has been reached. If optimiZed tree-based intermediate representation With inlin the JIT compiler groWth limit has been reached, the process ing for the main method in the DummyCall class is depicted continues to step 922. If the JIT compiler groWth limit has in accordance With a preferred embodiment of the present not been reached, the JIT compiler inliner makes a deter invention. As shoWn in FIG. 10E, if the compiler further mination as to Whether additional functions calls are present optimiZes the generated representation in FIG. 10D, the in the converted intermediate representation (step 916). compiler may replace the addition With a value of 200 as [0085] If additional function calls are present in the con shoWn in FIG. 10E. verted intermediate representation, the process returns to [0096] By inlining native function calls at JIT compile step 902 to retrieve the next converted intermediate repre time, invocation of native functions and associated over sentation. OtherWise, the process continues to step 922. At heads are removed. In addition, the callsite is exposed to step 922, the JIT compiler processing is resumed. Thus, the further optimizations, Which reduce it to a constant value. process terminates thereafter. [0097] In summary, the present invention enables native [0086] Turning noW to FIG. 10A, a diagram illustrating an function inlining by replacing the intermediate representa exemplary native function call is depicted in accordance tion of native function calls With the JIT compiler’s inter With a preferred embodiment of the present invention. In this mediate representation of the native function. The present illustrative example, DummyCall class 1000 includes native invention refactors the resulting intermediate representation function dummy( ) 1002 and main( ) method 1004. and determines Which region includes opaque functions to [0087] Within main( ) method 1004, integer x 1006 is be transformed back to invoking Java callable native func assigned the result of adding dummy( ) method 1008 With tions. In addition, the present invention synthesiZes native dummy( ) method 1010. functions as appropriate and creates linkages for access to US 2006/0190934 A1 Aug. 24, 2006

data shared between the inlined native functions and non determining that the native function call is to an opaque inlined native functions. Furthermore, the present invention function; and inserts code in order to meet JVM requirements, such as determining that no additional native function call is garbage collection. In this Way, native function calls are present in a native function implementation. avoided as much as possible, and overhead to native func 3. The method of claim 1, Wherein the native function call tion calls is thus minimized. is invoked using a Java Native Interface, and is recursively [0098] It is important to note that While the present inven inlined such that any native calls an inlined native function tion has been described in the context of a fully functioning contains may also be subsequently inlined. data processing system, those of ordinary skill in the art Will 4. The method of claim 1, Wherein the converting step appreciate that the processes of the present invention are comprises: capable of being distributed in the form of a computer iterating through the intermediate representation of the readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the native function; and particular type of signal bearing media actually used to carry generating a just-in-time compiler intermediate represen out the distribution. Examples of computer readable media tation for each instruction in the intermediate represen include recordable-type media, such as a ?oppy disk, a hard tation of the native function, disk drive, a RAM, CD-ROMs, DVD-ROMs, and transmis Wherein the intermediate representation of the native sion-type media, such as digital and analog communications function is retrieved from a native library containing links, Wired or Wireless communications links using trans native binary code and the intermediate representation mission forms, such as, for example, radio frequency and of the native function. light Wave transmissions. The computer readable media may take the form of coded formats that are decoded for actual 5. The method of claim 1, Wherein the inlining step use in a particular data processing system. comprises: [0099] The description of the present invention has been determining if the native function call is to an opaque presented for purposes of illustration and description, and is function, Wherein the call to the opaque function not intended to be exhaustive or limited to the invention in invokes procedures for Which a just-in-time compiler the form disclosed. Many modi?cations and variations Will cannot render an intermediate representation; be apparent to those of ordinary skill in the art. For example, if the native function call is not to an opaque function, although the depicted embodiment is directed toWards pro replacing the native function call With an actual imple cessing Bytecodes in Java, the processes of the present mentation of the native function call using the just-in invention may be applied to other programming languages time compiler intermediate representation; and and environments that process instructions, Which are non speci?c to a computer on Which the instructions are to be materialiZing a native interface environment pointer and executed. In such a case, a virtual machine on the computer making the pointer available to the actual implemen may interpret the instructions or send the instructions to a tation of the native function call. compiler to generate code suitable for execution by the 6. The method of claim 5, further comprising: computer on Which the virtual machine is located. if the native function call is to an opaque function, [0100] The embodiment Was chosen and described in determining if the native function call represents a call order to best explain the principles of the invention, the from Java to a native function; practical application, and to enable others of ordinary skill if the native function call does not represent a call from in the art to understand the invention for various embodi Java to a native function, synthesizing a Java callable ments With various modi?cations as are suited to the par native function, and replacing the native function call ticular use contemplated. With a call to the synthesiZed native function, Wherein the synthesiZed native function provides access to a What is claimed is: native library containing an implementation of the 1. A method in a data processing system for inlining opaque function; and native functions into compiled Java code, the method com prising: if the native function call represent a call from Java to a native function, determining if the native function call detecting a native function call at a Java callsite; is an original function call that started an entire inlining converting an intermediate representation of a native process. function to a just-in-time compiler intermediate repre 7. The method of claim 6, further comprising: sentation; and if the native function call is the original function call that inlining the just-in-time compiler intermediate represen started the entire inlining process, resuming just-in tation into the Java callsite. time compiler processing; 2. The method of claim 1, Wherein the inlining step is if the native function call is not an original function call recursively performed until one of the folloWing: that started the entire inlining process, converting the determining that a just-in-time compiler groWth limit is intermediate representation of the native function call reached, Wherein the just-in-time compiler groWth limit to a just-in-time compiler intermediate representation. indicates hoW many native functions may be inlined in 8. The method of claim 1, Wherein the just-in-time com order to limit negative side-effects on an instruction piler intermediate representation is subsequently treated as cache; Java Bytecodes, While maintaining adherence to semantics US 2006/0190934 A1 Aug. 24, 2006

of original source language of the native function, by a if the native function call is not to an opaque function, just-in-time compiler after the converting step. replaces the native function call With the actual imple 9. The method of claim 5, Wherein the inlining step further mentation of the native function call using the inter comprises: mediate just-in-time compiler intermediate representa tion; and mapping parameters to arguments; and materialiZes a native interface environment pointer and merging native compiler and HT compiler intermediate passes the pointer to the actual implementation of the representation and control How graphs. native function call. 10. The method of claim 6, further comprising: 18. The data processing system of claim 17, Wherein the inserting code to the compiled Java code to provide just-in-time compiler inliner further determines if the native linkage to shared memory for data shared by inlined function call represents a call from Java to a native function, native functions, synthesized native functions and other if the native function call is to an opaque function; functions in the native library. if the native function call does not represent a call from 11. The method of claim 6, further comprising: Java to a native function, synthesizes a Java callable inserting code in the compiled Java code to provide native function; and interaction betWeen the actual implementation of the replaces the native function call With a call to the syn native function call and virtual machine components. thesiZed native function, Wherein the synthesiZed 12. The method of claim 1, Wherein the intermediate native function provides access to a native library representation of the native function is binary code of the containing implementation of the opaque function. native function. 19. The data processing system of claim 13, Wherein the 13. A data processing system for inlining native functions intermediate representation of the native function is binary into compiled Java code, the data processing system com code of the native function. prising: 20. A computer program product in a computer readable medium for inlining native functions into compiled Java a conversion engine for converting an intermediate rep code, the computer program product comprising: resentation of a native function to a just-in-time com piler intermediate representation, responsive to detect ?rst instructions for detecting a native function call at a ing a native function call at a Java callsite; Java callsite; a just-in-time compiler inliner for inlining the just-in-time second instructions for converting an intermediate repre compiler intermediate representation into the Java sentation of a native function to a just-in-time compiler callsite. intermediate representation; and 14. The data processing system of claim 13, Wherein the third instructions for inlining the just-in-time compiler just-in-time compiler inliner performs inlining recursively intermediate representation into the native callsite. until a just-in-time compiler groWth limit is reached, 21. The computer program product of claim 20, Wherein Wherein the just-in-time compiler groWth limit indicates the second instructions comprises: hoW many native functions may be inlined in order to limit negative side-effects on an instruction cache; ?rst sub-instructions for iterating through the intermediate representation of the native function; and until determining that the native function call is to an opaque function; and second sub-instructions for generating a just-in-time com piler intermediate representation for each instruction in until determining that no additional native function call is the intermediate representation of the native function, present in a native function implementation. 15. The data processing system of claim 13, Wherein the Wherein the intermediate representation of the native native function call is invoked using a native interface, and function is retrieved from a native library containing is recursively inlined such that any native calls an inlined native binary code and the intermediate representation native function contains may also be subsequently inlined. of the native function. 16. The data processing system of claim 13, Wherein the 22. The computer program product of claim 20, Wherein conversion engine iterates through the intermediate repre the third instructions comprises: sentation of the native function; and ?rst sub-instructions for determining if the native function generates a just-in-time compiler intermediate represen call is to an opaque function, Wherein the call to the tation for each instruction in the intermediate represen opaque function invokes procedures for Which a just tation of the native function, in-time compiler cannot render an intermediate repre sentation; Wherein the intermediate representation of the native function is retrieved from a native library containing second sub-instructions for replacing the native function native binary code and the intermediate representation call With an actual implementation of the native func of the native function. tion call using the just-in-time compiler intermediate representation, if the native function call is not to an 17. The data processing system of claim 13, Wherein the just-in-time compiler inliner further determines if the native opaque function; and function call is to an opaque function, Wherein the call to the third sub-instructions for materialiZing a native interface opaque function invokes procedures for Which a just-in-time environment pointer and passing the pointer to the compiler cannot render an intermediate representation; actual implementation of the native function call. US 2006/0190934 A1 Aug. 24, 2006

23. The computer program product of claim 22, further sixth sub-instructions for replacing the native function comprising: call With a call to the synthesized native function, Wherein the synthesized native function provides fourth sub-instructions for determining if the native func access to a native library containing implementation of tion call represents a call from Java to a native function, the opaque function. if the native function call is to an opaque function; 24. The computer program product of claim 20, Wherein the intermediate representation of the native function is ?fth instructions for synthesizing the native function, if binary code of the native function. the native function call does not represent a call from Java to a native function; and