Environments and the complexity of abstract machines

Beniamino Accattoli, Bruno Barras
2017 Proceedings of the 19th International Symposium on Principles and Practice of Declarative Programming - PPDP '17  
machines for functional languages rely on the notion of environment, a data structure storing the previously encountered and delayed beta-redexes. This paper provides a close analysis of the different approaches to define and implement environments. There are two main styles. The most common one is to have many local environments, one for every piece of code in the data structures of the machine. A minority of works instead uses a single global environment. Up to now, the two approaches have
more » ... approaches have been considered equivalent, in particular at the level of the complexity of the overhead: they have both been used to obtain bilinear bounds, that is, linear in the number of beta steps and in the size of the initial term. We start by having a close look on global environments and how to implement them. Then we show that local environments admit implementations that are asymptotically faster than global environments, lowering the dependency from the size of the initial term from linear to logarithmic, thus improving the bounds in the literature. We then focus on a third style, split environments, that are in between local and global ones, and have the benefits of both. Finally, we provide a call-by-need machine with split environments for which we prove the new improved bounds on the overhead. Here we introduce the Milner Abstract Machine (MAM) [4, 38] , a machine with a single global environment for call-by-name evaluation. Machine components. The MAM is defined in Fig. 1 . A machine state s is a triple (t, π , E) given by: • Code t: a term not considered up to α-equivalence, which is why it is over-lined;
doi:10.1145/3131851.3131855 dblp:conf/ppdp/AccattoliB17 fatcat:lygrgkfxxzeixd6bi37uwq5i2y