harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chunr...@apache.org
Subject svn commit: r726970 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32: Ia32I8Lowerer.cpp Ia32IRManager.cpp Ia32PeepHole.cpp Ia32RegAlloc3.cpp
Date Tue, 16 Dec 2008 05:49:32 GMT
Author: chunrong
Date: Mon Dec 15 21:49:31 2008
New Revision: 726970

URL: http://svn.apache.org/viewvc?rev=726970&view=rev
Log:
Apply patch for HARMONY-6027, fixed several JIT bugs

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp?rev=726970&r1=726969&r2=726970&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32I8Lowerer.cpp Mon Dec
15 21:49:31 2008
@@ -289,6 +289,7 @@
         for (Inst* inst = (Inst*)node->getFirstInst(),*nextInst=NULL; inst!=NULL; inst
= nextInst) {
             nextInst = inst->getNextInst();
             U_32  defCount = inst->getOpndCount(Inst::OpndRole_InstLevel|Inst::OpndRole_Def);
+            U_32  useCount = inst->getOpndCount(Inst::OpndRole_InstLevel|Inst::OpndRole_Use);
             if(inst->getMnemonic() == Mnemonic_CDQ) {
                 if (inst->getNextInst()!=NULL && inst->getNextInst()->getMnemonic()
== Mnemonic_IDIV) {
                     continue;
@@ -310,8 +311,17 @@
                 tmpInst->insertAfter(inst);
                 inst->unlink();
                 inst = tmpInst;
-            }
-        }
+            } else {
+                if (cdq) {
+                    Opnd* defCDQ = cdq->getOpnd(0);
+                    for (U_32 i=defCount;i<defCount+useCount;i++) {
+                        if (defCDQ == inst->getOpnd(i)) {
+                            cdq = NULL;
+                            break;
+                        }
+                    }
+                }
+            }        }
     }
     
     checkIR(irManager);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp?rev=726970&r1=726969&r2=726970&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Mon Dec
15 21:49:31 2008
@@ -1324,8 +1324,15 @@
     U_32 opndCount=getOpndCount();
     for (U_32 i=0; i<opndCount; i++){
         Opnd * opnd=getOpnd(i);
-        if (opnd->isPlacedIn(regKind))
-            gpTotalRegUsage |= getRegMask(opnd->getRegName());
+        if (opnd->isPlacedIn(regKind)) {
+            RegName reg = opnd->getRegName();
+            unsigned mask = getRegMask(reg);
+#if !defined(_EM64T_)
+            if ((reg == RegName_AH) || (reg == RegName_CH) || (reg == RegName_DH) || (reg
== RegName_BH))
+                mask >>= 4;
+#endif
+            gpTotalRegUsage |= mask;
+        }
     }
 }
 //_________________________________________________________________________________________________

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp?rev=726970&r1=726969&r2=726970&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp Mon Dec
15 21:49:31 2008
@@ -484,7 +484,8 @@
         if (step1 && next->getMnemonic() == Mnemonic_MOV)
         {
             Opnd *movopnd1, *movopnd2, *nextmovopnd1, *nextmovopnd2;
-            if (inst->getKind() == Inst::Kind_CopyPseudoInst)
+            bool isInstCopyPseudo = (inst->getKind() == Inst::Kind_CopyPseudoInst);
+            if (isInstCopyPseudo)
             {
                 movopnd1 = inst->getOpnd(0);
                 movopnd2 = inst->getOpnd(1);
@@ -496,7 +497,8 @@
                 movopnd1 = inst->getOpnd(movdefs.begin());
                 movopnd2 = inst->getOpnd(movuses.begin());
             }
-            if (next->getKind() == Inst::Kind_CopyPseudoInst)
+            bool isNextCopyPseudo = (next->getKind() == Inst::Kind_CopyPseudoInst);
+            if (isNextCopyPseudo)
             {
                 nextmovopnd1 = next->getOpnd(0);
                 nextmovopnd2 = next->getOpnd(1);
@@ -522,7 +524,10 @@
                 bool dstNotUsed = !ls.getBit(movopnd1->getId());
                 if (dstNotUsed)
                 {
-                    irManager->newInst(Mnemonic_MOV, nextmovopnd1, movopnd2)->insertAfter(inst);
+                    if (isInstCopyPseudo && isNextCopyPseudo)
+                        irManager->newCopyPseudoInst(Mnemonic_MOV, nextmovopnd1, movopnd2)->insertAfter(inst);
+                    else
+                        irManager->newInst(Mnemonic_MOV, nextmovopnd1, movopnd2)->insertAfter(inst);
                     inst->unlink();
                     next->unlink();
                     return Changed_Node;
@@ -603,7 +608,6 @@
     return Changed_Nothing;
 }
 
-
 PeepHoleOpt::Changed PeepHoleOpt::handleInst_CMP(Inst* inst) {
     assert(inst->getMnemonic()==Mnemonic_CMP);
     

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp?rev=726970&r1=726969&r2=726970&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RegAlloc3.cpp Mon Dec
15 21:49:31 2008
@@ -168,6 +168,7 @@
     int  duplicates (Indexes* list, BoolMatrix& matrix, int x0, int x1);
     void pruneGraph ();
     bool shouldPrune (const Opndx&) const;
+    RegAlloc3::RegMask occupiedReg (OpndSize, OpndSize, RegAlloc3::RegMask);
     bool assignRegs ();
     bool assignReg  (Opndx&);
     void spillRegs  ();
@@ -1232,6 +1233,23 @@
     return spilled == 0;
 }
 
+RegAlloc3::RegMask RegAlloc3::occupiedReg (OpndSize tgtSize, OpndSize adjSize, RegAlloc3::RegMask
adjMask) {
+#if !defined(_EM64T_)    
+    if (!((tgtSize != adjSize) && ((tgtSize == OpndSize_8) || (adjSize == OpndSize_8))))
+#endif
+        return adjMask;
+
+    RegMask val = adjMask;
+    if (tgtSize == OpndSize_8) {
+        if (adjMask <= 8) //for AH, CH, DH, BH
+            val |= adjMask<<4;
+    } else if (adjSize == OpndSize_8) {
+        if (adjMask >= 16) //for AH, CH, DH, BH
+            val >>= 4;
+    }
+    return val;
+}
+
 
 bool RegAlloc3::assignReg (Opndx& opndx)
 {
@@ -1242,7 +1260,10 @@
     {
         Opndx& opndz = graph.at(*i);
         if (opndz.ridx == opndx.ridx)
-            alloc |= opndz.alloc;
+            if (opndz.opnd != NULL) //for operand nodes
+                alloc |= occupiedReg(opndx.opnd->getSize(), opndz.opnd->getSize(),
opndz.alloc);
+            else //for color nodes
+                alloc |= occupiedReg(opndx.opnd->getSize(), OpndSize_32, opndz.alloc);
     }
 
     if ((alloc = opndx.avail & ~alloc) == 0)



Mime
View raw message