Dynamic elimination of overflow tests in a trace compiler

  • Authors:
  • Rodrigo Sol;Christophe Guillon;Fernando Magno Quintão Pereira;Mariza A. S. Bigonha

  • Affiliations:
  • UFMG, Belo Horizonte, Brazil;STMicroelectronics, Grenoble, France;UFMG, Belo Horizonte, Brazil;UFMG, Belo Horizonte, Brazil

  • Venue:
  • CC'11/ETAPS'11 Proceedings of the 20th international conference on Compiler construction: part of the joint European conferences on theory and practice of software
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Trace compilation is a technique used by just-in-time (JIT) compilers such as TraceMonkey, the JavaScript engine in the Mozilla Firefox browser. Contrary to traditional JIT machines, a trace compiler works on only part of the source program, normally a linear path inside a heavily executed loop. Because the trace is compiled during the interpretation of the source program the JIT compiler has access to runtime values. This observation gives the compiler the possibility of producing binary code specialized to these values. In this paper we explore such opportunity to provide an analysis that removes unnecessary overflow tests from JavaScript programs. Our optimization uses range analysis to show that some operations cannot produce overflows. The analysis is linear in size and space on the number of instructions present in the input trace, and it is more effective than traditional range analyses, because we have access to values known only at execution time. We have implemented our analysis on top of Firefox's TraceMonkey, and have tested it on over 1000 scripts from several industrial strength benchmarks, including the scripts present in the top 100 most visited webpages in the Alexa index. We generate binaries to either x86 or the embedded microprocessor ST40-300. On the average, we eliminate 91.82% of the overflows in the programs present in the TraceMonkey test suite. This optimization provides an average code size reduction of 8.83% on ST40 and 6.63% on x86. Our optimization increases TraceMonkey's runtime by 2.53%.