Skip to main content

High-performance Rust VM for Machine Dialect™

Project description

Machine Dialect™ Rust VM

High-performance register-based virtual machine for executing Machine Dialect™ bytecode.

Overview

This is the Phase 0 implementation of the Machine Dialect™ Rust VM, providing:

  • 256 general-purpose registers
  • Type-safe value system (Empty, Bool, Int, Float, String, Function, URL)
  • Register-based instruction set
  • MIR support (SSA phi nodes, assertions, scopes)
  • Runtime operations (arithmetic, logic, comparisons, strings)
  • PyO3 bindings for Python integration
  • Reference counting memory management

Building

Prerequisites

  • Rust 1.70+
  • Python 3.9+
  • maturin (install via uv sync --all-groups)

Build Instructions

From project root:

./build_vm.sh

Or manually:

cd machine_dialect_vm
maturin develop --features pyo3

Architecture

The VM uses a register-based architecture with:

  • Register File: 256 registers with type tracking
  • Instruction Set: ~40 register-based instructions
  • Value System: Tagged union for efficient value representation
  • Runtime Operations: Type-safe arithmetic and string operations
  • Memory Management: Reference counting for strings and objects

Integration

The VM integrates with the Python frontend via PyO3 bindings, allowing:

  1. Python compiler generates MIR
  2. MIR is optimized
  3. Register-based bytecode is generated
  4. Rust VM executes bytecode
  5. Results returned to Python

Performance

Measured performance (via Criterion benchmarks):

  • Simple addition: ~1.02 µs per operation
  • VM creation: ~3.49 µs
  • Target: 5-10x speedup over Python interpreter

Run benchmarks:

cargo bench --bench basic_benchmark

Status

Phase 0 (MVP) implementation 92% complete:

Completed ✅

  • Core VM engine with 256 registers
  • Full value and type system (including arrays)
  • Complete instruction set (38 opcodes)
  • All runtime operations (arithmetic, logic, string, array)
  • Binary bytecode loader (.mdbc format)
  • PyO3 bindings with Python integration
  • Python bytecode generator and serializer
  • Performance benchmarks
  • REPL integration (with fallback)

Remaining Work

  • End-to-end execution validation
  • Expanded test coverage
  • Production hardening

Next Steps

Phase 1 will add:

  • Type-specialized instructions
  • Advanced memory management
  • Performance optimizations
  • Collection types (arrays, maps, sets)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

machine_dialect_vm-0.1.0a1-cp39-abi3-manylinux_2_34_x86_64.whl (272.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

File details

Details for the file machine_dialect_vm-0.1.0a1-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a1-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7d58312c75eec0af65f656f030719733e3926815ad8d281f194732956ad3b61a
MD5 f7e4a951392536f4fb9cfd39d6a2a418
BLAKE2b-256 eccaf396ed5e98b30abd04f8fa781e224375407fa4b264152072a0a7888b735a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page