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 Distribution

machine_dialect_vm-0.1.0a2.tar.gz (46.4 kB view details)

Uploaded Source

Built Distributions

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

machine_dialect_vm-0.1.0a2-cp39-abi3-win_amd64.whl (185.4 kB view details)

Uploaded CPython 3.9+Windows x86-64

machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (273.0 kB view details)

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

machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (255.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_11_0_arm64.whl (243.2 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_10_12_x86_64.whl (262.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file machine_dialect_vm-0.1.0a2.tar.gz.

File metadata

  • Download URL: machine_dialect_vm-0.1.0a2.tar.gz
  • Upload date:
  • Size: 46.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for machine_dialect_vm-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 ce9bf51505a182d68545a4864cf91493b1d79b48db495f7a6135d83a8c56705f
MD5 9abe31eabea62ac789a28fac06bdff2d
BLAKE2b-256 fde8035b3586f63e6855b23cebbb59ec7e0a57fbeaea5f7915a555901ede83cc

See more details on using hashes here.

File details

Details for the file machine_dialect_vm-0.1.0a2-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2fa51b452f44ef3f28f004ffca581a48ad10f25fd844a69662dc8ccdf84f0a48
MD5 a345c438651d4717520682fe26c6c6e6
BLAKE2b-256 e0dcc076359f74c3207115671fc5409d70e01f69fd2d2582037456e5969f9387

See more details on using hashes here.

File details

Details for the file machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17fa57d1c1d10baf5454878ec6bf9a189768a01c17e679f56e23391b0084619a
MD5 3f74b31d768f9937ed56279ac5b20928
BLAKE2b-256 66c82c9a61c4fec6f8aec6a29752c6e99b09cccfa71c41d0bba7a11e8bc34a0c

See more details on using hashes here.

File details

Details for the file machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc6ec8f45ae23a1bc9e1aaf2c5e68d20124670e79651810a0cbe3417e1a29a58
MD5 76bed5c474a2f267c228beda02a1335d
BLAKE2b-256 2b4471e374a9a9a2ba8a68bd83a5931edeafceae1ae6ae9721f0bc0436396b29

See more details on using hashes here.

File details

Details for the file machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0eed0060c23a47712b84c6e1487833f816203e66a81d22121b457aa93caa589
MD5 7aa06e44d20597ffcb1d64615c37074c
BLAKE2b-256 cb3e63cfefe26ab3a97ff98edee790ed5d865627dca1ef7d7725f74ff0480806

See more details on using hashes here.

File details

Details for the file machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for machine_dialect_vm-0.1.0a2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c1824458137cd6a493261630f866b72a011130093b3b067e3eb1644ed5890118
MD5 07fcc2375103ecfd4bacf7cfa15979cc
BLAKE2b-256 158db20a3b6dd8c527ea8c395c2d0796b59b958cc97703182e51d31547ef4e42

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