Skip to content

cranelift: Fix br_table for i64 types in x64 backend.#3282

Merged
cfallin merged 2 commits intobytecodealliance:mainfrom
afonso360:x64-fix-brtables
Sep 2, 2021
Merged

cranelift: Fix br_table for i64 types in x64 backend.#3282
cfallin merged 2 commits intobytecodealliance:mainfrom
afonso360:x64-fix-brtables

Conversation

@afonso360
Copy link
Copy Markdown
Contributor

With this PR we fix the compilation crash for br_table.i64. We still only support 2^32 targets, but we now allow that number to come from a i64 value.

I don't really know enough about x86 to improve the Inst::JmpTableSeq and enable 2^64 targets, but I suspect its not likely to be an issue.

Fixes #3100. The CLIF Fuzzer found this independently as soon as I added jump tables.

We still only support a maximum of u32::MAX entries, however we no
longer crash when compiling 64 bit indexes.

Fixes bytecodealliance#3100
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:x64 Issues related to x64 codegen labels Sep 2, 2021
Copy link
Copy Markdown
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Thanks for this fix!

@cfallin cfallin merged commit 6e05b64 into bytecodealliance:main Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cranelift: x64 backend crashes compiling a br_table with i64 type

3 participants