ion: reject a fixed def that conflicts with a clobber - #266
agourakis82 wants to merge 1 commit into
Conversation
A clobber is a fixed late def of a throwaway vreg. When a real fixed def occupies that same register, the bundle is minimal and the reservation cannot be evicted, so allocation is impossible. Return TooManyLiveRegs instead of panicking. Fixes bytecodealliance#222. Co-Authored-By: Claude <noreply@anthropic.com>
|
I did a small independent read-through and local verification of this PR. The fix matches the documented I also verified the new regression test locally at the PR head: So from my review, returning |
|
@agourakis82 to clarify, when you say
do you mean to say that you did not read the initial diff that you submitted? I am somewhat confused by your use of the word "independent", as you are both the original author and the purported "independent" reader. (The change looks reasonable, and sorry that I've been slow to review -- very busy -- but now that you post the above, I'd want to get clarification on the development process and your level of involvement before moving forward.) |
|
Thanks for asking, and sorry for the confusing wording. I authored the patch and also did a separate pass over the final diff and targeted test after the fact, using AI assistance as a review aid. So "independent" was not meant to imply an independent human reviewer; it was my own follow-up verification pass. I am the human author/reviewer for the change and can answer questions about the code and test. |
cfallin
left a comment
There was a problem hiding this comment.
Thanks -- I think the fix is right, but I'd like to see this fuzzed (and not unit-tested -- that's too white-box and leaves interactions with other parts of the allocator untested). Once you've got fuzzing supported, let's fuzz for at least 24 hours on a fast machine to ensure that we don't have unexpected interactions.
| } | ||
|
|
||
| #[test] | ||
| fn fixed_def_conflicting_with_clobber_is_an_error() { |
There was a problem hiding this comment.
I don't think we need this test: we don't have any other unit tests like this, it's quite verbose, and we can instead test by modifying the fuzzer to generate such cases.
Can you update the fuzzer to generate these cases?
Fixes #222.
A clobber is documented as a fixed late def of a throwaway vreg, and
Function::inst_clobbersstates that naming the same physical register as both a clobber and a fixed def or late use is illegal. The ion allocator modeled that overlap as a non-evictable fixed reservation, then panicked:The bundle pinned to that register is minimal, so it cannot be split or moved, and the clobber cannot be evicted. Allocation is impossible. Return
RegAllocError::TooManyLiveRegsinstead, which is the existing error for impossible fixed constraints.The regression test is the program from #222: a late def fixed in
p0on an instruction that also clobbersp0.