harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r522827 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: codegenerator/ia32/Ia32GCMap.cpp codegenerator/ia32/Ia32IRManager.cpp codegenerator/ia32/Ia32IRManager.h codegenerator/ia32/Ia32Inst.h optimizer/Inst.cpp optimizer/helper_inliner.cpp
Date Tue, 27 Mar 2007 09:15:57 GMT
Author: varlax
Date: Tue Mar 27 02:15:56 2007
New Revision: 522827

URL: http://svn.apache.org/viewvc?view=rev&rev=522827
Log:
Applied HARMONY-3497 [drlvm][jit] Ileggal managed<->unmanaged conversion in JIT cause
GC failures in server mode
Tested on SLES10@ia32, SLES9@x64, WinXP@ia32.

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp?view=diff&rev=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Tue Mar 27
02:15:56 2007
@@ -81,6 +81,37 @@
     }
 }
 
+
+#ifdef _DEBUG
+
+static bool isManaged(Opnd* op) { return op->getType()->isObject() || op->getType()->isManagedPtr();}
+
+static void checkManaged2UnmanagedConv(IRManager& irm, Opnd* opnd) {
+    const Nodes& nodes = irm.getFlowGraph()->getNodes();
+    for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
+        Node* node = *it;
+        if (node->isBlockNode()) {
+            for (Inst* inst = (Inst*)node->getLastInst(); inst!=NULL; inst = inst->getPrevInst())
{
+                if (inst->getMnemonic() != Mnemonic_MOV) {
+                    continue;
+                }
+                Opnd* op0 = inst->getOpnd(0);
+                Opnd* op1 = inst->getOpnd(1);
+                if (op0!=opnd && op1!=opnd) {
+                    continue;
+                }
+                if (isManaged(op0)==isManaged(op1)) {
+                    continue;
+                }
+                Opnd* managedOpnd = isManaged(op0)?op0:op1;
+                //the only managed->unmanaged conversion type is allowed is for static
(non-gc) fields
+                assert(managedOpnd->isPlacedIn(OpndKind_Immediate)); 
+            }
+        }
+    }
+}
+#endif
+
 void  GCMap::registerGCSafePoint(IRManager& irm, const BitSet& ls, Inst* inst) {
     POINTER_SIZE_INT eip = (POINTER_SIZE_INT)inst->getCodeStartAddr()+inst->getCodeSize();
     GCSafePoint* gcSafePoint = new (mm) GCSafePoint(mm, eip);
@@ -99,9 +130,14 @@
 #endif
     BitSet::IterB liveOpnds(ls);
     assert(inst->hasKind(Inst::Kind_CallInst));
+    
     Opnd * callRes = inst->getOpndCount(Inst::OpndRole_AllDefs)>0 ? inst->getOpnd(0)
: NULL;
     for (int i = liveOpnds.getNext(); i != -1; i = liveOpnds.getNext()) {
         Opnd* opnd = irm.getOpnd(i);
+#ifdef _DEBUG
+        if (opnd->getType()->isUnmanagedPtr()) checkManaged2UnmanagedConv(irm, opnd);
+#endif
+        
         if (callRes == opnd) {
             continue;
         }

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=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Tue Mar
27 02:15:56 2007
@@ -2235,7 +2235,22 @@
     }
     return ControlFlowGraphFactory::createEdge(mm, srcKind, dstKind);
 }
