Skip to content

[codegen] annotate member-access expressions with class/interface types#662

Merged
cs01 merged 1 commit intomainfrom
gate-loosen-member
Apr 22, 2026
Merged

[codegen] annotate member-access expressions with class/interface types#662
cs01 merged 1 commit intomainfrom
gate-loosen-member

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 22, 2026

Before

The typeOf cache held only primitive literals and variable-read results (from #660/#661). Member-access expressions like `obj.field` fell through to live-resolution at every codegen site.

After

`member_access` expressions whose resolved type is a concrete class or interface are now annotated. Codegen sites reading `typeOf(obj.field)` get the cached answer.

Description

Step 2 of #658 gate-loosening plan.

Same source-kind filter as step 1 (`class` | `interface`). Unfiltered annotation (including primitives/arrays/Map/Set) segfaulted Stage 1 self-hosting; filtering to the shapes whose LLVM representation is fully determined by the base name sidesteps the symbol-table disagreement.

Verification

  • `npm run verify` (Stage 0 + Stage 1 + Stage 2 self-hosting + full test suite): PASSED

Refs #658.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Linux x86-64)

Benchmark C ChadScript Go Node Place
Fibonacci 0.815s 0.767s 1.565s 3.228s 🥇
Hash Map Lookup 0.092s 0.063s 0.091s 0.124s 🥇
Binary Trees 1.355s 1.256s 2.758s 1.171s 🥈
Cold Start 0.8ms 0.9ms 1.2ms 27.2ms 🥈
File I/O 0.118s 0.096s 0.086s 0.208s 🥈
JSON Parse/Stringify 0.037s 0.053s 0.178s 0.134s 🥈
N-Body Simulation 1.677s 2.118s 2.208s 2.389s 🥈
Regex Match 0.016s 0.005s 0.021s 0.005s 🥈
SQLite 0.053s 0.366s 0.484s 0.411s 🥈
Monte Carlo Pi 0.390s 0.411s 0.405s 2.251s 🥉
Quicksort 0.215s 0.247s 0.213s 0.263s 🥉
Sieve of Eratosthenes 0.016s 0.028s 0.019s 0.038s 🥉
String Manipulation 0.008s 0.020s 0.019s 0.038s 🥉
Matrix Multiply 0.465s 0.998s 0.567s 0.379s #4

CLI Tool Benchmarks

Benchmark ChadScript grep node xxd Place
Hex Dump 0.650s 0.966s 0.133s 🥈
Recursive Grep 0.022s 0.011s 0.107s 🥈

@cs01 cs01 merged commit 395733d into main Apr 22, 2026
13 checks passed
@cs01 cs01 deleted the gate-loosen-member branch April 22, 2026 18:02
cs01 added a commit that referenced this pull request Apr 22, 2026
…face types (#662)" (#666)

Broke Stage 0 → Stage 1 self-hosting on x86-64 (Linux + macOS CI). Passes on arm64 locally. Needs x86-64-specific investigation before relanding.

Refs #658.

Co-authored-by: cs01 <cs01@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant