Skip to content

Conversation

@indietyp
Copy link
Member

@indietyp indietyp commented Jan 8, 2026

🌟 What is the purpose of this PR?

Add MIR interpreter for executing HashQL code at runtime. This implements a stack-based interpreter that can execute MIR code, handle function calls, and manipulate runtime values.

🔍 What does this change?

  • Adds a complete MIR interpreter implementation in libs/@local/hashql/mir/src/interpret/
  • Implements runtime value representation with support for primitives, aggregates, and collections
  • Adds error handling and diagnostic reporting for runtime errors
  • Implements a call stack for function execution and tracking
  • Adds support for binary and unary operations, control flow, and function calls
  • Enhances the newtype! macro to support custom display formatting
  • Adds reserve method to InternSet for preallocating capacity
  • Updates ID display formatting for better readability in error messages

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Comprehensive test suite for the interpreter covering basic execution, operations, control flow, function calls, and error handling
  • Tests for value representation and manipulation

❓ How to test this?

  1. Run the test suite with cargo test -p hashql-mir
  2. Run Miri tests with cargo miri test -p hashql-mir

@cursor
Copy link

cursor bot commented Jan 8, 2026

PR Summary

Introduces a fully functional MIR interpreter capable of executing MIR with function calls, control flow, and runtime values.

  • Adds interpreter runtime (interpret/{mod.rs,runtime.rs,locals.rs,error.rs,scratch.rs}) with call stack, recursion limit, operand/place evaluation, aggregates, and rich runtime error diagnostics
  • Extends Int with Not/Neg and bitwise ops (and tests); adds op![~] support
  • Improves ID formatting and displays: BasicBlockId (bb{}), Local (%{}); Location/Place string rendering tweaks
  • Enhances newtype! macro with #[display = ..] and #[no_display]; adds InternSet::reserve() and preallocates kinds in type environment
  • Adds imbl dependency (and transitive types) and bumps itertools in prost-*; updates hashql-mir miri test target
  • Adds bundled/dereferenced entity schema fixtures for organization and person

Written by Cursor Bugbot for commit e304b49. This will update automatically on new commits. Configure here.

@github-actions github-actions bot added area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) labels Jan 8, 2026
@indietyp indietyp force-pushed the bm/be-271-hashql-implement-postinline-pass branch from 6cc07e5 to 5a8908d Compare January 15, 2026 13:31
@indietyp indietyp force-pushed the bm/be-257-hashql-implement-interpreter branch from 3fcddd3 to 96a6837 Compare January 15, 2026 13:31
@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
ds-theme Ignored Ignored Preview Jan 17, 2026 5:56pm
hashdotdesign Ignored Ignored Preview Jan 17, 2026 5:56pm

@indietyp indietyp force-pushed the bm/be-271-hashql-implement-postinline-pass branch from 5a8908d to 459c71b Compare January 15, 2026 15:22
@indietyp indietyp force-pushed the bm/be-257-hashql-implement-interpreter branch from 96a6837 to 051b87a Compare January 15, 2026 15:22
@indietyp indietyp force-pushed the bm/be-271-hashql-implement-postinline-pass branch from 459c71b to 693e4eb Compare January 16, 2026 10:38
@indietyp indietyp force-pushed the bm/be-257-hashql-implement-interpreter branch from 051b87a to 4a4305b Compare January 16, 2026 10:38
@indietyp indietyp force-pushed the bm/be-271-hashql-implement-postinline-pass branch from 693e4eb to 8136723 Compare January 16, 2026 13:46
@indietyp indietyp force-pushed the bm/be-257-hashql-implement-interpreter branch from 4a4305b to 28ae173 Compare January 16, 2026 13:46
@indietyp indietyp force-pushed the bm/be-271-hashql-implement-postinline-pass branch from 8136723 to 805b331 Compare January 17, 2026 16:17
@indietyp indietyp force-pushed the bm/be-257-hashql-implement-interpreter branch from 28ae173 to abb2e49 Compare January 17, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

3 participants