Title: [295606] trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp
Revision
295606
Author
sbar...@apple.com
Date
2022-06-16 12:51:36 -0700 (Thu, 16 Jun 2022)

Log Message

Change how we rewind instructions in Air's O0 register allocator
https://bugs.webkit.org/show_bug.cgi?id=241687

Reviewed by Mark Lam.

* Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
(JSC::B3::Air::GenerateAndAllocateRegisters::generate):

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp (295605 => 295606)


--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp	2022-06-16 19:44:58 UTC (rev 295605)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp	2022-06-16 19:51:36 UTC (rev 295606)
@@ -590,6 +590,7 @@
             context.indexInBlock = instIndex;
 
             Inst& inst = block->at(instIndex);
+            Inst instCopy = inst;
 
             m_namedUsedRegs = RegisterSet();
             m_namedDefdRegs = RegisterSet();
@@ -753,26 +754,7 @@
                 if (!success) {
                     RELEASE_ASSERT(!isReplayingSameInst); // We should only need to do the below at most once per inst.
 
-                    // We need to capture the register state before we start spilling things
-                    // since we may have multiple arguments that are the same register.
-                    IndexMap<Reg, Tmp> allocationSnapshot = currentAllocation;
-
-                    // We rewind this Inst to be in its previous state, however, if any arg admits stack,
-                    // we move to providing that arg in stack form. This will allow us to fully allocate
-                    // this inst when we rewind.
-                    inst.forEachTmpFast([&] (Tmp& tmp) {
-                        if (!tmp.isReg())
-                            return;
-                        if (isDisallowedRegister(tmp.reg()))
-                            return;
-                        Tmp originalTmp = allocationSnapshot[tmp.reg()];
-                        if (originalTmp.isReg()) {
-                            ASSERT(tmp.reg() == originalTmp.reg());
-                            // This means this Inst referred to this reg directly. We leave these as is.
-                            return;
-                        }
-                        tmp = originalTmp;
-                    });
+                    inst = instCopy;
                     inst.forEachArg([&] (Arg& arg, Arg::Role, Bank, Width) {
                         if (arg.isTmp() && !arg.tmp().isReg() && inst.admitsStack(arg)) {
                             Tmp tmp = arg.tmp();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to