Optimizing Sideways Composition: Fast Context-oriented Programming in ContextPyPy

The prevalent way of code sharing in many current object systems is static and/or single inheritance; both are limiting in situations that call for multi-dimensional decomposition. Sideways composition provides a technique to reduce their limitations. Context-oriented programming (COP) notably applies sideways composition to achieve better modularity. However, most COP implementations have a substantial performance overhead. This is partly because weaving and execution of layered methods violate assumptions that common language implementations hold about lookup. Meta-tracing just-in-time (JIT) compilers have unique characteristics that can alleviate the performance overhead, as they can treat lookup differently. We show that meta-tracing JIT compilers are good at optimizing sideways composition and give initial, supporting results. Furthermore, we suggest that explicit communication with the JIT compiler in a COP implementation can improve performance further.

[1]  Carl Friedrich Bolz,et al.  Tracing the meta-level: PyPy's tracing JIT compiler , 2009, ICOOOLPS@ECOOP.

[2]  Michael Haupt,et al.  An implementation substrate for languages composing modularized crosscutting concerns , 2009, SAC '09.

[3]  Vasanth Bala,et al.  Dynamo: a transparent dynamic optimization system , 2000, SIGP.

[4]  Robert Hirschfeld,et al.  International Workshop on Context-Oriented Programming , 2009, ECOOP 2009.

[5]  B.N. Freeman-Benson,et al.  The DeltaBlue algorithm: an incremental constraint hierarchy solver , 1989, Eighth Annual International Phoenix Conference on Computers and Communications. 1989 Conference Proceedings.

[6]  Robert Hirschfeld,et al.  An open implementation for context-oriented layer composition in ContextJS , 2011, Sci. Comput. Program..

[7]  Christopher A. Vick,et al.  The Java HotSpotTM Server Compiler , 2001 .

[8]  Robert Hirschfeld,et al.  Efficient Layered Method Execution in ContextAmber , 2015, COP@ECOOP.

[9]  Oscar Nierstrasz,et al.  Context-oriented Programming , 2008, J. Object Technol..

[10]  Cliff Click,et al.  The Java HotSpot Server Compiler , 2001, Java Virtual Machine Research and Technology Symposium.

[11]  G. Newman,et al.  CONFIDENCE INTERVALS , 1987, The Lancet.

[12]  Michael Haupt,et al.  A comparison of context-oriented programming languages , 2009, COP@ECOOP.

[13]  Michael Leuschel,et al.  Runtime feedback in a meta-tracing JIT for efficient dynamic languages , 2011, ICOOOLPS@ECOOP.

[14]  Robert Hirschfeld,et al.  Scoping changes in self-supporting development environments using context-oriented programming , 2012, COP@ECOOP.

[15]  Michael Haupt,et al.  Layered method dispatch with INVOKEDYNAMIC: an implementation study , 2010, COP@ECOOP.

[16]  Franz Puntigam,et al.  Program Execution Environments as Contextual Values , 2014, COP@ECOOP.

[17]  Michael Haupt,et al.  Delegation-based semantics for modularizing crosscutting concerns , 2008, OOPSLA.