Title: [250176] trunk/Source/_javascript_Core
Revision
250176
Author
keith_mil...@apple.com
Date
2019-09-20 19:11:37 -0700 (Fri, 20 Sep 2019)

Log Message

eliding a move in Air O0 needs to mark the dest's old reg as available
https://bugs.webkit.org/show_bug.cgi?id=202066

Reviewed by Saam Barati.

Also adds a new release method that handles all the invariants of
returning a register to the available register pool.

* b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
(JSC::B3::Air::GenerateAndAllocateRegisters::release):
(JSC::B3::Air::GenerateAndAllocateRegisters::spill):
(JSC::B3::Air::GenerateAndAllocateRegisters::freeDeadTmpsIfNeeded):
(JSC::B3::Air::GenerateAndAllocateRegisters::generate):
* b3/air/AirAllocateRegistersAndStackAndGenerateCode.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (250175 => 250176)


--- trunk/Source/_javascript_Core/ChangeLog	2019-09-21 01:24:45 UTC (rev 250175)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-09-21 02:11:37 UTC (rev 250176)
@@ -1,3 +1,20 @@
+2019-09-20  Keith Miller  <keith_mil...@apple.com>
+
+        eliding a move in Air O0 needs to mark the dest's old reg as available
+        https://bugs.webkit.org/show_bug.cgi?id=202066
+
+        Reviewed by Saam Barati.
+
+        Also adds a new release method that handles all the invariants of
+        returning a register to the available register pool.
+
+        * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
+        (JSC::B3::Air::GenerateAndAllocateRegisters::release):
+        (JSC::B3::Air::GenerateAndAllocateRegisters::spill):
+        (JSC::B3::Air::GenerateAndAllocateRegisters::freeDeadTmpsIfNeeded):
+        (JSC::B3::Air::GenerateAndAllocateRegisters::generate):
+        * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h:
+
 2019-09-20  Mark Lam  <mark....@apple.com>
 
         Harden assertion in StructureIDTable::get().

Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp (250175 => 250176)


--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp	2019-09-21 01:24:45 UTC (rev 250175)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp	2019-09-21 02:11:37 UTC (rev 250176)
@@ -123,6 +123,18 @@
     return CCallHelpers::Address(reg);
 }
 
+ALWAYS_INLINE void GenerateAndAllocateRegisters::release(Tmp tmp, Reg reg)
+{
+    ASSERT(reg);
+    ASSERT(m_currentAllocation->at(reg) == tmp);
+    m_currentAllocation->at(reg) = Tmp();
+    ASSERT(!m_availableRegs[tmp.bank()].contains(reg));
+    m_availableRegs[tmp.bank()].set(reg);
+    ASSERT(m_map[tmp].reg == reg);
+    m_map[tmp].reg = Reg();
+}
+
+
 ALWAYS_INLINE void GenerateAndAllocateRegisters::flush(Tmp tmp, Reg reg)
 {
     ASSERT(tmp);
@@ -137,10 +149,8 @@
 {
     ASSERT(reg);
     ASSERT(m_map[tmp].reg == reg);
-    m_availableRegs[tmp.bank()].set(reg);
-    m_currentAllocation->at(reg) = Tmp();
     flush(tmp, reg);
-    m_map[tmp].reg = Reg();
+    release(tmp, reg);
 }
 
 ALWAYS_INLINE void GenerateAndAllocateRegisters::alloc(Tmp tmp, Reg reg, bool isDef)
@@ -180,10 +190,7 @@
         if (m_liveRangeEnd[tmp] >= m_globalInstIndex)
             continue;
 
-        Reg reg = Reg::fromIndex(i);
-        m_map[tmp].reg = Reg();
-        m_availableRegs[tmp.bank()].set(reg);
-        m_currentAllocation->at(i) = Tmp();
+        release(tmp, Reg::fromIndex(i));
     }
 }
 
@@ -447,14 +454,12 @@
                 if (dest.isReg() && dest.reg() != sourceReg)
                     return true;
 
-                if (Reg oldReg = m_map[dest.tmp()].reg) {
-                    ASSERT(m_currentAllocation->at(oldReg) == dest.tmp());
-                    m_currentAllocation->at(oldReg) = Tmp();
-                }
+                if (Reg oldReg = m_map[dest.tmp()].reg)
+                    release(dest.tmp(), oldReg);
 
+                m_map[dest.tmp()].reg = sourceReg;
                 m_currentAllocation->at(sourceReg) = dest.tmp();
                 m_map[source.tmp()].reg = Reg();
-                m_map[dest.tmp()].reg = sourceReg;
                 return false;
             })();
 

Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.h (250175 => 250176)


--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.h	2019-09-21 01:24:45 UTC (rev 250175)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersAndStackAndGenerateCode.h	2019-09-21 02:11:37 UTC (rev 250176)
@@ -55,6 +55,7 @@
 
 private:
     void insertBlocksForFlushAfterTerminalPatchpoints();
+    void release(Tmp, Reg);
     void flush(Tmp, Reg);
     void spill(Tmp, Reg);
     void alloc(Tmp, Reg, bool isDef);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to