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

rewrite vm in rust #29

@ffwff

Description

@ffwff

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.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededrefactorThis should be refactored

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions