harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r501830 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: codegenerator/ia32/Ia32IRManager.cpp codegenerator/ia32/Ia32InstCodeSelector.cpp translator/java/JavaByteCodeTranslator.cpp
Date Wed, 31 Jan 2007 12:54:35 GMT
Author: varlax
Date: Wed Jan 31 04:54:34 2007
New Revision: 501830

URL: http://svn.apache.org/viewvc?view=rev&rev=501830
Log:
Applied HARMONY-3063 [drlvm][jit] ArrayCopyRepMove does not work on EM64T
Tested on SUSE9@x64

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp

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?view=diff&rev=501830&r1=501829&r2=501830
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Wed Jan
31 04:54:34 2007
@@ -1752,9 +1752,9 @@
                         } else if (inst->getMnemonic() == Mnemonic_POP) {
                             stackDepth-=getByteSize(inst->getOpnd(it)->getSize());
                         } else if (inst->getMnemonic() == Mnemonic_PUSHFD) {
-                            stackDepth+=4;
+                            stackDepth+=sizeof(POINTER_SIZE_INT);
                         } else if (inst->getMnemonic() == Mnemonic_POPFD) {
-                            stackDepth-=4;
+                            stackDepth-=sizeof(POINTER_SIZE_INT);
                         } else if (inst->getMnemonic() == Mnemonic_CALL && ((CallInst
*)inst)->getCallingConventionClient().getCallingConvention()->calleeRestoresStack())
{
                             stackDepth -= ((CallInst *)inst)->getArgStackDepth();
                         }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp?view=diff&rev=501830&r1=501829&r2=501830
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
Wed Jan 31 04:54:34 2007
@@ -1817,9 +1817,6 @@
     Type * elemType=arrayType->getElementType();
     Type * dstType=irManager.getManagedPtrType(elemType);
 
-    uint32 elemSize = getByteSize(irManager.getTypeSize(elemType));
-
-    
 #ifdef _EM64T_
     Type * indexType = typeManager.getInt64Type();
     Type * offType = typeManager.getInt64Type();
@@ -1828,11 +1825,32 @@
     Type * offType = typeManager.getInt32Type();
 #endif
         
+    uint32 elemSize = 0;
+    if (elemType->isReference()
+        && Type::isCompressedReference(elemType->tag, compilationInterface) 
+        && !elemType->isCompressedReference()) {
+        elemSize = 4;
+    } else {
+        elemSize = getByteSize(irManager.getTypeSize(elemType));
+    }
+    Opnd * elemSizeOpnd  = irManager.newImmOpnd(indexType, elemSize);
+    
     Opnd * indexOpnd = (Opnd *)index;
     indexOpnd = convert(indexOpnd, indexType);
