English

Specialization of Generic Array Accesses After Inlining

Programming Languages 2017-02-09 v1

Abstract

We have implemented an optimization that specializes type-generic array accesses after inlining of polymorphic functions in the native-code OCaml compiler. Polymorphic array operations (read and write) in OCaml require runtime type dispatch because of ad hoc memory representations of integer and float arrays. It cannot be removed even after being monomorphized by inlining because the intermediate language is mostly untyped. We therefore extended it with explicit type application like System F (while keeping implicit type abstraction by means of unique identifiers for type variables). Our optimization has achieved up to 21% speed-up of numerical programs.

Keywords

Cite

@article{arxiv.1702.02283,
  title  = {Specialization of Generic Array Accesses After Inlining},
  author = {Ryohei Tokuda and Eijiro Sumii and Akinori Abe},
  journal= {arXiv preprint arXiv:1702.02283},
  year   = {2017}
}

Comments

In Proceedings ML/OCaml 2015, arXiv:1702.01872

R2 v1 2026-06-22T18:12:21.088Z