[webkit-changes] [WebKit/WebKit] 985c61: [JSC][GreedyRegAlloc] Fix validateAssignments fals...

Dan Hecht noreply at github.com
Thu Feb 20 15:01:57 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 985c61c7ea2b5aab077121c0a820b5666c59b587
      https://github.com/WebKit/WebKit/commit/985c61c7ea2b5aab077121c0a820b5666c59b587
  Author: Dan Hecht <dan.hecht at apple.com>
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
    M Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp

  Log Message:
  -----------
  [JSC][GreedyRegAlloc] Fix validateAssignments false positive failure
https://bugs.webkit.org/show_bug.cgi?id=288134
rdar://145238099

Reviewed by Yusuke Suzuki.

After the register allocator runs, validateAssignments()
(in assert builds) uses WTF::Liveness and Air::LivenessAdapter
to verify using brute force that no interfering Tmps were
allocated to the same register.

However, WTF::Liveness/Air::LivenessAdapter doesn't handle
a late-use of %tmpA followed immediately by an early-def of
%tmpB optimally, and has both tmpA and tmpB live during the
gap between these two instructions, which is overly
conservative. This triggers a false positive validation failure.

To work around this, insert a Nop when inserting a
Move-spill-spill-scratch instruction. Note that the graph
allocator does the same thing, where it is needed there
in order to no have false interference. In the greedy
allocator case, it is needed only to appease the validator.

I may rethink this later, see https://bugs.webkit.org/show_bug.cgi?id=288122
but adding these Nops appear to have no negative impact on benchmarks.

* Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp:
(JSC::B3::Air::Greedy::GreedyAllocator::run):
(JSC::B3::Air::Greedy::GreedyAllocator::validateAssignments):
(JSC::B3::Air::Greedy::GreedyAllocator::initSpillCosts):
(JSC::B3::Air::Greedy::GreedyAllocator::allocateRegisters):
(JSC::B3::Air::Greedy::GreedyAllocator::trySplitAroundClobbers):
(JSC::B3::Air::Greedy::GreedyAllocator::emitSpillCodeAndEnqueueNewTmps):

Canonical link: https://commits.webkit.org/290747@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list