转载请注明,来自:http://blog.csdn.net/skyman_2001

JAM即Joe's Abstract Machine.下面是摘录自http://www.erlang.org/faq/academic.html的关于JAM的说明:

First I designed an abstract machine to execute Erlang. This was called the JAM machine; JAM = Joe's Abstract Machine.

Then I wrote a compiler from Erlang to JAM and an emulator to see if the machine worked. Both these were written in prolog.

At the same time Mike Williams wrote a C emulator for the JAM.

Then I rewrote the erlang-to-jam compiler in Erlang and used the prolog compiler to compile it. The resultant object code was run in the C emulator. Then we threw away prolog.

Some of this is described in an old paper

了解JAM的内部结构对理解Erlang VM很有帮助,Erik Johansson和Christer Jonsson合写的硕士论文《Native Code Compilation for Erlang》里对JAM有比较详细的介绍。这里只捡重要的作为笔记,想详细了解的可以阅读该论文。

1. 寄存器

PC - Pointer to the next instruction  to execute;

STOP - Pointer to the stack top of the active process;

HTOP - Pointer to the heap top of the active process;

ARGS - Pointer to the first argument (on the stack) of the current function;

VARS - Pointer to the first local variable on the stack;

FAIL_PC - Address where execution should continue after a failure;

FAIL_REASON - The reason for the failure;

P - Pointer to the process control block (PCB).

2. 数据表示

3. 代码

The JAM instruction set is implemented with byte codes, making it compact. Code is patched at load time (for example with indexes into the atom table). A module in Erlang is a collection of functions sharing the same name space. Code is loaded one module at the time, when needed.

4. 函数调用

When the function returns, the frame is popped from the stack and the return value is pushed (in the same stack position as the first argument).

5. 并发

每个进程有自己的process control block(PCB), stack和heap。当进程没被执行时,JAM的寄存器存储在PCB中。

Erlang JAM二三话相关推荐

  1. c语言编辑器选择二三话

    学校用的是dev C++蓝色那一款,后来发现有很多版本,还有红色的,挺迷惑的.使用下来这一款的缺点就是没有代码补全功能,无法自动缩进. 后来就尝试用了VS,B站有个UP主花了很长时间讲这个软件怎么使用 ...

  2. 钉钉日志范文100篇_看图写话范文328:暑假旅行(4篇)

    范文01:暑假旅行400字 暑假,我们一家去了嘉兴游玩.嘉兴南湖因红船而成为革命圣地.老爸对于中国近代革命史可谓是如数家珍:"星星之火可以燎原!你们看,当初共产党就是在这么小的一艘船里点燃了 ...

  3. [Erlang 0034] Erlang iolist

    问题的缘起是芒果在使用mochiweb的过程中遇到一个异常,在google的讨论组中我找到了同样的问题: =ERROR REPORT==== 7-Apr-2011::18:58:22 === &quo ...

  4. Erlang(起个中文名:易浪)不能错过的盛宴

    评:erlang(起个中文名:易浪),在穿戴设备技术,云技术,大数据,游戏服务器等等高并发分布式必然大有用处,这个语言必火!-传统语言除了java和c,其他的必然会死去,今后一定会出现新的类erlan ...

  5. [Erlang 0014]Erlang垃圾回收机制

    前面的Erlang杂记中我们简单提到过Erlang的垃圾回收机制:1.以进程为单位进行垃圾回收 2.ETS和原子不参与垃圾回收.今天我们继续这一话题,关注更多关于细节. 在Erlang的官方文档中,关 ...

  6. 经典C语言程序100例之二三

    经典C语言程序100例之二三 如题 话不多说了,直接上代码 如题 [程序23] 题目:打印出如下图案(菱形) 1.程序分析:先把图形分成两部分来看待,前四行一个规律,后三行一个规律,利用双重 for循 ...

  7. 让你受用一辈子的181句话

    一.人之所以痛苦,在于追求错误的东西.   二.与其说是别人让你痛苦,不如说自己的修养不够.   三.如果你不给自己烦恼,别人也永远不可能给你烦恼.因为你自己的内心,你放不下.  四.好好的管教你自己 ...

  8. 一位Erlang程序员的自白

    Erlang不能错过的盛宴 (快步进入Erlang的世界) 作者:成立涛 (litaocheng@gmail.com) 作为程序员,我们曾经闻听很多"业界动态","技术革 ...

  9. “凡事不发朋友圈的人,都是过的不好的人”你认同这句话吗为什么?

    我不认同凡事不发朋友圈的人,都是过得不好的人?恰恰相反,凡事不发朋友圈的人,大部分都是过得很好的人! 本人大约是在2012年开始接触微信,之前跟老板开车,好像老板娘因为充话费还是办业务,送了一台智能机 ...

最新文章

  1. 【Computer Vision】 复现分割网络(1)——SegNet
  2. 别动不动就画折线图了,教你4种酷炫可视化方法
  3. element-ui 2.4.3 如何实现对form部分字段验证的解决方法?
  4. ActiveMQ入门案例-生产者代码实现
  5. 解决LoggerFactory is not a Logback LoggerEither remove Logback or the competing implementation (class
  6. android 对话框 图片,android – AlertDialog按钮的图像
  7. 任意门怎么用团发_衣柜门选用什么材料好?小编在这里告诉你
  8. 代码测试意味着完全消灭了 Bug?
  9. Linux命令解释之fdisk
  10. 锁机制有什么用?简述Hibernate的悲观锁和乐观锁机制
  11. springboot+mybatis+shiro+beetl前端做 服务监控页面
  12. 直播教程 || 虚拟直播设备清单分享,建议收藏~
  13. ZendStudio
  14. linux 软连接和硬链接的区别
  15. IDEA 运行 Tomcat 中文乱码的各种问题
  16. JavaScript设计模式之装饰者模式
  17. 《孤独的美食家》60家餐厅超全觅食攻略,吃货必收!
  18. 机器学习模型融合实战指南
  19. python表示差值_Python-dataframe的对应列求差值
  20. 什么是FEC/NACK/RTX

热门文章

  1. IOS集成微信支付或者支付宝支付功能小结
  2. php oci8 12c.so,编译安装PDO_OCI支持ORACLE 12c
  3. socketio使用
  4. 2021-01-09 matlab
  5. 馈线自动化的主要采用计算机技术,配电及馈线自动化技术探讨
  6. 计算机如何高效识别图像?
  7. python绘制线型图
  8. 【数学 进阶】初等数论 学习笔记
  9. 把自己的控制台变得干干净净!
  10. 通过千千静听歌词服务器下载歌词(c#)