Specialization of Generic Array Accesses After Inlining

Ryohei Tokuda
(Graduate School of Information Sciences, Tohoku University, Sendai, Japan)
Eijiro Sumii
(Graduate School of Information Sciences, Tohoku University, Sendai, Japan)
Akinori Abe
(Graduate School of Information Sciences, Tohoku University, Sendai, Japan)

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.

System Description in Jeremy Yallop and Damien Doligez: Proceedings ML Family / OCaml Users and Developers workshops (ML/OCaml 2015), Vancouver, Canada, 3rd & 4th September 2015, Electronic Proceedings in Theoretical Computer Science 241, pp. 45–53.
Published: 7th February 2017.

ArXived at: https://dx.doi.org/10.4204/EPTCS.241.4 bibtex PDF
References in reconstructed bibtex, XML and HTML format (approximated).
Comments and questions to: eptcs@eptcs.org
For website issues: webmaster@eptcs.org