- Add TypeOpKind, WeakRefOp, BarrierOp enums for unified instructions - Implement TypeOp instruction combining TypeCheck/Cast - Implement WeakRef instruction combining WeakNew/WeakLoad - Implement Barrier instruction combining BarrierRead/BarrierWrite - Update VM to handle new unified instructions - Update MIR printer for new instruction formats - Add feature flags mir_typeop_poc and mir_refbarrier_unify_poc - Maintain backward compatibility with legacy instructions This is Phase 8.5 MIR instruction diet PoC implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Examples: Plugin BoxRef Return (v2.2)
- File:
plugin_boxref_return.nyash - Purpose: Demonstrates a plugin method returning a Box (BoxRef/Handle), and passing Box as an argument.
How to run (after full build):
- Ensure
nyash.tomlincludes FileBox with methods:copyFrom = { method_id = 7, args = [ { kind = "box", category = "plugin" } ] }cloneSelf = { method_id = 8 }
- Build the plugin:
cd plugins/nyash-filebox-plugin && cargo build --release - Run the example:
./target/release/nyash docs/examples/plugin_boxref_return.nyash
Expected behavior:
- Creates two FileBox instances (
f,g), writes tof, copies content togviacopyFrom, then closes both.