In their latest research which was published in the journal ACM Transactions on Programming Languages and System, scientists from IIT Madras have developed a new framework that could make the programs written in JAVA language more efficient.
V. Krishna Nandivada
DEPARTMENT OF CSE, IIT MADRAS
Invented in the year 1936, the computer and associated technologies are undoubtedly the biggest inventions of the 21st century and have revolutionized almost every sector of our lives. Over the course of time, various languages such as JAVA, C++, Python, Perl etc. have been developed for providing instructions to computers. Among these, JAVA, one of the most popular programming languages, is used widely for desktop-, web-, cloud- and mobile-applications. One of the reasons for the popularity of JAVA stems from the fact that it can be used on various computer platforms such as Mac, Windows, Unix etc., provided a supporting software java run time environment (called java virtual machine or JVM, in short) is installed on the computer. This is a huge relief for program developers as the program written in JAVA language on one platform can be directly run on another platform without making any changes.
This platform independence is made possible by the use of an intermediate language between JAVA written program and the computer platform. JAVA programs are first converted to an intermediate language (called Java Bytecode) which is fed to JVM, which enables the conversion of the Bytecode to the language of a computer platform for execution of the program. This process of language conversion is called “Compilation”.
Now, scientists from IIT Madras have designed a framework, christened as “PYE”-Precise-Yet-Efficient Just-In-Time, that achieves the objective of generating efficient Java code without taking too much time. Usually, the compilation from JAVA language to intermediate language is done before-hand and therefore does not increase the time taken for getting the result. However, the time taken to convert from intermediate to machine language, which can only be done during execution (as it requires some components (called libraries) from the computer on which the program is being executed),gets added in the time taken for program to run.
“As the time spent in Just-in-time compilation gets added to the execution time of the application such compilers typically sacrifice the precision of program analyses for efficiency. That is, JVMs do not perform complex analysis required to generate most efficient code“, says V. Krishna Nandivada, Leader of the research team and Associate Professor at IIT-Madras while elaborating on the problem.
To solve this problem, V Krishna and Manas Thakur tweaked the two compilation procedures. In the first compilation step, more elaborate and time-consuming analysis is performed and wherever the conversion stalls due to unavailability of the library from the computer, a partial result is created. Now, during the second stage of compilation, the just in-time compilers, with available libraries from the computer, work to resolve the partial values to generate final values and finally a more precise result. As the time taken during the first exhaustive compilation does not get included in execution time, the whole procedure still remains time-saving, while leading to highly efficient codes.
“We have developed a prototype implementation of our proposed PYE framework for the Oracle Hotspot Server compiler and are working to integrate the PYE framework in other commercial Java virtual machines. Also, we are working on developing security models to guarantee the correctness of our analysis results” added V Krishna while discussing his future research plans.
“It is a good piece of work which combines the best of both worlds i.e. power of analysis at compile time which can afford to use expensive analysis and the power of availability of run time information which gives more precise information. Thus a light-weight optimizer in a JIT compiler can perform significant optimizations without having to spend a considerable amount of time”
– Dr. Uday Khedker, Professor IIT Bombay
Author: Aditi Jain