cfallin opened PR #4887 from release-1.0.0-pr4882
to release-1.0.0
:
This is a cherry-pick of "Cranelift: add a vreg limit check to correctly return an error on too-large inputs. (#4882)"
This is a low-risk PR that provides a clean error on a too-large Wasm input, rather than panicking; this seems like
an important user-experience improvement for the upcoming release.Previously, Cranelift panicked (via a a panic in regalloc2) when the virtual-register limit of 2M (2^21) was reached. This resulted in a perplexing and unhelpful failure when the user provided a too-large input (such as the Wasm module in #4865).
This PR adds an explicit check when allocating vregs that fails with a "code too large" error when the limit is hit, producing output such as (on the minimized testcase from #4865):
Error: failed to compile wasm function 3785 at offset 0xa3f3 Caused by: Compilation error: Code for function is too large
Fixes #4865.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
cfallin requested alexcrichton for a review on PR #4887.
cfallin requested fitzgen for a review on PR #4887.
alexcrichton submitted PR review.
cfallin merged PR #4887.
Last updated: Dec 23 2024 at 12:05 UTC