[Paper Reading] The Implementation of Lua 5.0
来源:互联网 发布:免费买东西软件 编辑:程序博客网 时间:2024/05/23 11:36
Ierusalimschy, R., De Figueiredo, L. H., & Celes Filho, W. (2005). The Implementation of Lua 5.0. J. UCS, 11(7), 1159-1176.
Introduction
Main novelties:
- Register-based virtual machine
- Optimized tables
- Closures
- Coroutines
Values
Dynamically-typed language, basic types:
- nil
- boolean: true, false
- number: double (float/long)
- string: arrays of bytes
- table: associative arrays
- function
- userdata: pointers to user memory blocks: heavy, subject to garbage collection; light, freed by user
- thread: coroutines
typedef struct { int tag; /* Identify the type */ Value v;} TObject;typedef union { GCObject *gc; /* strings, functions, heavy userdata and threads */ void *p; /* light userdata */ lua_Number n; /* numbers */ int b; /* booleans */} Value;
Tables
Hybrid: hash part and array part
Growth of array part:
- at least half the slots between
1 andn are in use - at least on used slot between
n/2+1 andn
Hash part: uses a mix of chained scatter table with Brent’s variation
Functions and Closures
Implement closures: upvalue,
flat closures
Threads and Coroutines
create, resume, yield
interpreter cannot use its internal C stack to implement calls in the interpreted code
uses C stack to keep track of the stack of active coroutines at any given time
cactus structure
The Virtual Machine
0 0
- [Paper Reading] The Implementation of Lua 5.0
- #Paper Reading# X-means:Extending K-means with Efficient Estimation of the Number of Clusters
- Reading Notes of Database System Implementation
- The Implementation of ALG_DES_MAC8_ISO9797_1_M2_ALG3
- The power of Reading
- Paper Reading
- Paper Reading
- Paper-Reading
- The implementation of multiprocess.Queue
- The Backend Implementation of HugeGraph
- #Paper Reading# Bag of Tricks for Efficient Text Classification
- The Importance of Reading Classics
- The Plan Of Reading Books
- reading the path of picture
- JavaScript权威指南(JavaScript The Definitive Guide)- Paper Reading
- #Paper Reading# The Link Prediction Problem for Social Networks
- The Implementation of the 2D-IDCT
- [Paper Reading]开始写Paper Reading Report
- Ubuntu14.04安装nodejs
- 联络员(最小生成树)
- 理解Android进程创建流程
- 浅谈Java中的equals和==
- IT开发人员对Mac钟爱
- [Paper Reading] The Implementation of Lua 5.0
- 通过define _CRTDBG_MAP_ALLOC宏来检测windows上的code是否有内存泄露
- 架构笔记
- TCP窗口控制的作用
- 视图
- python中的字符串
- Android系统启动过程---uboot,kernel,android
- Openstack学习笔记(八)-使用Devstack自动化部署openstack重启脚本
- bash有意思的记录