Skip to content

Conversation

@dylon
Copy link
Collaborator

@dylon dylon commented Dec 27, 2025

Summary

Add additional MettaValue variants:

  • State variant for stateful operations
  • Memo variant for memoized computations
  • Empty variant for void/nil values

Part of Stacked PR Series

This is PR #10 in a 28-PR stacked series implementing the bytecode VM and JIT compiler.
Base: pr09/bytecode-bridge-cache
Next: pr11/modules-system


This PR series implements tiered compilation: tree-walker → bytecode VM → JIT native code

@dylon dylon force-pushed the pr09/bytecode-bridge-cache branch from 092b44c to 52358c1 Compare December 27, 2025 03:57
@dylon dylon force-pushed the pr10/metta-value-state-memo-empty branch from ad0279f to 7abe780 Compare December 27, 2025 03:57
@dylon dylon force-pushed the pr09/bytecode-bridge-cache branch from 52358c1 to 151e9e9 Compare December 27, 2025 06:40
dylon and others added 3 commits December 27, 2025 01:44
Add mork_bridge.rs (~412 lines):
- Bridge between bytecode VM and MORK/Environment for rule dispatch
- Rule compilation caching with hash-based keys
- Pattern specificity calculation for rule ordering
- Stats tracking for cache hit/miss monitoring

Add cache.rs (~309 lines):
- LRU-based bytecode compilation cache
- can_compile result caching for compilability checks
- Fast inline hashing for primitives (Long, Bool, Nil, Float)
- SIMD-accelerated gxhash for complex types (SExpr, Atom, String)

Add gxhash dependency for fast hashing.
Add Rule::new() constructor for test compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add three new variants to MettaValue enum for VM infrastructure:
- State(u64): Mutable state cell reference
- Memo(MemoHandle): Memoization handle for caching
- Empty: Empty result marker for nondeterministic evaluation

Updated pattern matches in:
- bytecode/compiler: Compile State/Memo/Empty to constants
- eval/mod: Evaluate as ground types, format for display
- eval/types: Infer types for new variants
- mork_convert: Convert to MORK representation
- pathmap_par_integration: Convert to Rholang Par
- main.rs: Format for CLI output
- tests: Display and match string representations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dylon dylon force-pushed the pr10/metta-value-state-memo-empty branch from 7abe780 to 399590b Compare December 27, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants