Skip to content

codegen: perry_method_<Class>__<name> emission order is HashMap-nondeterministic when a method name is shared across classes (#7038/#7039 family) #7172

Description

@proggeramlug

Found during PR #7171's IR-neutrality verification (macOS arm64, same-compiler control runs): emitted LLVM IR is nondeterministic when a method name is shared across classesperry_method_<Class>__<name> symbols are emitted in HashMap iteration order, so two runs of the same compiler on the same source produce differently-ordered IR.

Observed on real dependency files: vite's module-runner.js and rollup's shared/index.js (the two corpus files excluded as control-failed in #7171's 47/0/2 IR comparison — reported honestly as control failures, not counted as passing).

Class

Same family as #7038/#7039 (closure-source HashMap iteration made @.str.N numbering a per-process permutation on macOS — fixed by sorting) and #7131 (Linux temp names — fixed). This is the method-emission sibling: cross-class shared method names iterate an unordered map.

Why it matters

Repro

Compile vite/dist/node/module-runner.js (or rollup shared/index.js) twice with the same compiler, --trace llvm or --no-link, diff the IR: method-symbol ordering differs run-to-run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions