Alternate Lua virtual machine (WIP)
| stc | ||
| dump.h | ||
| lexer.c | ||
| lexer.h | ||
| main.c | ||
| Makefile | ||
| parse.c | ||
| parse.h | ||
| README.md | ||
| str.h | ||
| table.h | ||
| value.h | ||
| vm.c | ||
| vm.h | ||
Impotent
This is an attempt to create a Lua virtual machine capable of true multithreading. Once the nctref compiler matures enough, I intend to plug it into Impotent as a JIT.
Completed features:
- Per-thread heap /w special heap for exited threads called the "dead heap"
- Naive mark & sweep GC
- Completely thread-safe, including lock-free implementation for tables
Impotent is still work-in-progress:
- Integers are 32-bit only
- No error handling, meaning any mistake will either crash the VM or make it silently fail
- The only standard library is
printand it doesn't work correctly - Tables cannot be resized
- Most operators are still missing
- The user API is completely different from that of PoC Lua
- Being lock-free, tables are not split to "array" and "hash" parts
Impotent requires C11 and an architecture with 8-byte atomic operations, but otherwise it is completely cross-platform.
Performance-wise, it's surprisingly competitive with PoC Lua, considering how quickly it was made up to the point of writing this README (~2 weeks). By far the worst bottleneck is the GC, since it requires all threads and their heaps to synchronize.