Skip to content

Type descriptors, ownership routines and object vtables are named from the type's text - #820

Merged
ASDAlexander77 merged 1 commit into
mainfrom
type-name-hashes
Nov 12, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
type-name-hashes

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Follows #819, which did this for constant arrays. Every symbol that was named from a type's address is now named from the type's printed text.

The bug

These names came from hash_value(type), which hashes the type's storage address with a weak mix:

  • type descriptors (td_);
  • the ownership routines: tsrel_, tsret_, tsshr_, tsshrbox_, tsrelrec_, and those built from a prefix;
  • an object's interface vtable (Shape.136163259..vtbl).

So the names changed from run to run. Two different types could also land on the same name, and then share one type descriptor or one release routine.

The fix

MLIRHelper::hashOfType hashes the type as MLIR prints it, with xxh3_64bits, as #819 does for constant arrays. Every one of those sites now uses it. A file name was already hashed by its text, so AssertLogic's f_ name is unchanged.

Checks

  • Stable output: 74 builds (25 tests × rc, own and none), each compiled twice, gave byte-identical IR both times. With the previous compiler, 51 of the same 74 differed between two runs.
  • No types merged: across 98 builds (49 tests × rc and own), the number of distinct type descriptors and ownership routines is the same as with the previous compiler.
  • Compile time: within noise. The four largest tester files, compiled three times each: 921 ms before, 931 ms after.
  • Native ctest: 6976/6976.
  • wasm suites, release and debug, wasm32 and wasm64: 0 failures. tester 652 (none, rc) and 486 (own); default library none 206, rc 207, own 206.

🤖 Generated with Claude Code

…m the type's text

td_, tsrel_, tsret_, tsshr_, tsshrbox_, tsrelrec_ and the other ownership routines,
and an object's interface vtable, were named from hash_value(type): the type's
storage address, weakly mixed. The names changed from run to run, and two types could
share one name and so one descriptor or release routine. MLIRHelper::hashOfType
hashes the type as MLIR prints it (xxh3), as the constant arrays' names now are.
A program now compiles to the same IR every time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 916677a into main Nov 12, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the type-name-hashes branch November 12, 2026 10:12
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