Perf: Restore core optimizations and stabilize VM execution

This commit restores and enhances several high-performance features that
were
previously lost, while fixing critical bugs in scope management.

Performance Optimizations:
- Zero-Copy TCO: Refactored TailCallRequest to use (Rc, usize), moving
  arguments
  directly on the VM stack via drain/resize instead of heap-allocating
  Vecs.
- Slice-based Calls: Native functions and field accessors now operate
  directly
  on stack slices, significantly reducing memory churn.
- SoA Push Fast-Path: Restored specialized 'push' intrinsic for
  RecordSeries.
  Matches layouts via Arc::ptr_eq to distribute values directly into
  columns
  without keyword lookups.

Architectural Improvements:
- Static Stack Frames (max_slots): The Binder now calculates the maximum

  required slots per lambda. The VM pre-resizes the stack frame,
  preventing
  collisions between local variables and temporary call arguments.
- Macro Hygiene: Fixed a bug where macro-internal variables could
  overwrite
  outer call arguments due to stack overlap.
- Trait Refactoring: Unified series operations via a polymorphic
  'push_value'
  on the Series trait, with a generic implementation for
  ScalarSeries<T>.

Code Quality:
- Resolved all 'cargo clippy' warnings (collapsible ifs, redundant
  borrows, etc).
- Restored 100% test pass rate (64/64 tests).
- Verified stability of all examples and benchmarks.
This commit is contained in:
Michael Schimmel
2026-03-10 13:06:56 +01:00
parent beb693a068
commit 260669cba1
16 changed files with 237 additions and 260 deletions
@@ -118,6 +118,7 @@ impl SubstitutionMap {
upvalues,
body,
positional_count,
max_slots,
} => {
let mut next_upvalues = Vec::new();
for source in upvalues {
@@ -129,6 +130,7 @@ impl SubstitutionMap {
upvalues: next_upvalues,
body: body.clone(),
positional_count: *positional_count,
max_slots: *max_slots,
},
node.ty.clone(),
)