Skip to content

Conversation

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Dec 7, 2025

No description provided.

@jgarzik jgarzik requested a review from Copilot December 7, 2025 13:51
@jgarzik jgarzik self-assigned this Dec 7, 2025
@jgarzik jgarzik added the enhancement New feature or request label Dec 7, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a centralized string interning system to replace lexer-local identifier interning, improving memory efficiency and enabling O(1) string equality comparisons throughout the compiler.

Key Changes:

  • New strings.rs module with StringId and StringTable for global string interning
  • Replaced String with StringId in AST, types, and symbols for all identifier names
  • Eliminated identifier ID remapping between tokenizer and preprocessor by sharing the StringTable

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cc/strings.rs New module providing StringId/StringTable interning infrastructure with pre-interned empty string
cc/token/lexer.rs Replaced local IdentTable with StringTable reference, updated API to get/get_opt
cc/token/preprocess.rs Removed ID remapping logic, pass shared StringTable to nested tokenizers
cc/types.rs Changed member/tag names from String to StringId, updated find_member signature
cc/symbol.rs Changed symbol names to StringId, made SymbolError Copy, updated lookup methods
cc/parse/ast.rs Changed all name fields (Ident, Goto, Label, etc.) from String to StringId
cc/parse/parser.rs Updated to work with StringIds, added get_ident_id helper, updated all tests
cc/linearize.rs Added StringTable reference, converts StringIds to Strings at IR boundary
cc/main.rs Creates shared StringTable and threads it through compilation pipeline

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jgarzik jgarzik merged commit 52c61eb into main Dec 7, 2025
10 checks passed
@jgarzik jgarzik deleted the cc branch December 7, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants