Is superoptimization viable for VM instruction sets?
Article first published online: 21 NOV 2013
Copyright © 2013 John Wiley & Sons, Ltd.
Software: Practice and Experience
How to Cite
Hume, T. and Watson, D. (2013), Is superoptimization viable for VM instruction sets?. Softw: Pract. Exper.. doi: 10.1002/spe.2240
- Article first published online: 21 NOV 2013
- Manuscript Accepted: 21 OCT 2013
- Manuscript Revised: 17 OCT 2013
- Manuscript Received: 22 JAN 2013
- virtual machine;
- code optimization
The technique of superoptimization attempts to ensure true optimality of a code (according to predefined criteria) through an exhaustive search of all potentially viable programs. Implementations have demonstrated that superoptimizers are capable of finding shorter programs than those hand optimized for size by experts or produced by conventional compilers. Superoptimizers have been developed for many machine architectures and used for diverse purposes including automating peephole optimization and binary translation of instruction sets. The output of superoptimizers is frequently surprising to human experts and often takes advantage of side effects or obscure characteristics of the targeted hardware. Virtual machines (VMs) are increasingly popular in implementations of programming languages, because they can provide a common platform across heterogeneous hardware architectures. This paper examines whether superoptimization could be a viable technique for VMs. A superoptimizer for the Java VM (JVM) has been developed and used to generate demonstrably size-optimized versions of some simple mathematical functions, implemented in a Java bytecode. We have shown that these versions are shorter than both implementations shipped with the Java software development kit and those generated by the Java compiler. We also have some useful observations concerning techniques to allow larger programs to be optimized in a reasonable time by this approach. Copyright © 2013 John Wiley & Sons, Ltd.