Repository navigation
Compact checker type metadata - #64774
Merged
Jake Bailey (jakebailey) merged 1 commit intoOct 14, 2026
Merged
Jake Bailey (jakebailey) merged 1 commit into
Jake Bailey (jakebailey) merged 1 commit into
Conversation
Each type carries a self-referential interface solely to recover its concrete representation. That costs space in every type and adds GC pointer work even though the representation is fixed at construction. A compact concrete-kind tag saves 16 bytes per type on 64-bit hosts. Keep it separate from mutable semantic flags so casts stay valid as checking discovers more information.
Jake Bailey (jakebailey)
added this pull request to stack #64792
October 13, 2026 17:37
Jake Bailey (jakebailey)
marked this pull request as ready for review
October 13, 2026 17:41
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The foundational unsafe-pointer representation change affects every checker type and warrants final human validation.
0 open findings
What changed in this PR
Replaces self-referential type metadata with compact kind tags and offset-zero casts, reducing checker memory usage.
Changes:
- Adds tagged concrete and base-type casts with layout assertions.
- Updates type construction and tracing.
- Adds cast, allocation-lifetime, size tests, and a checker benchmark.
| File | Description |
|---|---|
tsc/internal/checker/types.go |
Defines compact type metadata and casts. |
tsc/internal/checker/checker.go |
Assigns concrete kinds during construction. |
tsc/internal/checker/tracer.go |
Uses kind-aware intrinsic access. |
tsc/internal/checker/types_test.go |
Tests casts and header size. |
tsc/internal/checker/checker_test.go |
Tests allocation lifetime and benchmarks checking. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Jake Bailey (jakebailey)
removed this pull request from stack #64792
October 13, 2026 20:15
Jake Bailey (jakebailey)
added this pull request to stack #64805
October 13, 2026 20:16
Jake Bailey (jakebailey)
removed this pull request from stack #64805
October 13, 2026 20:49
Jake Bailey (jakebailey)
added this pull request to stack #64806
October 13, 2026 20:50
Anders Hejlsberg (ahejlsberg)
approved these changes
Oct 13, 2026
Jake Bailey (jakebailey)
deleted the
jakebailey/mem/compact-type-headers
branch
October 14, 2026 01:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each type carries a self-referential interface solely to recover its concrete representation. Replace it with a compact concrete-kind tag, separate from the mutable semantic flags, and recover the concrete type from its offset-zero header.
Part of the memory optimization stack summarized in #64734.