harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r521695 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32: Ia32CodeEmitter.cpp Ia32IRManager.cpp
Date Fri, 23 Mar 2007 12:22:16 GMT
Author: varlax
Date: Fri Mar 23 05:22:15 2007
New Revision: 521695

URL: http://svn.apache.org/viewvc?view=rev&rev=521695
Log:
Applied HARMONY-3465 [drlvm][winx64][jit] server drlvm fails on HWA

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp?view=diff&rev=521695&r1=521694&r2=521695
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Fri
Mar 23 05:22:15 2007
@@ -395,20 +395,27 @@
             }
 
 #ifdef _EM64T_
+            bool patchCall = false;
             if (inst->hasKind(Inst::Kind_ControlTransferInst) && 
                    ((ControlTransferInst*)inst)->isDirect() && 
                    inst->getMnemonic() == Mnemonic_CALL) 
             {
-                if ((POINTER_SIZE_INT)ip & 0xF) 
-                {
-                    unsigned align = 0x10 - (unsigned)((POINTER_SIZE_INT)ip & 0xF);
-                    ip = (uint8*)EncoderBase::nops((char*)ip, align);
-                }
-                uint8 * instStartIp = ip;
-                assert(fit32(instStartIp-blockStartIp));
-                inst->setCodeOffset( (uint32)(instStartIp-blockStartIp) );
-                ip = inst->emit(ip);
-                ip = (uint8*)EncoderBase::nops((char*)ip, 0x10 - inst->getCodeSize());
+                ControlTransferInst* callInst =  (ControlTransferInst*)inst;
+                Opnd::RuntimeInfo * rt = callInst->getOpnd(callInst->getTargetOpndIndex())->getRuntimeInfo();
+                bool helperCall = rt && (rt->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress
|| rt->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress);
+                patchCall = !helperCall;
+            }
+            if (patchCall) {
+                 if ((POINTER_SIZE_INT)ip & 0xF) 
+                 {
+                     unsigned align = 0x10 - (unsigned)((POINTER_SIZE_INT)ip & 0xF);
+                     ip = (uint8*)EncoderBase::nops((char*)ip, align);
+                 }
+                 uint8 * instStartIp = ip;
+                 assert(fit32(instStartIp-blockStartIp));
+                 inst->setCodeOffset( (uint32)(instStartIp-blockStartIp) );
+                 ip = inst->emit(ip);
+                 ip = (uint8*)EncoderBase::nops((char*)ip, 0x10 - inst->getCodeSize());
             } else {
 #endif
             uint8 * instStartIp = ip;

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=521695&r1=521694&r2=521695
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Fri Mar
23 05:22:15 2007
@@ -535,7 +535,7 @@
     uint32 numArgs, Opnd ** args, Opnd * retOpnd, InlineInfo* ii)
 {
     Inst * instList = NULL;
-    Opnd * target=newImmOpnd(typeManager.getUnmanagedPtrType(typeManager.getIntPtrType()),
Opnd::RuntimeInfo::Kind_HelperAddress, (void*)helperId);
+    Opnd * target=newImmOpnd(typeManager.getInt32Type(), Opnd::RuntimeInfo::Kind_HelperAddress,
(void*)helperId);
     const CallingConvention * cc=getCallingConvention(helperId);
     appendToInstList(instList,newCallInst(target, cc, numArgs, args, retOpnd));
     return (CallInst *)instList;
@@ -547,7 +547,7 @@
     const InternalHelperInfo * info=getInternalHelperInfo(internalHelperID);
     assert(info!=NULL);
     Inst * instList = NULL;
-    Opnd * target=newImmOpnd(typeManager.getUnmanagedPtrType(typeManager.getIntPtrType()),
Opnd::RuntimeInfo::Kind_InternalHelperAddress, (void*)newInternalString(internalHelperID));
+    Opnd * target=newImmOpnd(typeManager.getInt32Type(), Opnd::RuntimeInfo::Kind_InternalHelperAddress,
(void*)newInternalString(internalHelperID));
     const CallingConvention * cc=info->callingConvention;
     appendToInstList(instList,newCallInst(target, cc, numArgs, args, retOpnd));
     return (CallInst *)instList;
@@ -1683,8 +1683,22 @@
                     for (uint32 i=0, n=(uint32)stackOpndInfos.size(); i<n; i++) {
                         sz += sizeof(POINTER_SIZE_INT); 
                     }
+                    unsigned corr = 0;
+
                     if(sz&15) {
-                        unsigned corr = 16-(sz&15);
+                        corr += 16-(sz&15);
+                    }
+#ifdef _WIN64
+                    Opnd::RuntimeInfo * rt = callInst->getOpnd(callInst->getTargetOpndIndex())->getRuntimeInfo();
+
+                    if (callInst->isDirect() && rt && rt->getKind()
== Opnd::RuntimeInfo::Kind_InternalHelperAddress) {
+                        uint32 nRegOpnds = (uint32)(callInst->getOpndCount(Inst::OpndRole_Auxilary|Inst::OpndRole_Use)
- stackOpndInfos.size());
+                        uint32 shadowSize = nRegOpnds * sizeof(POINTER_SIZE_INT);
+                        corr += shadowSize;
+                    }
+#endif
+                    if (corr)
+                    {
                         node->prependInst(newInst(Mnemonic_SUB, getRegOpnd(STACK_REG),
newImmOpnd(typeManager.getInt32Type(), corr)), inst);
                         node->appendInst(newInst(Mnemonic_ADD, getRegOpnd(STACK_REG),
newImmOpnd(typeManager.getInt32Type(), corr)), inst);
                     }



Mime
View raw message