-    
-    Opnd * addr = irManager.newMemOpnd(dstType,(Opnd*)array, (Opnd*)index,
-                                       irManager.newImmOpnd(indexType, elemSize),
+
+    if ( indexOpnd->isPlacedIn(OpndKind_Imm) ) {
+        // wee need to put index operand on a register to satisfy LEA constraint
+        uint64 immValue = indexOpnd->getImmValue();
+        if (immValue == 0) {
+            indexOpnd = NULL;
+            elemSizeOpnd = NULL;
+        } else {
+            Opnd * indexReg = irManager.newOpnd(indexType);
+            copyOpnd(indexReg,indexOpnd);
+            indexOpnd = indexReg;
+        }
+    }    
+    Opnd * addr = irManager.newMemOpnd(dstType,(Opnd*)array, indexOpnd, elemSizeOpnd,
                                        irManager.newImmOpnd(offType, arrayType->getArrayElemOffset())
                                        );
     Opnd * dst = irManager.newOpnd(dstType);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp?view=diff&rev=501830&r1=501829&r2=501830
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
Wed Jan 31 04:54:34 2007
@@ -2888,12 +2888,6 @@
                                             uint32       numArgs,
                                             Opnd **      srcOpnds) {
 
-#ifdef _EM64T_
-    // FIXME: this was not tested (and does not work) on EM64T.
-    if (true) {
-        return false;
-    }
-#endif
     if( !methodIsArraycopy(methodDesc) ||
         !arraycopyOptimizable(methodDesc,numArgs,srcOpnds) )
     {
@@ -2955,48 +2949,52 @@
     LabelInst * reverseCopying = irBuilder.createLabel();
     LabelInst * boundsException = irBuilder.createLabel();
     LabelInst * Exit = irBuilder.createLabel();
+
     Type * intType = typeManager.getInt32Type();
+    Type::Tag intTag = intType->tag;
     Type * voidType = typeManager.getVoidType();
 
     newFallthroughBlock();
     Opnd * zero = irBuilder.genLdConstant((int32)0);
-    irBuilder.genBranch(Type::Int32,Cmp_GT,boundsException,zero,srcPos);        
+    Opnd * minusone = irBuilder.genLdConstant((int32)-1);
+
+    irBuilder.genBranch(intTag,Cmp_GT,boundsException,zero,srcPos);        
 
     newFallthroughBlock();
-    irBuilder.genBranch(Type::Int32,Cmp_GT,boundsException,zero,dstPos);
+    irBuilder.genBranch(intTag,Cmp_GT,boundsException,zero,dstPos);
 
     newFallthroughBlock();
-    irBuilder.genBranch(Type::Int32,Cmp_GT,boundsException,zero,len);
+    irBuilder.genBranch(intTag,Cmp_GT,boundsException,zero,len);
 
     Modifier mod = Modifier(Overflow_None)|Modifier(Exception_Never)|Modifier(Strict_No);
 
     newFallthroughBlock();   
-    Opnd * srcLen = irBuilder.genArrayLen(intType,Type::Int32,src);
+    Opnd * srcLen = irBuilder.genArrayLen(intType,intTag,src);
     Opnd * srcEnd = irBuilder.genAdd(intType,mod,srcPos,len);
-    irBuilder.genBranch(Type::Int32,Cmp_GT,boundsException,srcEnd,srcLen);
+    irBuilder.genBranch(intTag,Cmp_GT,boundsException,srcEnd,srcLen);
     
     newFallthroughBlock();
     Opnd * dstEnd = irBuilder.genAdd(intType,mod,dstPos,len);
-    Opnd * dstLen = irBuilder.genArrayLen(intType,Type::Int32,dst);
-    irBuilder.genBranch(Type::Int32,Cmp_GT,boundsException,dstEnd,dstLen);
+    Opnd * dstLen = irBuilder.genArrayLen(intType,intTag,dst);
+    irBuilder.genBranch(intTag,Cmp_GT,boundsException,dstEnd,dstLen);
 
     newFallthroughBlock();
 
     // The case of same arrays and same positions
-    Opnd * diff = irBuilder.genCmp3(intType,Type::Int32,Cmp_GT,dstPos,srcPos);
+    Opnd * diff = irBuilder.genCmp3(intType,intTag,Cmp_GT,dstPos,srcPos);
     Opnd * sameArrays = irBuilder.genCmp(intType,Type::IntPtr,Cmp_EQ,src,dst);
-    Opnd * zeroDiff = irBuilder.genCmp(intType,Type::Int32,Cmp_EQ,diff,zero);
+    Opnd * zeroDiff = irBuilder.genCmp(intType,intTag,Cmp_EQ,diff,zero);
     Opnd * nothingToCopy = irBuilder.genAnd(intType,sameArrays,zeroDiff);
-    irBuilder.genBranch(Type::Int32,Cmp_GT,Exit,nothingToCopy,zero);
+    irBuilder.genBranch(intTag,Cmp_GT,Exit,nothingToCopy,zero);
 
     newFallthroughBlock();
 
     Opnd* tauTypesChecked = irBuilder.genTauSafe();
 
     // Choosing direction
-    Opnd * dstIsGreater = irBuilder.genCmp(intType,Type::Int32,Cmp_GT,diff,zero);
+    Opnd * dstIsGreater = irBuilder.genCmp(intType,intTag,Cmp_GT,diff,zero);
     Opnd * reverseCopy = irBuilder.genAnd(intType,sameArrays,dstIsGreater);
-    irBuilder.genBranch(Type::Int32,Cmp_GT,reverseCopying,reverseCopy,zero);
+    irBuilder.genBranch(intTag,Cmp_GT,reverseCopying,reverseCopy,zero);
 
     newFallthroughBlock();
 
@@ -3012,7 +3010,6 @@
     cfgBuilder.genBlockAfterCurrent(reverseCopying);
     {   // Reverse Copying
 
-    Opnd* minusone = irBuilder.genLdConstant((int32)-1);
     Opnd* lastSrcIdx = irBuilder.genAdd(srcPosType,mod,srcEnd,minusone);
     Opnd* lastDstIdx = irBuilder.genAdd(dstPosType,mod,dstEnd,minusone);
 
@@ -3032,8 +3029,7 @@
 
     irBuilder.genLabel(boundsException);
     cfgBuilder.genBlockAfterCurrent(boundsException);
-    Opnd * minusOne = irBuilder.genLdConstant((int32)-1);
-    irBuilder.genTauCheckBounds(src,minusOne,tauSrcNullChecked);
+    irBuilder.genTauCheckBounds(src,minusone,tauSrcNullChecked);
 
     irBuilder.genLabel(Exit);
     cfgBuilder.genBlockAfterCurrent(Exit);



Mime
View raw message