Trace-based just-in-time type specialization for dynamic languages
Author(s) -
Andreas Gal,
Brendan Eich,
Mike Shaver,
David F. Anderson,
David Mandelin,
Mohammad R. Haghighat,
Blake Kaplan,
Graydon Hoare,
Boris Zbarsky,
Jason Orendorff,
Jesse Ruderman,
Edwin Smith,
Rick Reitmaier,
Michael Bebenita,
Mason Chang,
Michael Franz
Publication year - 2009
Publication title -
citeseer x (the pennsylvania state university)
Language(s) - English
Resource type - Conference proceedings
ISSN - 0362-1340
DOI - 10.1145/1542476.1542528
Subject(s) - computer science , programming language , compiler , just in time compilation , javascript , benchmark (surveying) , trace (psycholinguistics) , compile time , parallel computing , dynamic compilation , type inference , code (set theory) , type (biology) , artificial intelligence , ecology , linguistics , philosophy , geodesy , set (abstract data type) , inference , biology , geography
Dynamic languages such as JavaScript are more difficult to compile than statically typed ones. Since no concrete type information is available, traditional compilers need to emit generic code that can handle all possible type combinations at runtime. We present an alternative compilation technique for dynamically-typed languages that identifies frequently executed loop traces at run-time and then generates machine code on the fly that is specialized for the actual dynamic types occurring on each path through the loop. Our method provides cheap inter-procedural type specialization, and an elegant and efficient way of incrementally compiling lazily discovered alternative paths through nested loops. We have implemented a dynamic compiler for JavaScript based on our technique and we have measured speedups of 10x and more for certain benchmark programs.
Accelerating Research
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom
Address
John Eccles HouseRobert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom