Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

rewrite vm in rust #29

Open
3 tasks
ffwff opened this issue Jun 8, 2019 · 0 comments
Open
3 tasks

rewrite vm in rust #29

ffwff opened this issue Jun 8, 2019 · 0 comments
Assignees
Labels
help wanted Extra attention is needed refactor This should be refactored

Comments

@ffwff
Copy link
Owner

ffwff commented Jun 8, 2019

The VM should be rewritten in Rust for:

  1. Better link-time optimization
  2. Safer abstraction over GC objects (the current C implementation does not increase GC object's reference count which may lead to use-after-free if a GC cycle occurs while the vm is executing an instruction).
  3. 🦀

Cons:

  1. The current Rust reimplementation is 2x slower than the C implementation (this may be due to LLVM adding an additional bound-check branch on instruction dispatching)
  2. Rust does not currently allow packed enums, so values will take 16 bytes (8 data bytes+8 tag bytes) which is less efficient than the current 9 bytes (8 data bytes+1 tag bytes)

Checklist:

  • Port all opcodes from C vm to Rust
  • Values on the VM's stack or global values will be reference counted; This will mean we will have to do extra work whenever we insert or remove a value from the stack or global.
    • Maybe remove VM's tracing function and just consider nodes with non-zero refcount as roots.
  • Standard library functions must be rewritten.

A rewrite will be in order on the riir branch.

@ffwff ffwff self-assigned this Jun 11, 2019
@ffwff ffwff added refactor This should be refactored help wanted Extra attention is needed labels Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed refactor This should be refactored
Projects
None yet
Development

No branches or pull requests

1 participant