Skip to content

Use sets instead of hashamps for the spillmaps.#302

Merged
ltratt merged 1 commit intoykjit:mainfrom
vext01:spillsets
Jan 28, 2026
Merged

Use sets instead of hashamps for the spillmaps.#302
ltratt merged 1 commit intoykjit:mainfrom
vext01:spillsets

Conversation

@vext01
Copy link
Copy Markdown

@vext01 vext01 commented Jan 28, 2026

The spillmap analysis has been a consistent source of bugs, mostly (in my opinion) due to the choice of data structures.

This change moves from a hashmap-centric representation to a set-based one. This is much less error prone and easier to understand than our previous hashmap-based method. It's also more compact.

For example, before if we had:

{
    rax -> {rbx, rcx},
    rbx -> {rax, rcx},
    rcx -> {rax, rbx},
    r11 -> {rbp-16},
    // no `rbp-16 -> {r11}` because hashmap keyed by register!
}

Now it is stored as:

[
    {rax, rbx, rcx},
    {r11, rbp-16}
]

This fixes 3 broken benchmarks in an upcoming optimisation branch I have locally. The only reason I don't include the optimisation is that there are some other bugs that need to be fixed first (maybe related to the spill map, maybe not).

The spillmap analysis has been a consistent source of bugs, mostly (in
my opinion) due to the choice of data structures.

This change moves from a hashmap-centric representation to a set-based
one. This is much less error prone and easier to understand than our
previous hashmap-based method. It's also more compact.

For example, before if we had:
{
    rax -> {rbx, rcx},
    rbx -> {rax, rcx},
    rcx -> {rax, rbx},
    r11 -> {rbp-16},
    // no `rbp-16 -> {r11}` because hashmap keyed by register!
}

Now it is stored as:
[
    {rax, rbx, rcx},
    {r11, rbp-16}
]

This fixes 3 broken benchmarks in an upcoming optimisation branch I have
locally. The only reason I don't include the optimisation is that there
are some other bugs that need to be fixed first (maybe related to the
spill map, maybe not).
@vext01 vext01 mentioned this pull request Jan 28, 2026
@ltratt ltratt added this pull request to the merge queue Jan 28, 2026
Merged via the queue into ykjit:main with commit 9e72e86 Jan 28, 2026
2 checks passed
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.

2 participants