MCVM: AN OPTIMIZING VIRTUAL MACHINE FOR THE MATLAB PROGRAMMING LANGUAGE

In recent years, there has been an increase in the popularity of dynamic languages such as Python, Ruby, PHP, JavaScript and MATLAB. Programmers appreciate the productivity gains and ease of use associated with such languages. However, most of them still run in virtual machines which provide no Just-In-Time (JIT) compilation support, and thus perform relatively poorly when compared to their statically compiled counterparts. While the reference MATLAB implementation does include a built-in compiler, this implementation is not open sourced and little is known abouts its internal workings. The McVM project has focused on the design and implementation of an optimizing virtual machine for a subset of the MATLAB programming language. Virtual machines and JIT compilers can benefit from advantages that static compilers do not have. It is possible for virtual machines to make use of more dynamic information than static compilers have access to, and thus, to implement optimization strategies that are more adapted to dynamic languages. Through the McVM project, some possible avenues to significantly improve the performance of dynamic languages have been explored. Namely, a just-in-time type-based program specialization scheme has been implemented in order to take advantage of dynamically available type information. One of the main contributions of this project is to provide an alternative implementation of the MATLAB programming language. There is already an open source MATLAB interpreter (GNU Octave), but our implementation also includes an optimizing JIT compiler and will be open sourced under the BSD license. McVM aims to become a viable implementation for end-users, but could also see use in the compiler research community as a testbed for dynamic language optimizations. In addition to the contribution of the McVM

[1]  Ulrik Pagh Schultz,et al.  Automatic program specialization for Java , 2000, TOPL.

[2]  Michael F. P. O'Boyle,et al.  Using machine learning to focus iterative optimization , 2006, International Symposium on Code Generation and Optimization (CGO'06).

[3]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[4]  Prithviraj Banerjee,et al.  Correctly detecting intrinsic type errors in typeless languages such as MATLAB , 2000, APL '01.

[5]  David A. Padua,et al.  FALCON: A MATLAB Interactive Restructuring Compiler , 1995, LCPC.

[6]  Timothy A. Davis,et al.  MATLAB Primer, Seventh Edition , 2004 .

[7]  Chris Lattner,et al.  LLVM: AN INFRASTRUCTURE FOR MULTI-STAGE OPTIMIZATION , 2000 .

[8]  Michael F. P. O'Boyle,et al.  Method-specific dynamic compilation using logistic regression , 2006, OOPSLA '06.

[9]  David F. Bacon,et al.  Fast static analysis of C++ virtual function calls , 1996, OOPSLA '96.

[10]  David A. Padua,et al.  MaJIC: compiling MATLAB for speed and responsiveness , 2002, PLDI '02.

[11]  Michael Spertus,et al.  Transparent Programmer-Directed Garbage Collection for C++ , 2007 .

[12]  Dayong Gu,et al.  Phase-based adaptive recompilation in a JVM , 2008, CGO '08.

[13]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[14]  Simon J. Cox,et al.  Partial Evaluation of MATLAB , 2003, GPCE.

[15]  Ken Kennedy,et al.  Procedure cloning , 1992, Proceedings of the 1992 International Conference on Computer Languages.

[16]  Matthew Arnold,et al.  A Survey of Adaptive Optimization in Virtual Machines , 2005, Proceedings of the IEEE.

[17]  David Gregg,et al.  A practical solution for scripting language compilers , 2009, SAC '09.

[18]  Peter Lee,et al.  Optimizing ML with run-time code generation , 1996, PLDI '96.

[19]  Dominic Duggan,et al.  Explaining Type Inference , 1996, Sci. Comput. Program..

[20]  Michael F. P. O'Boyle,et al.  Rapidly Selecting Good Compiler Optimizations using Performance Counters , 2007, International Symposium on Code Generation and Optimization (CGO'07).

[21]  Jeffrey S. Foster,et al.  Static type inference for Ruby , 2009, SAC '09.

[22]  Armin Rigo,et al.  Representation-based just-in-time specialization and the psyco prototype for python , 2004, PEPM '04.

[23]  Prithviraj Banerjee,et al.  Correctly detecting intrinsic type errors in typeless languages such as MATLAB , 2000, ACM SIGAPL APL Quote Quad.

[24]  Timothy A. Davis,et al.  MATLAB Primer , 1994 .

[25]  Stephen J. Fink,et al.  Design, implementation and evaluation of adaptive recompilation with on-stack replacement , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[26]  Samuele Pedroni,et al.  PyPy's approach to virtual machine construction , 2006, OOPSLA '06.

[27]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[28]  Jeremy Singer,et al.  Sparse Bidirectional Data Flow Analysis as a Basis for Type Inference , 2004 .

[29]  Alok N. Choudhary,et al.  Match virtual machine: an adaptive runtime system to execute MATLAB in parallel , 2000, Proceedings 2000 International Conference on Parallel Processing.

[30]  Michael Voss,et al.  High-level adaptive program optimization with ADAPT , 2001, PPoPP '01.

[31]  Giorgio Levi,et al.  An Experiment in Type Inference and Verification by Abstract Interpretation , 2002, VMCAI.

[32]  Michael A. Hennell,et al.  Data flow analysis of recursive procedures , 1988, SIGP.

[33]  Andrew A. Chien,et al.  Type Directed Cloning for Object-Oriented Programs , 1995, LCPC.

[34]  Hidehiko Masuhara,et al.  Generating Optimized Residual Code in Run-Time Specialization , 1999 .

[35]  Toshiaki Yasue,et al.  Design and evaluation of dynamic optimizations for a Java just-in-time compiler , 2005, TOPL.

[36]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[37]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[38]  David A. Padua,et al.  A MATLAB to Fortran 90 translator and its effectiveness , 1996, ICS '96.