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.
Move `Purity` enum definition from `optimizer.rs` to `types.rs` and
create a `NativeFunction` struct to hold the function and its purity.
Update `Value::Function` to store `Rc<NativeFunction>` and
`Value::make_function`
helper to simplify creation.
This change allows tracking the purity of native functions, which is
useful
for optimization and static analysis.