Commit b2b14303 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[maglev] Fixed regalloc blocking

Make sure that:

  * Temporaries are consistently free-but-blocked,
  * Blocked registers are ignored when processing free registers (where
    appropriate),
  * Fixed phis are processed before arbitrary register allocation,
  * Blocked state is set and cleared correctly
  * Opportunistic register moves on dropping don't block registers

Bug: v8:7700
Change-Id: I2bc8884f70d9e54ce6ee2fb5bb600b028a9502c3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3732931
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81435}
parent 17da9e70
This diff is collapsed.
......@@ -40,13 +40,14 @@ class RegisterFrameState {
RegTList empty() const { return kEmptyRegList; }
RegTList free() const { return free_; }
RegTList unblocked_free() const { return free_ - blocked_; }
RegTList used() const {
// Only allocatable registers should be free.
DCHECK_EQ(free_, free_ & kAllocatableRegisters);
return kAllocatableRegisters ^ free_;
}
bool FreeIsEmpty() const { return free_ == kEmptyRegList; }
bool UnblockedFreeIsEmpty() const { return unblocked_free().is_empty(); }
template <typename Function>
void ForEachUsedRegister(Function&& f) const {
......@@ -55,7 +56,6 @@ class RegisterFrameState {
}
}
RegisterT TakeFirstFree() { return free_.PopFirst(); }
void RemoveFromFree(RegisterT reg) { free_.clear(reg); }
void AddToFree(RegisterT reg) { free_.set(reg); }
void AddToFree(RegTList list) { free_ |= list; }
......@@ -68,10 +68,17 @@ class RegisterFrameState {
void SetValue(RegisterT reg, ValueNode* node) {
DCHECK(!free_.has(reg));
DCHECK(!blocked_.has(reg));
values_[reg.code()] = node;
block(reg);
node->AddRegister(reg);
}
void SetValueWithoutBlocking(RegisterT reg, ValueNode* node) {
DCHECK(!free_.has(reg));
DCHECK(!blocked_.has(reg));
values_[reg.code()] = node;
node->AddRegister(reg);
}
ValueNode* GetValue(RegisterT reg) const {
DCHECK(!free_.has(reg));
ValueNode* node = values_[reg.code()];
......@@ -80,6 +87,7 @@ class RegisterFrameState {
}
RegTList blocked() const { return blocked_; }
void block(RegisterT reg) { blocked_.set(reg); }
void unblock(RegisterT reg) { blocked_.clear(reg); }
bool is_blocked(RegisterT reg) { return blocked_.has(reg); }
void clear_blocked() { blocked_ = kEmptyRegList; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment