An Introduction to Efficient and Safe Implementations of Dynamic Languages

栏目: IT技术 · 发布时间: 4年前

内容简介:Last September, I had a lot of fun putting together a lecture on language implementation techniques. It is something I wanted to do for a while, but I had not had a good excuse before to actually do it.When I got asked to give this lecture at a Dagstuhl su

Last September, I had a lot of fun putting together a lecture on language implementation techniques. It is something I wanted to do for a while, but I had not had a good excuse before to actually do it.

When I got asked to give this lecture at a Dagstuhl summer school, I posted an outline on Twitter, and as one might expect, some people raised concerns about things that are missing. And, indeed, it’s far from complete, and biased by my own experience, background, and research. Though, perhaps it is still useful for others.

Abstract

Dynamic languages leave all hard problems to the runtime system. Some argue this allows programmers to focus on the application they implement, but it also means that dynamic language implementations have to learn at run time what a program does so that they can execute it efficiently.
This lecture will give a brief introduction into implementation techniques, starting from abstract-syntax-tree and bytecode interpreters, and then going to modern just-in-time compilation approaches based on partial evaluation or meta-tracing. We will review ideas such as inline caching, hidden classes, and storage strategies to understand better how dynamic languages can reach the performance of less dynamic languages such as Java or C.
Optimizations such as storage strategies unfortunately have a major impact on thread safety for dynamic languages such as Ruby and Python, which use shared memory multi-threading. To ensure that we can implement such languages with safe and efficient parallelism, we will also review variations for classic storage strategies and object models for parallel virtual machines.
Last but not least, since the techniques are all about performance, we have to discuss how to effectively assess optimizations. Modern virtual machines and hardware systems are far from the deterministic machines we expect, which means we have to take extra care when measuring and reporting performance numbers.

The final agenda for the lecture included:

  • interpretation
    • abstract syntax trees
    • bytecodes
  • optimizations at the interpreter level
    • caching, and lookup caching in particular
    • bytecode quickening
    • self-optimizing AST interpreters
  • just-in-time compilation
    • basic ideas of compilation at run time
    • metacompilation techniques based on meta-tracing and partial evaluation
  • efficient data representation
    • maps, hidden classes, shapes
    • storage strategies
  • data representations for multithreaded VMs
    • concurrent shapes
    • concurrent strategies
  • benchmarking
    • pitfalls
    • recommendations

This means there are indeed very many things, I haven’t been talking about. This includes fundamental ideas such as garbage collection, compiler optimizations and their intermediate representations, tiered compilation, tooling for debugging & profiling, and metacircularity. Perhaps, I get to teach a full course at some point, and can include them.

Until then, the following slides might be useful to others.


以上所述就是小编给大家介绍的《An Introduction to Efficient and Safe Implementations of Dynamic Languages》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

离散数学及其应用(原书第7版)

离散数学及其应用(原书第7版)

Kenneth H. Rosen / 徐六通、杨娟、吴斌 / 机械工业出版社 / 2015-1-1 / 129

《计算机科学丛书:离散数学及其应用(原书第7版)》是介绍离散数学理论和方法的经典教材,已经成为采用率最高的离散数学教材,被美国众多名校用作教材,获得了极大的成功。中文版也已被国内大学广泛采用为教材。作者参考使用教师和学生的反馈,并结合自身对教育的洞察,对第7版做了大量的改进,使其成为更有效的教学工具。《计算机科学丛书:离散数学及其应用(原书第7版)》可作为1至2个学期的离散数学课入门教材,适用于数......一起来看看 《离散数学及其应用(原书第7版)》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试