Towards reducing the need for algorithmic primitives in dynamic language VMs through a tracing JIT

When implementing virtual machines, besides the interpreter and optimization facilities, we have to include a set of primitive functions that the client language can use. Some of these implement truly primitive behavior, such as arithmetic operations. Other primitive functions, which we call algorithmic primitives, are expressible in the client language, but are implemented in the vm to improve performance. However, having many primitives in the vm makes it harder to maintain them, or re-use them in alternative vm implementations for the same language. With the advent of efficient tracing just-in-time compilers we believe the need for algorithmic primitives to be much diminished, allowing more of them to be implemented in the client language. In this work, we investigate the trade-offs when creating primitives, and in particular how large a difference remains between primitive and client function run times in vms with tracing just-in-time compiler. To that end, we extended the RSqueak/VM, a vm for Squeak/Smalltalk written in RPython. We compare primitive implementations in C, RPython, and Smalltalk, showing that due to the tracing JIT the performance gap can be significantly reduced.

[1]  Bruce Schneier,et al.  Applied cryptography (2nd ed.): protocols, algorithms, and source code in C , 1995 .

[2]  Carl Friedrich Bolz,et al.  Tracing the meta-level: PyPy's tracing JIT compiler , 2009, ICOOOLPS@ECOOP.

[3]  Oscar Nierstrasz,et al.  Back to the Future in One Week - Implementing a Smalltalk VM in PyPy , 2008, S3.

[4]  Vasanth Bala,et al.  Dynamo: a transparent dynamic optimization system , 2000, SIGP.

[5]  Robert Hirschfeld,et al.  SqueakJS: a modern and practical smalltalk that runs in any browser , 2014, DLS '14.

[6]  Bernard P. Zajac Applied cryptography: Protocols, algorithms, and source code in C , 1994 .

[7]  Stefan Marr,et al.  Supporting Concurrency Abstractions in High-level Language Virtual Machines , 2013 .

[8]  Laurence Tratt,et al.  Storage strategies for collections in dynamically typed languages , 2013, OOPSLA.

[9]  尚弘 島影 National Institute of Standards and Technologyにおける超伝導研究及び生活 , 2001 .

[10]  Michael Haupt,et al.  Maxine: An approachable virtual machine for, and in, java , 2013, TACO.

[11]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[12]  John Maloney,et al.  Back to the Future The Story of Squeak, A Practical Smalltalk Written in Itself , 1997 .

[13]  Debashis Kushary,et al.  Bootstrap Methods and Their Application , 2000, Technometrics.

[14]  Urs Hölzle,et al.  Adaptive optimization for self: reconciling high performance with exploratory programming , 1994 .

[15]  Craig Chambers,et al.  An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes , 1989, OOPSLA '89.

[16]  Leonidas J. Guibas,et al.  A language for bitmap manipulation , 1982, TOGS.

[17]  Laurence Tratt,et al.  The impact of meta-tracing on VM design and implementation , 2015, Sci. Comput. Program..

[18]  Z. Kulpa Review of "Smalltalk-80: The Language and its Implementation by A. Goldberg, and D. Robson", Addison-Wesley Publ., Co., 1983, 0-201-11371-6 , 1985, COMG.

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