Abstract
In most dynamically typed languages, variables are created without declaring their type. This way of programming allows variable reuse, so that variables sometimes hold different dynamic types in the same scope. Besides, it is also common to use the same variable to hold different dynamic types, depending on the execution flow of the program. When dynamically typed code is compiled into Java and .Net, the dynamic variables are usually generated as Object references. The approach of declaring variables with the top type (e.g. Object in Java and .Net) requires unsafe and inefficient type casts and, sometimes, the use of reflection. We propose the use of SSA (Static Single Assignment) transformations to facilitate inferring the type of dynamically typed local variables. The approach has been included in an existing compiler for the .Net framework. The result is that dynamically typed code performs significantly better when the SSA transformations are used, and it outperforms C#. Our technique reduces memory consumption at runtime by 35%, but increases compilation time by 13%.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.