This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
/ regalloc.rs Public archive
In the spill slot allocator, set
RangeFragAndRefness::is_ref to `tr…
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
…ue` only when we know that
VirtualRangeis going to be spilled. This fixes a conceptual error in stackmap
generation found by Chris via fuzzing. The error was that
previously set to
truetoo early. Specifically, spill slots for all
virtual range equivalence class are allocated at the point where the first
eclass was spilled. And the
RangeFrags owned by the
eclass was set to
From the point of view of "does this spill slot fragment carry a reftyped thing, or not?",
that's exactly correct. However, it ignores the fact that other
VirtualRanges in the same
eclass ultimately might not be spilled. Hence the effect is to potentially mark some of those
spill slot sections as reftyped even though they will never be used. Consequently the client
could end up passing such slot sections to its GC for scavenging etc even though they contain
undefined values. This could cause crashing or worse.
The fix is (conceptually) very simple: don't set
initially allocating spill slots. Instead, set it (them) later in the process, when spilling a
VirtualRangethat is reftyped. A new method,
SpillSlotAllocator::notify_spillage_of_reftyped_vlr, has been added for that purpose.
This was found by Chris' regalloc-result checker and fuzzing. That is fortunate, since it would
have otherwise caused an obscure GC crash which would have been hard to track down.