-
+bool IRManager::isGCSafePoint(const Inst* inst) {
+    if (inst->getMnemonic() == Mnemonic_CALL) {
+        const CallInst* callInst =  (const CallInst*)inst;
+        Opnd* callTarget = callInst->getOpnd(callInst->getTargetOpndIndex());
+        Opnd::RuntimeInfo * rt = callTarget->isPlacedIn(OpndKind_Immediate)?callTarget->getRuntimeInfo():NULL;
+        bool isInternalHelper = rt && rt->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress;
+        bool isNonGCVMHelper = false;
+        if (!isInternalHelper) {
+            isNonGCVMHelper = rt && rt->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress

+                && (CompilationInterface::RuntimeHelperId)(POINTER_SIZE_INT)rt->getValue(0)
== CompilationInterface::Helper_GetTLSBase;
+        }
+        bool isGCPoint = !isInternalHelper && !isNonGCVMHelper;
+        return isGCPoint;
+    }
+    return false;
+}
 
 
 //=============================================================================================

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h?view=diff&rev=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h Tue Mar
27 02:15:56 2007
@@ -332,7 +332,7 @@
 
     void calculateTotalRegUsage(OpndKind regKind);
 
-    static bool isGCSafePoint(const Inst* inst)  {return inst->getMnemonic() == Mnemonic_CALL;}
+    static bool isGCSafePoint(const Inst* inst); 
 
     static bool isThreadInterruptablePoint(const Inst* inst) {
         if ( inst->getMnemonic() == Mnemonic_CALL ) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h?view=diff&rev=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h Tue Mar 27 02:15:56
2007
@@ -339,7 +339,7 @@
 
     //-------------------------------------------------------------------------
     Opnd(uint32 _id, Type * t, Constraint c)
-        :id(_id), firstId(_id), type(t), memOpndKind(MemOpndKind_Null), segReg(RegName_Null)
+        :id(_id), firstId(_id), type(t), memOpndKind(MemOpndKind_Null), segReg(RegName_Null),
immValue(0), runtimeInfo(NULL)
         { constraints[ConstraintKind_Initial]=constraints[ConstraintKind_Calculated]=c; }
 
     //-------------------------------------------------------------------------
@@ -352,12 +352,12 @@
     DefScope        defScope;
     Inst *          definingInst;
     uint32          refCount;
-        RegName                 segReg;
+    RegName         segReg;
 
     union{
         RegName     regName;
         struct{
-            int64       immValue;
+            int64           immValue;
             RuntimeInfo *   runtimeInfo;
         };
         Opnd *      memOpndSubOpnds[MemOpndSubOpndKind_Count];

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp?view=diff&rev=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp Tue Mar 27 02:15:56 2007
@@ -1783,6 +1783,10 @@
 
 // conversion
 Inst* InstFactory::makeConv(Modifier mod, Type::Tag toType, Opnd* dst, Opnd* src) {
+    //use convUnmanaged to convert between managed and unmanaged types
+    assert (!(dst->getType()->isUnmanagedPtr() && src->getType()->isObject())

+        && !(dst->getType()->isObject() && src->getType()->isUnmanagedPtr()));

+
     return makeInst(Op_Conv, mod, toType, dst, src);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp?view=diff&rev=522827&r1=522826&r2=522827
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Tue Mar 27 02:15:56
2007
@@ -405,7 +405,7 @@
     if (fallNode->getInDegree()>1) {
         fallNode = irm->getFlowGraph().spliceBlockOnEdge(fallEdge, instFactory->makeLabel());
     }
-    fallNode->prependInst(instFactory->makeConv(mod, type->tag, dstOpnd, callResOpnd));
+    fallNode->prependInst(instFactory->makeConvUnmanaged(mod, type->tag, dstOpnd,
callResOpnd));
 
     inlineVMHelper(call);
 #endif
@@ -453,7 +453,7 @@
     if (fallNode->getInDegree()>1) {
         fallNode = irm->getFlowGraph().spliceBlockOnEdge(fallEdge, instFactory->makeLabel());
     }
-    fallNode->prependInst(instFactory->makeConv(mod, arrayType->tag, dstOpnd, callResOpnd));
+    fallNode->prependInst(instFactory->makeConvUnmanaged(mod, arrayType->tag, dstOpnd,
callResOpnd));
     
     inlineVMHelper(call);
 #endif



Mime
View raw message