Tags: xepozz/go-lua
Tags
Implement yield across call boundaries (wippyai#23) * remove allocator and switch to immutable value boxing * Add test suite for yield across call boundaries (callR/Call) Tests cover all code paths that use nested mainLoop calls (callR/Call) inside the bytecode loop, where yields from Go functions are not properly propagated: - OP_TFORLOOP: generic for-loop iterators (7 tests) - __index/__newindex metamethods (3 tests) - __add/__sub/__mul arithmetic metamethods (3 tests) - __concat metamethod (1 test) - __unm/__len metamethods (2 tests) - __eq/__lt/__le comparison metamethods (3 tests) - Mixed boundaries and nested scenarios (3 tests) All 22 tests fail, confirming the VM limitation. The bug manifests as either nil pointer dereference (when coroutine state is corrupted) or double-execution of the iterator (callR returns early on yield but the calling opcode continues processing with stale register state). * Implement yield across call boundaries (callR/Call) System yields (Go functions returning -1) now propagate correctly through all VM call paths: callR, Call, getField, setField, objectArith, stringConcat, equals, lessThan, and objectRational. Each opcode site that calls into user code checks yieldState after the call returns. On yield, it saves a continuation type (yieldCont) and target register (yieldContRA), then exits mainLoop. On resume, handleYieldContinuation finishes the opcode's post-call work (store result, update loop control, adjust Pc). Yield state merges the old yielded bool and yieldKind into a single yieldState field (0=none, 1=system, 2=user). coYield returns -2 to distinguish user yields from system yields without pre-setting state before switchToParentThread. coResumePropagate handles system yield propagation through coroutine boundaries, installing a continuation so the next resume re-enters the inner thread.
remove allocator and switch to immutable value boxing (wippyai#22)
Typecheck performance optimizations round (wippyai#20) * check: resolve nested table compatibility across manifest refs * optimize type traversal hot paths for lint perf * perf: reduce checker inference and traversal overhead * perf: cache declared symbol ordering in flow solver * perf: speed resolve symbol typing with cfg scope caches * perf: cache cfg reverse-postorder between mutations * perf: reduce allocations in solver point value map * perf: cut typ traversal and soft-prune overhead * perf: skip expand-instantiated traversal on leaf types * test: remove duplicate join returns-or-unknown case * perf: fast-path soft placeholder pruning on leaf types * perf: cut typ rewrite/prune builder overhead * perf: skip visitor dispatch in typ rewrite/prune * perf: reduce pathkey key construction allocations * perf: reduce path filter key churn * perf: add fast pathkey parsers for flow hot loops * perf: prune mergeFieldAssignments key scans by root prefix * perf: cache flow point versions and reuse symbol type snapshots * perf: reuse typ/flow memo maps in hot narrowing paths * perf: cache resolved path keys during flow narrowing * perf: speed up constraint solving and condition subsumption * types: harden table-top narrowing and index semantics
Resolve nested table compatibility across manifest refs (wippyai#19)
Feature/unified fixpoint kernel (syntetic round) (wippyai#18) Major redundancy reductions, better harness and cleanup.
PreviousNext