Staged static techniques to efficiently implement array copy semantics in a MATLAB JIT compiler

  • Authors:
  • Nurudeen Lameed;Laurie Hendren

  • Affiliations:
  • School of Computer Science, McGill University, Montréal, QC, Canada;School of Computer Science, McGill University, Montréal, QC, Canada

  • 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

Matlab has gained widespread acceptance among scientists. Several dynamic aspects of the language contribute to its appeal, but also provide many challenges. One such problem is caused by the copy semantics of Matlab. Existing Matlab systems rely on reference-counting schemes to create copies only when a shared array representation is updated. This reduces array copies, but requires runtime checks. We present a staged static analysis approach to determine when copies are not required. The first stage uses two simple, intraprocedural analyses, while the second stage combines a forward necessary copy analysis with a backward copy placement analysis. Our approach eliminates unneeded array copies without requiring reference counting or frequent runtime checks. We have implemented our approach in the McVM JIT. Our results demonstrate that, for our benchmark set, there are significant overheads for both existing reference-counted and naive copy-insertion approaches, and that our staged approach is effective in avoiding unnecessary copies.