Commit Graph
4 Commits
Author SHA1 Message Date
Andrew Hundt f339aa625f perf(lsp): collapse repeated Python scope-chain lookups
Add cbm_scope_lookup_binding so callers can read lexical presence, type, and callable identity in one traversal. Route Python expression, call, and callable-reference resolution through that complete binding and use the existing checked bind APIs for allocation-failure detection.

The neutral 11-pair production matrix kept exact output parity. Python scale latency was 4.33% below merge parent 07255cfe and 61.01% below upstream parent 0c64de93; incremental instructions were 3.09% and 54.07% lower. Focused ASan/UBSan scope and Python suites passed 33 and 125 tests.

Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
(cherry picked from commit 4d3a103047)
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-09-28 00:13:39 +02:00
Martin Vogel 300225c09d wip: capture remaining semantic reference regressions
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-07-18 15:52:50 +02:00
Martin Vogel 87a0e3f74f fix: preserve semantic graph relationships
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-07-18 15:52:50 +02:00
Martin Vogel 6757dc8c0c refactor(lsp): chunked linked-frame CBMScope + MRO depth cap
Phase 0 of Python LSP integration. Two shared-infrastructure fixes that
silently bug Python without affecting Go/C++ regression tests:

- CBMScope replaces the fixed 64-binding array with a growable linked
  list of 16-binding chunks. The arena pointer is captured at scope_push
  and reused for chunk allocation, so existing callers benefit from
  dynamic growth without an API change. Python class bodies and large
  dataclass scopes routinely exceed 64 locals; this prevents silent
  drops past the legacy cap.

- CBM_LSP_MAX_LOOKUP_DEPTH=16 wraps go_lookup_field_or_method and
  c_lookup_member via depth-aware internal helpers. Pathological
  multi-inheritance hierarchies (SQLAlchemy / Django / Zope) can exceed
  20 levels and previously stack-overflowed; now they degrade to NULL
  past depth 16 instead.

Adds tests/test_scope.c with 10 cases covering basic API, parent-chain
walks, child-shadowing, and dynamic growth at 300 bindings + chunk
boundaries. test_main.c and Makefile.cbm wire the new suite.

PYTHON_LSP_PLAN.md added at the worktree root: full phased plan plus
the verbatim challenger review.

All 2823 existing tests stay green; 10 new scope tests pass.
2026-05-08 22:26:56 +02:00