This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
In the spill slot allocator, set RangeFragAndRefness::is_ref
to `tr…
#86
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.
Suggestion cannot be applied right now. Please check back later.
…ue` only when we know that
a reftyped
VirtualRange
is going to be spilled. This fixes a conceptual error in stackmapgeneration found by Chris via fuzzing. The error was that
RangeFragAndRefness::is_ref
waspreviously set to
true
too early. Specifically, spill slots for allVirtualRanges
of avirtual range equivalence class are allocated at the point where the first
VirtualRange
in theeclass was spilled. And the
RangeFragAndRefness::is_ref
of allRangeFrag
s owned by theeclass was set to
true
if theVirtualRange
was reftyped.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
VirtualRange
s in the sameeclass 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
RangeFragAndRefness::is_ref
totrue
wheninitially allocating spill slots. Instead, set it (them) later in the process, when spilling a
VirtualRange
that 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.