Commits
Click on a commit to change the comparison rangerefactor(vm): extract baml_vm_types crate to decouple compiler from runtime
Create new baml_vm_types crate containing:
- Bytecode and Instruction definitions (617+ instructions)
- Program<T> struct generic over native function bindings
- Value, Object, Function, Class, Enum types
- Type-safe pool indexing (ObjectPool, GlobalPool, Index<K>)
- Jump table data structures for O(1) match dispatch
Key architectural changes:
- baml_compiler_emit now depends only on baml_vm_types, not baml_vm
- Compiler emits Program<()> with unbound native function stubs
- VM binds native functions at construction: Program<()> → Program<NativeFunction>
- New attach_builtins() resolves native function names to implementations
Benefits:
- Compiled programs are now serializable (no function pointers)
- Enables shipping pre-compiled bytecode in inlined_baml
- Reduces code-gen: runtime loads bytecode instead of regenerating
- Cleaner separation between compilation and execution
BREAKING: Vm::from_program() now returns Result<Vm, VmError> since
native function binding can fail if a builtin is not found. Merge branch 'canary' into hellovai/baml_vm_types