A hybrid class- and prototype-based object model to support language-neutral structural intercession

Context: Dynamic languages have turned out to be suitable for developing specific applications where runtime adaptability is an important issue. Although .Net and Java platforms have gradually incorporated features to improve their support of dynamic languages, they do not provide intercession for every object or class. This limitation is mainly caused by the rigid class-based object model these platforms implement, in contrast to the flexible prototype-based model used by most dynamic languages. Objective: Our approach is to provide intercession for any object or class by defining a hybrid class- and prototype-based object model that efficiently incorporates structural intercession into the object model implemented by the widespread .Net and Java platforms. Method: In a previous work, we developed and evaluated an extension of a shared-source implementation of the .Net platform. In this work, we define the formal semantics of the proposed reflective model, and modify the existing implementation to include the hybrid model. Finally, we assess its runtime performance and memory consumption, comparing it to existing approaches. Results: Our platform shows a competitive runtime performance compared to 9 widespread systems. On average, it performs 73% and 61% better than the second fastest system for short- and long-running applications, respectively. Besides, it is the JIT-compiler approach that consumes less average memory. The proposed approach of including a hybrid object-model into the virtual machine involves a 444% performance improvement (and 65% less memory consumption) compared to the existing alternative of creating an extra software layer (the DLR). When none of the new features are used, our platform requires 12% more execution time and 13% more memory than the original .Net implementation. Conclusion: Our proposed hybrid class- and prototype-based object model supports structural intercession for any object or class. It can be included in existing JIT-compiler class-based platforms to support common dynamic languages, providing competitive runtime performance and low memory consumption.

[1]  John Gough,et al.  Technical Overview of the Common Language Runtime , 2001 .

[2]  Roberto Ierusalimschy,et al.  Lua—An Extensible Extension Language , 1996, Softw. Pract. Exp..

[3]  Michael Golm,et al.  MetaJava - A Platform for Adaptable Operating-System Mechanisms , 1997, ECOOP Workshops.

[4]  Francisco Ortin Type Inference to Optimize a Hybrid Statically and Dynamically Typed Language , 2011, Comput. J..

[5]  Dave Crane,et al.  Ajax in Action , 2005 .

[6]  Davide Ancona,et al.  A type preserving translation of Fickle into Java , 2001, Electron. Notes Theor. Comput. Sci..

[7]  Craig Chambers,et al.  Organizing programs without classes , 1991, LISP Symb. Comput..

[8]  Fred L. Drake,et al.  The Python Language Reference Manual , 1999 .

[9]  Luca Cardelli,et al.  Operations on Records , 1989, Mathematical Foundations of Programming Semantics.

[10]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[11]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

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

[13]  Markus Dahm,et al.  Byte Code Engineering , 1999, Java-Informations-Tage.

[14]  Reinhold Weicker,et al.  Dhrystone: a synthetic systems programming benchmark , 1984, CACM.

[15]  Shigeru Chiba,et al.  Load-Time Structural Reflection in Java , 2000, ECOOP.

[16]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[17]  Gilad Bracha Pluggable Type Systems , 2004 .

[18]  Henry Lieberman,et al.  Using prototypical objects to implement shared behavior in object-oriented systems , 1986, OOPLSA '86.

[19]  Francisco Ortin,et al.  Union and intersection types to support both dynamic and static typing , 2011, Inf. Process. Lett..

[20]  J. Baltasar García Pérez-Schofield,et al.  Efficient virtual machine support of runtime structural reflection , 2009, Sci. Comput. Program..

[21]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[22]  Francisco Ortin,et al.  Efficient support of dynamic inheritance for class- and prototype-based languages , 2013, J. Syst. Softw..

[23]  Dave Thomas,et al.  Programming Ruby , 2004 .

[24]  Craig Chambers,et al.  The design and implementation of the self compiler, an optimizing compiler for object-oriented programming languages , 1992 .

[25]  Juan Manuel Cueva Lovelle,et al.  Dynamic adaptation of application aspects , 2004, J. Syst. Softw..

[26]  Stefan Hanenberg,et al.  Evolvable Pattern Implementations Need Generic Aspects , 2004, RAM-SE.

[27]  J. Baltasar García Pérez-Schofield,et al.  Including both static and dynamic typing in the same programming language , 2010, IET Softw..

[28]  David J. Lilja,et al.  Measuring computer performance : A practitioner's guide , 2000 .

