Skip to content

[codegen] annotate member-access expressions with concrete class types#668

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

[codegen] annotate member-access expressions with concrete class types#668
cs01 merged 1 commit intomainfrom
member-class

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 22, 2026

Before

`obj.field` expressions where the object is a concrete class weren't cached in the typeOf map. Codegen live-resolved them every time.

After

Member-access expressions whose resolved type has `sourceKind === "class"` are annotated in the typeOf cache.

Description

Narrower relanding of the reverted #662. That PR also included `sourceKind === "interface"`, which caused x86-64-only Stage 0→Stage 1 self-hosting segfaults (passed on arm64, failed on x86-64 Linux CI and macOS CI). Root cause TBD — the class-dispatch path produces arch-divergent IR under `-O2` when an interface answer comes from the annotator cache instead of live-resolution.

Reproduced locally via `scripts/linux-x64.sh verify` (added in #667). Class-only filter passes full 3-stage bootstrap on both arm64 macOS and x86-64 Linux (via podman).

Verification

  • arm64 macOS: `npm run verify` PASSED
  • x86-64 Linux (podman): `bash scripts/linux-x64.sh verify` PASSED (all 3 bootstrap stages)

Refs #658. Interface-kind member_access annotation remains deferred pending x86-64 UB root-cause.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Linux x86-64)

Benchmark C ChadScript Go Node Place
Fibonacci 0.816s 0.763s 1.559s 3.158s 🥇
Hash Map Lookup 0.128s 0.065s 0.093s 0.130s 🥇
Regex Match 0.016s 0.005s 0.021s 0.005s 🥇
Binary Trees 1.606s 1.319s 2.775s 1.239s 🥈
Cold Start 0.8ms 0.9ms 1.3ms 28.6ms 🥈
File I/O 0.123s 0.096s 0.089s 0.208s 🥈
JSON Parse/Stringify 0.036s 0.053s 0.178s 0.138s 🥈
N-Body Simulation 1.672s 2.123s 2.206s 2.387s 🥈
SQLite 0.052s 0.372s 0.506s 0.440s 🥈
Monte Carlo Pi 0.389s 0.410s 0.406s 2.269s 🥉
Quicksort 0.215s 0.259s 0.213s 0.262s 🥉
Sieve of Eratosthenes 0.016s 0.026s 0.020s 0.040s 🥉
String Manipulation 0.008s 0.018s 0.017s 0.037s 🥉
Matrix Multiply 0.476s 0.681s 0.570s 0.379s #4

CLI Tool Benchmarks

Benchmark ChadScript grep node xxd Place
Hex Dump 0.571s 1.003s 0.134s 🥈
Recursive Grep 0.021s 0.011s 0.106s 🥈

@cs01 cs01 merged commit ef48d0b into main Apr 22, 2026
13 checks passed
@cs01 cs01 deleted the member-class branch April 22, 2026 22:50
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