[29]  Sophia Drossopoulou,et al.  Fickle : Dynamic Object Re-classification , 2001, ECOOP.

[30]  Francisco Ortin,et al.  The Dsaw Aspect-Oriented Software Development Platform , 2011, Int. J. Softw. Eng. Knowl. Eng..

[31]  Guido van Rossum,et al.  The Python language reference manual: for Python version 3.2 , 2011 .

[32]  Stanley B. Zdonik,et al.  Type Evolution in an Object-Oriented Database , 1987, Research Foundations in Object-Oriented and Semantic Database Systems.

[33]  Pierre Cointe,et al.  Definition of a Reflective Kernel for a Prototype-Based Language , 1993, ISOTAS.

[34]  Oscar Nierstrasz,et al.  Traits: A mechanism for fine-grained reuse , 2006, TOPL.

[35]  J. Kleinoder,et al.  MetaJava: an efficient run-time meta architecture for Java/sup TM/ , 1996, Proceedings of the Fifth International Workshop on Object-Orientation in Operation Systems.

[36]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[37]  Optimizing JAsCo dynamic AOP through HotSwap and Jutta , 2004 .

[38]  J. Baltasar García Pérez-Schofield,et al.  Visual Zero: A persistent and interactive object-oriented programming environment , 2008, J. Vis. Lang. Comput..

[39]  Manuel Serrano,et al.  Wide Classes , 1999, ECOOP.

[40]  John F. Roddick,et al.  A survey of schema versioning issues for database systems , 1995, Inf. Softw. Technol..

[41]  Ravi Chugh,et al.  Dependent types for JavaScript , 2012, OOPSLA '12.

[42]  Walid Taha,et al.  Gradual Typing for Objects , 2007, ECOOP.

[43]  Lieven Eeckhout,et al.  Statistically rigorous java performance evaluation , 2007, OOPSLA.

[44]  Jeremy Singer,et al.  JVM versus CLR: a comparative study , 2003, PPPJ.

[45]  Jonathan Aldrich,et al.  EGO: Controlling the Power of Simplicity , 2006 .

[46]  M. Golm,et al.  MetaJava : An Efficient Run-Time Meta Architecture for Java TM , 1996 .

[47]  吴树峰 从学徒到大师之路--读《 The Pragmatic Programmer, From Journeyman to Master》 , 2007 .

[48]  Didier Rémy From Classes to Objects via Subtyping , 1998, ESOP.

[49]  Dave Thomas,et al.  Agile Web Development with Rails , 2005 .

[50]  Gavin M. Bierman,et al.  Adding Dynamic Types to C# , 2010, ECOOP.

[51]  David Thomas,et al.  Agile web development with Rails - a pragmatic guide , 2005 .

[52]  Raúl Izquierdo,et al.  The Runtime Performance of invokedynamic: An Evaluation with a Java Library , 2014, IEEE Software.

[53]  Pattie Maes,et al.  Computational reflection , 1987, The Knowledge Engineering Review.

[54]  Martin D. Westhead,et al.  A benchmark suite for high performance Java , 2000, Concurr. Pract. Exp..

[55]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[56]  Michael Main Mathematical foundations of programming semantics : 5th International Conference, Tulane University, New Orleans, Louisiana, USA, March 29-April 1, 1989, proceedings , 1990 .

[57]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[58]  Michael Golm,et al.  Jumping to the Meta Level: Behavioral Reflection Can Be Fast and Flexible , 1999, Reflection.

[59]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[60]  Takuya Katayama,et al.  Meta Operations for Type Management in Object-Oriented Databases , 1989, DOOD.

[61]  Sophia Drossopoulou,et al.  BabyJ: from object based to class based programming via types , 2003, WOOD.

[62]  Robert Hieb,et al.  The Revised Report on the Syntactic Theories of Sequential Control and State , 1992, Theor. Comput. Sci..

[63]  Antero Taivalsaari,et al.  Delegation versus concatenation or cloning is inheritance too , 1995, OOPS.

[64]  Jay Banerjee,et al.  Semantics and implementation of schema evolution in object-oriented databases , 1987, SIGMOD '87.

[65]  Alan Borning,et al.  Classes versus Prototypes in Object-Oriented Languages , 1986, FJCC.

[66]  Matthias Felleisen,et al.  Semantics Engineering with PLT Redex , 2009 .