Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 65655 invoked from network); 8 Nov 2007 12:02:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2007 12:02:32 -0000 Received: (qmail 42811 invoked by uid 500); 8 Nov 2007 12:02:20 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 42788 invoked by uid 500); 8 Nov 2007 12:02:20 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 42779 invoked by uid 99); 8 Nov 2007 12:02:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 04:02:20 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 12:03:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E90071A983E; Thu, 8 Nov 2007 04:02:02 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r593136 [1/2] - in /harmony/enhanced/drlvm/trunk/vm: include/ jitrino/src/codegenerator/ia32/ jitrino/src/codegenerator/ipf/ jitrino/src/jet/ port/include/ port/src/lil/ia32/pim/ vmcore/include/ vmcore/src/class_support/ vmcore/src/exceptio... Date: Thu, 08 Nov 2007 12:01:15 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071108120202.E90071A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Thu Nov 8 04:01:07 2007 New Revision: 593136 URL: http://svn.apache.org/viewvc?rev=593136&view=rev Log: Applied 1st patch for HARMONY-4621 [drlvm][jit] Stack misalignment when using SSE instructions Expanded comments in few places, and fixed typo in STACK_ALIGN4 define Removed: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/invoke_native_stub_ia32.asm Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h 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.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_dbg.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_fld_arr.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_instr.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_stk.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/enc.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sframe.h harmony/enhanced/drlvm/trunk/vm/port/include/lil.h harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/lil_code_generator_ia32.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_runtime_support_common.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h Thu Nov 8 04:01:07 2007 @@ -64,8 +64,8 @@ VM_RT_NEW_VECTOR_USING_VTABLE=101, /** * @param The parameters are the following: - * \arg Allocation_Handle for the vector class * \arg Vector length + * \arg Allocation_Handle for the vector class * * @return Reference to the new object. * @@ -92,8 +92,8 @@ VM_RT_LDC_STRING=103, /** * @param The parameters are the following: - * \arg Const pool index pointing to a CONSTANT_Class. * \arg Class handle of the class owning the const pool + * \arg Const pool index pointing to a CONSTANT_Class. * * @return \arg Reference to the String object. * \arg Reference to the const string represented by an entry in the @@ -304,9 +304,9 @@ VM_RT_AASTORE=402, /** * @param The parameters are the following: - * \arg Element - * \arg Index * \arg Array + * \arg Index + * \arg Element * * @return None. * Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CallingConvention.h Thu Nov 8 04:01:07 2007 @@ -27,6 +27,30 @@ #include "Ia32IRConstants.h" #include "Ia32Constraint.h" +/** + * When entering a function, obey the (sp)%%4 == 0 rule. + */ +#define STACK_ALIGN4 (0x00000004) + +/** + * When entering a function, obey the (sp+8)%%16 == 0 rule + * (Required by Intel 64 calling convention). + */ +#define STACK_ALIGN_HALF16 (0x00000008) + +/** + * When entering a function, obey the (sp)%%16 == 0 rule. + */ +#define STACK_ALIGN16 (0x00000010) + + +#ifdef _EM64T_ + #define STACK_REG RegName_RSP + #define STACK_ALIGNMENT STACK_ALIGN_HALF16 +#else + #define STACK_REG RegName_ESP + #define STACK_ALIGNMENT STACK_ALIGN16 +#endif namespace Jitrino { @@ -85,6 +109,12 @@ /** True arguments are pushed from the last to the first, false in the other case */ virtual bool pushLastToFirst()const =0; + + /** + * Defines alignment of all arguments passed on the memmory stack plus return pointer. + */ + virtual uint32 getAlignment()const { return 0; } + /** * Maps a string representation of CallingConvention to the * appropriate CallingConvention_* item. @@ -123,14 +153,26 @@ //======================================================================================== // class DRLCallingConvention //======================================================================================== -/** Implementation of CallingConvention for the DRL IA32 calling convention -*/ -class DRLCallingConvention: public STDCALLCallingConvention + +/** + * Implementation of CallingConvention for the DRL IA32 calling convention + */ +class DRLCallingConventionIA32: public STDCALLCallingConvention { public: - virtual ~DRLCallingConvention() {} + virtual ~DRLCallingConventionIA32() {} virtual bool pushLastToFirst()const{ return false; } + virtual uint32 getAlignment()const { return STACK_ALIGNMENT; } +}; +/** + * Implementation of CallingConvention for the DRL EM64T calling convention + */ +class DRLCallingConventionEM64T: public STDCALLCallingConvention +{ +public: + virtual ~DRLCallingConventionEM64T() {} + virtual uint32 getAlignment()const { return STACK_ALIGN16; } }; //======================================================================================== @@ -148,6 +190,12 @@ virtual bool pushLastToFirst()const{ return true; } #endif }; + +#ifdef _EM64T_ +typedef DRLCallingConventionEM64T DRLCallingConvention; +#else +typedef DRLCallingConventionIA32 DRLCallingConvention; +#endif extern STDCALLCallingConvention CallingConvention_STDCALL; extern DRLCallingConvention CallingConvention_DRL; 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=593136&r1=593135&r2=593136&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 Thu Nov 8 04:01:07 2007 @@ -1692,77 +1692,70 @@ #endif const Nodes& nodes = fg->getNodes(); - for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) { + 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(), * prevInst=NULL; inst!=NULL; inst=prevInst) { - prevInst=inst->getPrevInst(); + for (Inst * inst = (Inst*)node->getLastInst(), * prevInst = NULL; inst != NULL; inst = prevInst) { + prevInst = inst->getPrevInst(); if (inst->getMnemonic() == Mnemonic_CALL) { - const CallInst * callInst=(const CallInst*)inst; + const CallInst * callInst = (const CallInst*)inst; + const CallingConvention * cc = + callInst->getCallingConventionClient().getCallingConvention(); const StlVector& stackOpndInfos = callInst->getCallingConventionClient().getStackOpndInfos(Inst::OpndRole_Use); - Inst * instToPrepend=inst; + + Inst * instToPrepend = inst; Opnd * const * opnds = callInst->getOpnds(); -#ifdef _EM64T_ - unsigned sz = 0; - for (uint32 i=0, n=(uint32)stackOpndInfos.size(); igetArgStackDepthAlignment() > 0) { + node->prependInst(newInst(Mnemonic_SUB, getRegOpnd(STACK_REG), + newImmOpnd(typeManager.getInt32Type(), callInst->getArgStackDepthAlignment())), inst); } - unsigned corr = 0; - if(sz&15) { - corr += 16-(sz&15); + // Put inputs on the stack. + for (uint32 i = 0, n = (uint32)stackOpndInfos.size(); i < n; i++) { + Opnd* opnd = opnds[stackOpndInfos[i].opndIndex]; + Inst * pushInst = newCopyPseudoInst(Mnemonic_PUSH, opnd); + pushInst->insertBefore(instToPrepend); + instToPrepend = pushInst; } + #ifdef _WIN64 + // Assert that shadow doesn't break stack alignment computed earlier. + assert((shadowSize & (STACK_ALIGNMENT - 1)) == 0); Opnd::RuntimeInfo * rt = callInst->getRuntimeInfo(); + bool needShadow = false; if (rt) { - //stack size for parameters: "number of entries is equal to 4 or the maximum number ofparameters - //See http://msdn2.microsoft.com/en-gb/library/ms794596.aspx for details - //shadow - is an area on stack reserved to map parameters passed with registers - bool needShadow = rt->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress; + // Stack size for parameters: "number of entries is equal to 4 or the maximum number of parameters" + // See http://msdn2.microsoft.com/en-gb/library/ms794596.aspx for details. + // Shadow - is an area on stack reserved to map parameters passed with registers. + needShadow = rt->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress; if (!needShadow && rt->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress) { VM_RT_SUPPORT helperId = (VM_RT_SUPPORT)(POINTER_SIZE_INT)rt->getValue(0); - //ABOUT: VM does not allocate shadow for most of the helpers - //however some helpers are direct pointers to native funcs - //TODO: create VM interface to get calling conventions for the helper - //today this knowledge is hardcoded here + // ABOUT: VM does not allocate shadow for most of the helpers + // however some helpers are direct pointers to native functions. + // TODO: create VM interface to get calling conventions for the helper + // today this knowledge is hardcoded here needShadow = helperId == VM_RT_GC_GET_TLS_BASE; } - if (needShadow) { - uint32 shadowSize = 4 * 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); + if (needShadow) { + // Arrange shadow area on the stack. + shadowSize = 4 * sizeof(POINTER_SIZE_INT); + node->prependInst(newInst(Mnemonic_SUB, getRegOpnd(STACK_REG), newImmOpnd(typeManager.getInt32Type(), shadowSize)), inst); } - sz = 0; -#endif - for (uint32 i=0, n=(uint32)stackOpndInfos.size(); igetCallingConventionClient().getCallingConvention()->pushLastToFirst()?i:n-1-i; - Inst * pushInst=newCopyPseudoInst(Mnemonic_PUSH, opnds[stackOpndInfos[index].opndIndex]); - sz+=sizeof(POINTER_SIZE_INT);//getByteSize(opnds[stackOpndInfos[index].opndIndex]->getSize()); -#else - Inst * pushInst=newCopyPseudoInst(Mnemonic_PUSH, opnds[stackOpndInfos[i].opndIndex]); + #endif - pushInst->insertBefore(instToPrepend); - instToPrepend=pushInst; - } -#ifdef _EM64T_ - if(sz && !((CallInst *)inst)->getCallingConventionClient().getCallingConvention()->calleeRestoresStack()) { - Inst* newIns = newInst(Mnemonic_ADD, getRegOpnd(STACK_REG), newImmOpnd(typeManager.getInt32Type(), sz)); + unsigned stackPopSize = cc->calleeRestoresStack() ? 0 : callInst->getArgStackDepth(); + stackPopSize += shadowSize; + // Restore stack pointer. + if(stackPopSize != 0) { + Inst* newIns = newInst(Mnemonic_ADD, getRegOpnd(STACK_REG), newImmOpnd(typeManager.getInt32Type(), stackPopSize)); newIns->insertAfter(inst); } -#else - if(!((CallInst *)inst)->getCallingConventionClient().getCallingConvention()->calleeRestoresStack()) { - Inst* newIns = newInst(Mnemonic_ADD, getRegOpnd(RegName_ESP), newImmOpnd(typeManager.getInt32Type(), ((CallInst *)inst)->getArgStackDepth())); - newIns->insertAfter(inst); - } -#endif } } } 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?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h Thu Nov 8 04:01:07 2007 @@ -37,6 +37,7 @@ #include "JITInstanceContext.h" #include "PMFAction.h" #include "Ia32CodeGeneratorFlags.h" +#include "Ia32CallingConvention.h" #include "LoopTree.h" @@ -52,12 +53,6 @@ { const char * newString(MemoryManager& mm, const char * str, uint32 length=EmptyUint32); -#ifdef _EM64T_ - #define STACK_REG RegName_RSP -#else - #define STACK_REG RegName_ESP -#endif - //======================================================================================== // STL aux classes (need to be moved somewhere) Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp Thu Nov 8 04:01:07 2007 @@ -804,25 +804,39 @@ //_________________________________________________________________________________________________ void CallingConventionClient::finalizeInfos(Inst::OpndRole role, CallingConvention::ArgKind argKind) { - assert(callingConvention!=NULL); - StlVector & infos = getInfos(role); - callingConvention->getOpndInfo(argKind, (uint32)infos.size(), infos.empty()?(CallingConvention::OpndInfo*)NULL:&infos.front()); - bool lastToFirst=callingConvention->pushLastToFirst(); uint32 slotNumber=0; - for ( - uint32 i=lastToFirst?0:(uint32)infos.size()-1, - end=lastToFirst?(uint32)infos.size():(uint32)-1, - inc=lastToFirst?1:-1; - i!=end; - i+=inc - ){ - CallingConvention::OpndInfo & info=infos[i]; - for (uint32 j=0; j & infos = getInfos(role); + + assert(callingConvention != NULL); + + callingConvention->getOpndInfo(argKind, (uint32)infos.size(), + infos.empty() ? (CallingConvention::OpndInfo*)NULL : &infos.front()); + + for (uint32 i = 0, n = (uint32)infos.size(); i != n; i++) { + uint32 index = callingConvention->pushLastToFirst() ? i : (n - 1 - i); + CallingConvention::OpndInfo & info = infos[index]; + for (uint32 j = 0; j < info.slotCount; j++) { if (!info.isReg) - info.slots[j]=0xFFFF & slotNumber++; + info.slots[j] = 0xFFFF & slotNumber++; + } + } + unsigned stackOpndSize = slotNumber * sizeof(POINTER_SIZE_INT); + unsigned stackAlignmentSize = 0; + + if (argKind == CallingConvention::ArgKind_InArg) { + // Compute stack alignment. + unsigned stackOnEnterSize = stackOpndSize + sizeof(POINTER_SIZE_INT); + unsigned alignment = callingConvention->getAlignment(); + + if (alignment != 0 && stackOnEnterSize & (alignment - 1)) { + stackAlignmentSize = alignment - (stackOnEnterSize & (alignment - 1)); } } - (role==Inst::OpndRole_Def?defArgStackDepth:useArgStackDepth)=slotNumber*sizeof(POINTER_SIZE_INT); + + stackOpndSize += stackAlignmentSize; + + (role == Inst::OpndRole_Def ? defArgStackDepth : useArgStackDepth) = stackOpndSize; + (role == Inst::OpndRole_Def ? defArgStackDepthAlignment : useArgStackDepthAlignment) = stackAlignmentSize; } //_________________________________________________________________________________________________ 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?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h Thu Nov 8 04:01:07 2007 @@ -1217,7 +1217,10 @@ { assert(callingConvention!=NULL); return callingConvention; } uint32 getArgStackDepth(Inst::OpndRole role)const - { return (role & Inst::OpndRole_UseDef)==Inst::OpndRole_Def?defArgStackDepth:useArgStackDepth; } + { return ((role & Inst::OpndRole_UseDef) == Inst::OpndRole_Def) ? defArgStackDepth : useArgStackDepth; } + + uint32 getArgStackDepthAlignment(Inst::OpndRole role) const + { return ((role & Inst::OpndRole_UseDef) == Inst::OpndRole_Def) ? useArgStackDepthAlignment : useArgStackDepthAlignment; } void setOwnerInst(Inst * oi){ ownerInst = oi; } protected: @@ -1236,6 +1239,7 @@ StlVector useStackOpndInfos; uint32 defArgStackDepth, useArgStackDepth; + uint32 defArgStackDepthAlignment, useArgStackDepthAlignment; }; @@ -1285,6 +1289,9 @@ uint32 getArgStackDepth()const { return callingConventionClient.getArgStackDepth(Inst::OpndRole_Use); } + uint32 getArgStackDepthAlignment() const + { return callingConventionClient.getArgStackDepthAlignment(Inst::OpndRole_Use); } + CallingConventionClient& getCallingConventionClient(){ return callingConventionClient; } const CallingConventionClient& getCallingConventionClient()const { return callingConventionClient; } 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?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Thu Nov 8 04:01:07 2007 @@ -2176,13 +2176,13 @@ if (codeSelector.methodCodeSelector.slowLdString || dstType->isSystemClass()) { NamedType * parentType=enclosingMethod->getParentType(); #ifdef _EM64T_ - Opnd * st = irManager.getRegOpnd(RegName_RDI); - appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, st, irManager.newImmOpnd(typeManager.getInt64Type(), refToken))); - Opnd * tp = irManager.getRegOpnd(RegName_RSI); + Opnd * tp = irManager.getRegOpnd(RegName_RDI); appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, tp,irManager.newImmOpnd(getRuntimeIdType(), Opnd::RuntimeInfo::Kind_TypeRuntimeId, parentType))); + Opnd * st = irManager.getRegOpnd(RegName_RSI); + appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, st, irManager.newImmOpnd(typeManager.getInt64Type(), refToken))); Opnd * helperOpnds[] = { - st, - tp + tp, + st }; #else Opnd * helperOpnds[] = { Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp Thu Nov 8 04:01:07 2007 @@ -72,7 +72,9 @@ * | | * | | * | | - * +-------------------------------+ localBase <--- "real" ESP + * +-------------------------------+ localBase + * | alignment padding | + * |-------------------------------+ <--- "real" ESP * | EAX | * | ECX | * | EDX | @@ -132,9 +134,6 @@ int32 inargEnd; int32 frameSize; uint32 outArgSize; -#ifdef _EM64T_ - bool stackCorrection; -#endif StackInfo * stackInfo; MemoryManager memoryManager; @@ -159,9 +158,6 @@ inargEnd(0), frameSize(0), outArgSize(0), -#ifdef _EM64T_ - stackCorrection(0), -#endif memoryManager("StackLayouter") { }; @@ -265,143 +261,94 @@ { for (uint32 i=0, n=irManager->getOpndCount(); igetOpnd(i); + Opnd * opnd = irManager->getOpnd(i); assert(!opnd->getRefCount() || opnd->hasAssignedPhysicalLocation()); #endif - } + } } void StackLayouter::createProlog() { - IRManager & irm=getIRManager(); + const uint32 slotSize = sizeof(POINTER_SIZE_INT); + const uint32 stackSizeAlignment = (STACK_ALIGNMENT == STACK_ALIGN_HALF16) ? STACK_ALIGN16 : STACK_ALIGNMENT; + IRManager & irm = getIRManager(); + EntryPointPseudoInst * entryPointInst = NULL; + int offset = 0; + + entryPointInst = irManager->getEntryPointInst(); + assert(entryPointInst->getNode() == irManager->getFlowGraph()->getEntryNode()); - for (uint32 i = 0; igetRefCount() && opnd->getMemOpndKind() == MemOpndKind_StackAutoLayout) { + // Create or reset displacements for stack memory operands. + for (uint32 i = 0; i < irm.getOpndCount(); i++) { + Opnd * opnd = irm.getOpnd(i); + if (opnd->getRefCount() && opnd->getMemOpndKind() == MemOpndKind_StackAutoLayout) { Opnd * dispOpnd=opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement); - if (dispOpnd==NULL){ - dispOpnd=irm.newImmOpnd(irm.getTypeManager().getInt32Type(), 0); + if (dispOpnd == NULL){ + dispOpnd = irm.newImmOpnd(irm.getTypeManager().getInt32Type(), 0); opnd->setMemOpndSubOpnd(MemOpndSubOpndKind_Displacement, dispOpnd); } dispOpnd->assignImmValue(0); } - }//end for - - int offset = 0; + } - //return EIP area + // Return EIP area. retEIPBase = offset; offset += sizeof(POINTER_SIZE_INT); - retEIPEnd = inargBase = offset; - uint32 slotSize=sizeof(POINTER_SIZE_INT); - EntryPointPseudoInst * entryPointInst = irManager->getEntryPointInst(); - assert(entryPointInst->getNode()==irManager->getFlowGraph()->getEntryNode()); - if (entryPointInst) {//process entry-point instruction + // Assign displacements for input operands. + if (entryPointInst) { const StlVector& stackOpndInfos = ((const EntryPointPseudoInst*)entryPointInst)->getCallingConventionClient().getStackOpndInfos(Inst::OpndRole_Def); - for (uint32 i=0, n=(uint32)stackOpndInfos.size(); igetCallingConventionClient().getCallingConvention()->pushLastToFirst() ? - ((n-1)*slotSize-stackOpndInfos[i].offset): -#endif - stackOpndInfos[i].offset; - - Opnd * opnd=entryPointInst->getOpnd(stackOpndInfos[i].opndIndex); + for (uint32 i = 0, n = (uint32)stackOpndInfos.size(); i < n; i++) { + uint64 argOffset = stackOpndInfos[i].offset; + Opnd * opnd = entryPointInst->getOpnd(stackOpndInfos[i].opndIndex); Opnd * disp = opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement); - disp->assignImmValue(offset+argOffset); + disp->assignImmValue(offset + argOffset); } } - - inargEnd = offset; - icalleeEnd = offset = 0; uint32 calleeSavedRegs=irm.getCallingConvention()->getCalleeSavedRegs(OpndKind_GPReg).getMask(); - uint32 usageRegMask = irManager->getTotalRegUsage(OpndKind_GPReg); - Inst * lastPush = NULL; - + + // Push callee-save registers onto stack. #ifdef _EM64T_ - //-------------------------------- - unsigned counter = 0; - for (uint32 reg = RegName_R15; reg >= RegName_RAX ; reg--) { - uint32 mask = getRegMask((RegName)reg); - if((mask & calleeSavedRegs) && (usageRegMask & mask)) counter++; - } - //-------------------------------- - for (uint32 reg = RegName_R15; reg >= RegName_RAX ; reg--) { + for (uint32 reg = RegName_R15; reg >= RegName_RAX; reg--) { #else - for (uint32 reg = RegName_EDI; reg>=RegName_EAX; reg--) {//push callee-save registers onto stack + for (uint32 reg = RegName_EDI; reg >= RegName_EAX; reg--) { #endif uint32 mask = getRegMask((RegName)reg); - if((mask & calleeSavedRegs) && (usageRegMask & mask)) { + if ((mask & calleeSavedRegs) && (usageRegMask & mask)) { Inst * inst = irm.newInst(Mnemonic_PUSH, irm.getRegOpnd((RegName)reg)); - if (!lastPush) + if (!lastPush) { lastPush = inst; + } inst->insertAfter(entryPointInst); offset -= slotSize; } } -#ifdef _EM64T_ - if(!(counter & 1)) { - Opnd * rsp = irManager->getRegOpnd(STACK_REG); - Type* uint64_type = irManager->getTypeFromTag(Type::UInt64); - Inst* newIns = irManager->newInst(Mnemonic_SUB,rsp,irManager->newImmOpnd(uint64_type, slotSize)); - newIns->insertAfter(entryPointInst); - offset -= slotSize; - stackCorrection = 1; - } -#endif - icalleeBase = fcalleeEnd = fcalleeBase = acalleeEnd = acalleeBase = localEnd = offset; - + // Retrieve relations not earlier than all memory locations are assigned. IRManager::AliasRelation * relations = new(irm.getMemoryManager()) IRManager::AliasRelation[irm.getOpndCount()]; - irm.getAliasRelations(relations);// retrieve relations no earlier than all memory locations are assigned + irm.getAliasRelations(relations); -#ifdef _EM64T_ - //-------------------------------- - counter = 0; - for (uint32 i = 0; igetRefCount() == 0) continue; if(opnd->getMemOpndKind() == MemOpndKind_StackAutoLayout) { - Opnd * dispOpnd=opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement); - if (dispOpnd->getImmValue()==0) { - uint32 cb=getByteSize(opnd->getSize()); - cb=(cb+slotSize-1)&~(slotSize-1); - counter+=cb; - } - } - } - if (counter & 15) { - offset -= 16-(counter&15); - } - //-------------------------------- -#endif - - for (uint32 i = 0; igetRefCount() == 0) - continue; - if(opnd->getMemOpndKind() == MemOpndKind_StackAutoLayout) { - Opnd * dispOpnd=opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement); - if (dispOpnd->getImmValue()==0) { + Opnd * dispOpnd = opnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement); + if (dispOpnd->getImmValue() == 0) { if (relations[opnd->getId()].outerOpnd == NULL) { - uint32 cb=getByteSize(opnd->getSize()); - cb=(cb+slotSize-1)&~(slotSize-1); + uint32 cb = getByteSize(opnd->getSize()); + cb=(cb + slotSize - 1) & ~(slotSize - 1); offset -= cb; dispOpnd->assignImmValue(offset); } @@ -409,32 +356,37 @@ } } + // Align stack pointer. Local area should preserve alignment available on function enter. + offset = offset & ~(stackSizeAlignment - 1); + + // Assert local area is properly aligned. + assert((offset & (STACK_ALIGNMENT - 1)) == 0); + localBase = offset; if (localEnd>localBase) { - Inst* newIns = irm.newInst(Mnemonic_SUB, irm.getRegOpnd(STACK_REG), irm.newImmOpnd(irm.getTypeManager().getInt32Type(), localEnd-localBase)); + Inst* newIns = irm.newInst(Mnemonic_SUB, irm.getRegOpnd(STACK_REG), irm.newImmOpnd(irm.getTypeManager().getInt32Type(), localEnd - localBase)); newIns->insertAfter(lastPush ? lastPush : entryPointInst); } frameSize = icalleeEnd -localBase; - } void StackLayouter::createEpilog() { // Predeccessors of en and irm.isEpilog(en->pred) - IRManager & irm=getIRManager(); - uint32 calleeSavedRegs=irm.getCallingConvention()->getCalleeSavedRegs(OpndKind_GPReg).getMask(); + IRManager & irm = getIRManager(); + uint32 calleeSavedRegs = irm.getCallingConvention()->getCalleeSavedRegs(OpndKind_GPReg).getMask(); const Edges& inEdges = irm.getFlowGraph()->getExitNode()->getInEdges(); uint32 usageRegMask = irManager->getTotalRegUsage(OpndKind_GPReg); for (Edges::const_iterator ite = inEdges.begin(), ende = inEdges.end(); ite!=ende; ++ite) { Edge* edge = *ite; if (irm.isEpilog(edge->getSourceNode())) { Node * epilog = edge->getSourceNode(); - Inst * retInst=(Inst*)epilog->getLastInst(); + Inst * retInst = (Inst*)epilog->getLastInst(); assert(retInst->hasKind(Inst::Kind_RetInst)); - if (localEnd>localBase) { - //restore stack pointer - Inst* newIns = irm.newInst(Mnemonic_ADD, irm.getRegOpnd(STACK_REG), irm.newImmOpnd(irm.getTypeManager().getInt32Type(), localEnd-localBase)); + if (localEnd > localBase) { + // Restore stack pointer. + Inst* newIns = irm.newInst(Mnemonic_ADD, irm.getRegOpnd(STACK_REG), irm.newImmOpnd(irm.getTypeManager().getInt32Type(), localEnd - localBase)); newIns->insertBefore(retInst); } #ifdef _EM64T_ @@ -448,12 +400,6 @@ newIns->insertBefore(retInst); } } -#ifdef _EM64T_ - if (stackCorrection) {//restore stack pointer - Inst* newIns = irm.newInst(Mnemonic_ADD, irm.getRegOpnd(STACK_REG), irm.newImmOpnd(irm.getTypeManager().getInt32Type(), sizeof(POINTER_SIZE_INT))); - newIns->insertBefore(retInst); - } -#endif } } } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp Thu Nov 8 04:01:07 2007 @@ -1938,8 +1938,8 @@ IPF_LOG << " newArray of " << arrayType->getElementType()->getName() << endl; Opnd *helperArgs[] = { - opndManager->newImm((int64) arrayType->getAllocationHandle()), - (Opnd *)numElems + (Opnd *)numElems, + opndManager->newImm((int64) arrayType->getAllocationHandle()) }; VM_RT_SUPPORT hId = VM_RT_NEW_VECTOR_USING_VTABLE; Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.cpp Thu Nov 8 04:01:07 2007 @@ -50,7 +50,7 @@ const CallSig ci_helper_o(CCONV_HELPERS, jobj); const CallSig ci_helper_v(CCONV_HELPERS); -const CallSig ci_helper_io(CCONV_HELPERS, i32, jobj); +const CallSig ci_helper_oi(CCONV_HELPERS, jobj, i32); const CallSig ci_helper_linkerr(CCONV_HELPERS, jobj, i32, i32); void CodeGen::do_mov(const Val& dst_s, const Val& src_s, bool skipTypeCheck) Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg.h Thu Nov 8 04:01:07 2007 @@ -55,9 +55,9 @@ */ extern const CallSig ci_helper_v; /** - * CallSig for a VM helper that takes 2 args: (#i32, #jobj). + * CallSig for a VM helper that takes 2 args: (#jobj, #i32). */ -extern const CallSig ci_helper_io; +extern const CallSig ci_helper_oi; /** * CallSig for VM helper THROW_LINKAGE_ERROR. */ Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_dbg.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_dbg.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_dbg.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_dbg.cpp Thu Nov 8 04:01:07 2007 @@ -83,6 +83,9 @@ void CodeGen::gen_dbg_check_stack(bool start) { + if (m_infoBlock.get_bc_size() == 1 && m_bc[0] == OPCODE_RETURN) { + return; // empty method, nothing to do + } if (start) { // We store SP before a code to be checked ... st(jobj, sp, m_base, voff(m_stack.dbg_scratch())); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_fld_arr.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_fld_arr.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_fld_arr.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_fld_arr.cpp Thu Nov 8 04:01:07 2007 @@ -133,13 +133,6 @@ gen_write_barrier(m_curr_inst->opcode, NULL, Opnd(0)); static const CallSig cs_aastore(CCONV_HELPERS, jobj, i32, jobj); unsigned stackFix = gen_stack_to_args(true, cs_aastore, 0); -#ifdef _EM64T_ - // Huh ? Do we really have another order of args here ? - AR gr = valloc(jobj); - mov(gr, cs_aastore.reg(0)); - mov(cs_aastore.reg(0), cs_aastore.reg(2)); - mov(cs_aastore.reg(2), gr); -#endif gen_call_vm(cs_aastore, rt_helper_aastore, 3); if (stackFix != 0) { alu(alu_sub, sp, stackFix); @@ -245,7 +238,7 @@ Val& ref = vstack(ref_depth, true); where = Opnd(jt, ref.reg(), fld_offset); } else { //field is not resolved -> generate code to request offset - static const CallSig cs_get_offset(CCONV_STDCALL, iplatf, i32, i32); + static const CallSig cs_get_offset(CCONV_HELPERS, iplatf, i32, i32); gen_call_vm(cs_get_offset, rt_helper_field_get_offset_withresolve, 0, fieldOp.enclClass, fieldOp.cpIndex, fieldOp.isPut()); runlock(cs_get_offset); rlock(gr_ret); @@ -259,7 +252,7 @@ char * fld_addr = (char*)field_get_address(fieldOp.fld); where = vaddr(jt, fld_addr); } else { //field is not resolved -> generate code to request address - static const CallSig cs_get_addr(CCONV_STDCALL, iplatf, i32, i32); + static const CallSig cs_get_addr(CCONV_HELPERS, iplatf, i32, i32); gen_call_vm(cs_get_addr, rt_helper_field_get_address_withresolve, 0, fieldOp.enclClass, fieldOp.cpIndex, fieldOp.isPut()); runlock(cs_get_addr); where = Opnd(jt, gr_ret, 0); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_instr.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_instr.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_instr.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_instr.cpp Thu Nov 8 04:01:07 2007 @@ -81,12 +81,12 @@ // test [eax+rt_suspend_req_flag_offset], 0 // I don't believe this will gain any improvements for .jet, so using // portable and 'official' way: - gen_call_vm(cs_v, rt_helper_get_tls_base_ptr, 0); + gen_call_vm(platform_v, rt_helper_get_tls_base_ptr, 0); // The address of flag is now in gr_ret Opnd mem(i32, gr_ret, rt_suspend_req_flag_offset); alu(alu_cmp, mem, Opnd(0)); unsigned br_off = br(z, 0, 0, taken); - gen_call_vm_restore(false, cs_v, rt_helper_gc_safepoint, 0); + gen_call_vm_restore(false, helper_v, rt_helper_gc_safepoint, 0); patch(br_off, ip()); } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp Thu Nov 8 04:01:07 2007 @@ -70,14 +70,21 @@ // Debugging things // - // Ensure stack is aligned properly - for _ALIGN16 only here. - // _ALIGN_HALF16 is handled below. - if (is_set(DBG_CHECK_STACK) && (m_ci.cc() & CCONV_STACK_ALIGN16)){ - alu(alu_test, sp, 0xF); + // Ensure stack is aligned properly. + unsigned alignment = (m_ci.cc() & CCONV_STACK_ALIGN_HALF16) ? CCONV_STACK_ALIGN16 + : m_ci.cc() & CCONV_STACK_ALIGN_MASK; + if (is_set(DBG_CHECK_STACK) && alignment != 0) { + if (m_ci.cc() & CCONV_STACK_ALIGN_HALF16) { + alu(alu_sub, sp, (unsigned)STACK_SLOT_SIZE); + } + alu(alu_test, sp, (alignment - 1)); unsigned br_off = br(eq, 0, 0); gen_dbg_rt(false, "Misaligned stack @ %s", meth_fname()); gen_brk(); patch(br_off, ip()); + if (m_ci.cc() & CCONV_STACK_ALIGN_HALF16) { + alu(alu_add, sp, (unsigned)STACK_SLOT_SIZE); + } } if (is_set(DBG_BRK)) { @@ -102,18 +109,7 @@ // unsigned frameSize = m_stack.size(); alu(alu_sub, sp, frameSize); - - // Ensure stack is aligned properly - do it here for _ALIGN_HALF16, - // as the stack must be (sp%16==0) at this point - if (is_set(DBG_CHECK_STACK) && (m_ci.cc() & CCONV_STACK_ALIGN_HALF16)){ - assert((frameSize+8) % 16 == 0); - alu(alu_test, sp, 0xF); - unsigned br_off = br(eq, 0, 0); - gen_dbg_rt(false, "Misaligned stack @ %s", meth_fname()); - gen_brk(); - patch(br_off, ip()); - } - + // Lock all the args registers to avoid them to be rewritten by the // frame setup procedures rlock(m_ci); @@ -533,6 +529,10 @@ else { AR gr = gr0; if (cs_mon.reg(0) != gr_x) { + if (cs_mon.size() != 0) { + assert(cs_mon.caller_pops()); + alu(alu_sub, sp, cs_mon.size()); + } ld(jobj, cs_mon.reg(0), m_base, voff(m_stack.thiz())); } else { @@ -585,6 +585,10 @@ } AR gr = valloc(jobj); if (cs_mon.reg(0) != gr_x) { + if (cs_mon.size() != 0) { + assert(cs_mon.caller_pops()); + alu(alu_sub, sp, cs_mon.size()); + } vpark(cs_mon.reg(0)); ld(jobj, cs_mon.reg(0), m_base, voff(m_stack.thiz())); } @@ -603,7 +607,7 @@ if (compilation_params.exe_notify_method_exit) { // JVMTI helper takes pointer to return value and method handle - const CallSig cs_ti_mexit(CCONV_STDCALL, jobj, jobj); + const CallSig cs_ti_mexit(CCONV_HELPERS, jobj, jobj); // The call is a bit unusual, and is processed as follows: // we load an address of the top of the operand stack into // a temporary register, and then pass this value as pointer @@ -685,8 +689,11 @@ Opnd op = vstack(0, true).as_opnd(); st(jtmov(retType), op.reg(), m_base, voff(m_stack.scratch())); ld(jobj, gtmp, m_base, voff(m_stack.scratch())); - if (cs_trace_arg.reg(0) != gr_x) { - assert(cs_trace_arg.size() == 0); + if (cs_trace_arg.reg(0) != gr_x) { + if (cs_trace_arg.size() != 0) { + assert(cs_trace_arg.caller_pops()); + alu(alu_sub, sp, cs_trace_arg.size()); + } mov(cs_trace_arg.reg(0), gtmp); } else { @@ -793,14 +800,14 @@ assert(m_lazy_resolution); //1. get method address if (opcod == OPCODE_INVOKESTATIC || opcod == OPCODE_INVOKESPECIAL) { - static const CallSig cs_get_is_addr(CCONV_STDCALL, iplatf, i32); + static const CallSig cs_get_is_addr(CCONV_HELPERS, iplatf, i32); char* helper = opcod == OPCODE_INVOKESTATIC ? rt_helper_get_invokestatic_addr_withresolve : rt_helper_get_invokespecial_addr_withresolve; gen_call_vm(cs_get_is_addr, helper, 0, m_klass, cpIndex); runlock(cs_get_is_addr); } else { assert(opcod == OPCODE_INVOKEVIRTUAL || opcod == OPCODE_INVOKEINTERFACE); - static const CallSig cs_get_iv_addr(CCONV_STDCALL, iplatf, i32, jobj); + static const CallSig cs_get_iv_addr(CCONV_HELPERS, iplatf, i32, jobj); char * helper = opcod == OPCODE_INVOKEVIRTUAL ? rt_helper_get_invokevirtual_addr_withresolve : rt_helper_get_invokeinterface_addr_withresolve; // setup constant parameters first, @@ -825,7 +832,7 @@ else if (opcod == OPCODE_INVOKEINTERFACE) { // if it's INVOKEINTERFACE, then first resolve it Class_Handle klass = method_get_class(meth); - const CallSig cs_vtbl(CCONV_STDCALL, jobj, jobj); + const CallSig cs_vtbl(CCONV_HELPERS, jobj, jobj); // Prepare args for ldInterface helper if (cs_vtbl.reg(0) == gr_x) { assert(cs_vtbl.size() != 0); @@ -833,7 +840,10 @@ st(jobj, thiz.reg(), sp, cs_vtbl.off(0)); } else { - assert(cs_vtbl.size() == 0); + if (cs_vtbl.size() != 0) { + assert(cs_vtbl.caller_pops()); + alu(alu_sub, sp, cs_vtbl.size()); + } mov(cs_vtbl.get(0), thiz.as_opnd()); } gen_call_vm(cs_vtbl, rt_helper_get_vtable, 1, klass); @@ -975,7 +985,9 @@ Opnd tmp(jt, gtmp); mov(tmp, Opnd(jt, gr_ret)); if (cs_trace_arg.reg(0) != gr_x) { - assert(cs_trace_arg.size() == 0); + if (cs_trace_arg.size() != 0) { + alu(alu_sub, sp, cs_trace_arg.size()); + } mov(cs_trace_arg.reg(0), gtmp); } else { Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp Thu Nov 8 04:01:07 2007 @@ -55,7 +55,7 @@ return; } assert(lazy); - static const CallSig cs_newarray_withresolve(CCONV_STDCALL, iplatf, i32, i32); + static const CallSig cs_newarray_withresolve(CCONV_HELPERS, iplatf, i32, i32); Val sizeVal = vstack(0); // setup constant parameters first, Val vclass(iplatf, enclClass); @@ -82,22 +82,11 @@ gen_call_throw(ci_helper_linkerr, rt_helper_throw_linking_exc, 0, m_klass, jinst.op0, jinst.opcode); } -#ifdef _EM64T_ static const CallSig cs_new_arr(CCONV_HELPERS, i32, jobj); unsigned stackFix = gen_stack_to_args(true, cs_new_arr, 0, 1); gen_call_vm(cs_new_arr, rt_helper_new_array, 1, ah); runlock(cs_new_arr); -#else - static const CallSig cs_new_arr(CCONV_HELPERS, jobj, i32); - rlock(cs_new_arr); - AR artmp = valloc(jobj); - rlock(artmp); - Encoder::gen_args(cs_new_arr, artmp, 0, 1, ah); - unsigned stackFix = gen_stack_to_args(true, cs_new_arr, 1, 1); - runlock(artmp); - gen_call_vm(cs_new_arr, rt_helper_new_array, cs_new_arr.count()); - runlock(cs_new_arr); -#endif + if (stackFix != 0) { alu(alu_sub, sp, stackFix); } @@ -129,7 +118,7 @@ bool resolve = !lazy || class_is_cp_entry_resolved(m_compileHandle, enclClass, cpIndex); if(!resolve) { assert(lazy); - static CallSig ci_get_class_withresolve(CCONV_STDCALL, iplatf, i32); + static CallSig ci_get_class_withresolve(CCONV_HELPERS, iplatf, i32); gen_call_vm(ci_get_class_withresolve, rt_helper_get_class_withresolve, 0, enclClass, cpIndex); runlock(ci_get_class_withresolve); klassVal = Val(jobj, gr_ret); @@ -179,12 +168,12 @@ } unsigned size = class_get_boxed_data_size(klass); Allocation_Handle ah = class_get_allocation_handle(klass); - static CallSig ci_new(CCONV_STDCALL, i32, jobj); + static CallSig ci_new(CCONV_HELPERS, i32, jobj); gen_call_vm(ci_new, rt_helper_new, 0, size, ah); } } else { assert(lazy); - static CallSig ci_new_with_resolve(CCONV_STDCALL, iplatf, i32); + static CallSig ci_new_with_resolve(CCONV_HELPERS, iplatf, i32); gen_call_vm(ci_new_with_resolve, rt_helper_new_withresolve, 0, enclClass, cpIndex); } gen_save_ret(jobj); @@ -204,7 +193,7 @@ assert(!lazy); gen_call_throw(ci_helper_linkerr, rt_helper_throw_linking_exc, 0, enclClass, cpIdx, opcode); } - static const CallSig cs(CCONV_STDCALL, jobj, jobj); + static const CallSig cs(CCONV_HELPERS, jobj, jobj); unsigned stackFix = gen_stack_to_args(true, cs, 0, 1); char * helper = opcode == OPCODE_CHECKCAST ? rt_helper_checkcast : rt_helper_instanceof; gen_call_vm(cs, helper, 1, klass); @@ -215,7 +204,7 @@ gen_save_ret(opcode == OPCODE_CHECKCAST ? jobj : i32); } else { assert(lazy); - static const CallSig cs_with_resolve(CCONV_STDCALL, iplatf, i32, jobj); + static const CallSig cs_with_resolve(CCONV_HELPERS, iplatf, i32, jobj); char * helper = opcode == OPCODE_CHECKCAST ? rt_helper_checkcast_withresolve : rt_helper_instanceof_withresolve; Val tos = vstack(0); // setup constant parameters first, @@ -233,7 +222,7 @@ { const JInst& jinst = *m_curr_inst; gen_check_null(0); - static const CallSig cs_mon(CCONV_MANAGED, jobj); + static const CallSig cs_mon(CCONV_HELPERS, jobj); unsigned stackFix = gen_stack_to_args(true, cs_mon, 0); gen_call_vm(cs_mon, jinst.opcode == OPCODE_MONITORENTER ? @@ -246,7 +235,7 @@ void CodeGen::gen_athrow(void) { - static const CallSig cs_throw(CCONV_MANAGED, jobj); + static const CallSig cs_throw(CCONV_HELPERS, jobj); unsigned stackFix = gen_stack_to_args(true, cs_throw, 0); gen_call_vm(cs_throw, rt_helper_throw, 1); runlock(cs_throw); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_stk.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_stk.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_stk.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_stk.cpp Thu Nov 8 04:01:07 2007 @@ -67,8 +67,7 @@ return; } assert(m_curr_inst->opcode != OPCODE_LDC2_W); - gen_call_vm(ci_helper_io, rt_helper_ldc_string, 0, m_curr_inst->op0, - m_klass); + gen_call_vm(ci_helper_oi, rt_helper_ldc_string, 0, m_klass, m_curr_inst->op0); gen_save_ret(jobj); vstack(0).set(VA_NZ); m_bbstate->seen_gcpt = true; Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.cpp Thu Nov 8 04:01:07 2007 @@ -29,15 +29,11 @@ namespace Jitrino { namespace Jet { -const CallSig cs_v(CCONV_STDCALL); +const CallSig helper_v(CCONV_HELPERS); +const CallSig platform_v(CCONV_HELPERS); void CallSig::init(void) { - // can't have stack alignment in calling convention when callee pops - // so if any of ALIGN set, then CALLER_POPS must also be set. - assert( !(m_cc&(CCONV_STACK_ALIGN16|CCONV_STACK_ALIGN_HALF16)) || - (m_cc&CCONV_CALLER_POPS)); - unsigned num = (unsigned)m_args.size(); m_data.resize(num); unsigned fps = 0, gps = 0; @@ -90,11 +86,18 @@ } } m_stack = -off; - // Do alignment - if (m_stack != 0 && - (m_cc & (CCONV_STACK_ALIGN16|CCONV_STACK_ALIGN_HALF16))) { - m_stack = (m_stack+15) & 0xFFFFFFF0; + m_alignment = 0; + + unsigned stack_on_enter_size = m_stack + sizeof(POINTER_SIZE_INT); + // Do alignment. + unsigned alignment = (m_cc & CCONV_STACK_ALIGN_HALF16) ? CCONV_STACK_ALIGN16 + : m_cc & CCONV_STACK_ALIGN_MASK; + if (alignment != 0 && stack_on_enter_size & (alignment - 1)) { + unsigned stack_on_enter_aligned = + (stack_on_enter_size + (alignment - 1)) & ~((alignment - 1)); + m_alignment = stack_on_enter_aligned - stack_on_enter_size; } + m_stack += m_alignment; } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/csig.h Thu Nov 8 04:01:07 2007 @@ -53,7 +53,12 @@ /** * @brief All args go though memory. */ -#define CCONV_MEM (0x00000004) +#define CCONV_MEM (0x00000020) + +/** + * @brief When entering a function, obey the (sp)%%4 == 0 rule. + */ +#define CCONV_STACK_ALIGN4 (0x00000004) /** * @brief When entering a function, obey the (sp+8)%%16 == 0 rule (Intel 64 @@ -67,6 +72,12 @@ #define CCONV_STACK_ALIGN16 (0x00000010) /** + * Mask to extract stack alignment form calling convention. + */ +#define CCONV_STACK_ALIGN_MASK (CCONV_STACK_ALIGN4 | CCONV_STACK_ALIGN_HALF16 | CCONV_STACK_ALIGN16) + + +/** * @brief IA-32's stdcall convention. */ #define CCONV_STDCALL_IA32 (CCONV_MEM) @@ -74,7 +85,7 @@ /** * @brief IA-32's cdecl convention. */ -#define CCONV_CDECL_IA32 (CCONV_CALLER_POPS|CCONV_MEM) +#define CCONV_CDECL_IA32 (CCONV_CALLER_POPS | CCONV_MEM) #ifdef _EM64T_ /** @@ -89,6 +100,7 @@ * @brief On IA-32 it's CCONV_CDECL_IA32, on EM64T it's CCONV_EM64T. */ #define CCONV_CDECL CCONV_EM64T + #define CCONV_PLATFORM CCONV_EM64T #ifdef _WIN32 /// A nubmer of FR registers dedicated to pass float-point arguments. #define MAX_FR_ARGS (4) @@ -98,13 +110,14 @@ #else #define CCONV_STDCALL CCONV_STDCALL_IA32 #define CCONV_CDECL CCONV_CDECL_IA32 + #define CCONV_PLATFORM CCONV_CDECL #define MAX_FR_ARGS (0) #endif /** * @brief IA-32's DRLVM's convention for managed code. */ -#define CCONV_MANAGED_IA32 (CCONV_L2R | CCONV_MEM) +#define CCONV_MANAGED_IA32 (CCONV_L2R | CCONV_MEM | CCONV_STACK_ALIGN16) /** * @brief A special case - VM's helper MULTIANEWARRAY always has cdecl-like * convention. @@ -116,15 +129,12 @@ * @brief On IA-32 it's CCONV_MANAGED_IA32, on EM64T it's CCONV_EM64T. */ #define CCONV_MANAGED CCONV_EM64T - /** - * @brief On IA-32 it's CCONV_MANAGED_IA32, on EM64T it's CCONV_EM64T. - */ - #define CCONV_HELPERS CCONV_EM64T #else #define CCONV_MANAGED CCONV_MANAGED_IA32 - #define CCONV_HELPERS CCONV_MANAGED_IA32 //CCONV_STDCALL #endif +#define CCONV_HELPERS CCONV_STDCALL + ///@} // ~JET_CCONV @@ -257,6 +267,13 @@ } /** + * @brief Returns size (in bytes) of padding area to achieve proper alignment. + */ + unsigned alignment() const { + return m_alignment; + } + + /** * @brief Returns size (in bytes) of the stack size needed to pass args * that go through the stack. */ @@ -366,6 +383,11 @@ * This implies presumption that a valid AR is alwys > 0. */ ::std::vector m_data; + + /** + * @brief Returns size (in bytes) of padding area to achieve proper alignment. + */ + unsigned m_alignment; /** * @brief Size (in bytes) of stack frame needed to pass arguments. * @@ -382,7 +404,8 @@ /** * @brief CallSig for stdcall function that takes no args. */ -extern const CallSig cs_v; +extern const CallSig helper_v; +extern const CallSig platform_v; }}; // ~namespace Jitrino::Jet Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/enc.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/enc.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/enc.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/enc.cpp Thu Nov 8 04:01:07 2007 @@ -517,19 +517,24 @@ if (is_trace_on()) { trace("call", to_str(target), ""); } - if (check_stack && - (ci.cc() & (CCONV_STACK_ALIGN_HALF16|CCONV_STACK_ALIGN16))) { - if (ci.cc() & CCONV_STACK_ALIGN16) { - alu(alu_sub, sp, 8); + + unsigned alignment = (ci.cc() & CCONV_STACK_ALIGN_HALF16) ? CCONV_STACK_ALIGN16 + : ci.cc() & CCONV_STACK_ALIGN_MASK; + if (check_stack && alignment != 0) { + alu(alu_sub, sp, (unsigned)STACK_SLOT_SIZE); + if (ci.cc() & CCONV_STACK_ALIGN_HALF16) { + alu(alu_sub, sp, (unsigned)STACK_SLOT_SIZE); } - alu(alu_test, sp, 0x0F); + alu(alu_test, sp, (alignment - 1)); unsigned br_off = br(z, 0, 0, taken); trap(); - if (ci.cc() & CCONV_STACK_ALIGN16) { - alu(alu_add, sp, 8); - } patch(br_off, ip()); + if (ci.cc() & CCONV_STACK_ALIGN_HALF16) { + alu(alu_add, sp, (unsigned)STACK_SLOT_SIZE); + } + alu(alu_add, sp, (unsigned)STACK_SLOT_SIZE); } + call_impl(target); if (ci.caller_pops() && ci.size() != 0) { alu(alu_add, sp, ci.size()); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sframe.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sframe.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sframe.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sframe.h Thu Nov 8 04:01:07 2007 @@ -247,15 +247,10 @@ unsigned size(void) const { unsigned sz = -unused(); - if (CCONV_MANAGED & CCONV_STACK_ALIGN16) { - return ((sz + 15) & ~0xF); - } - else if (CCONV_MANAGED & CCONV_STACK_ALIGN_HALF16) { - return ((sz + 15) & ~0xF) + 8; - } - else { - return ((sz + 3) & ~0x03); - } + unsigned alignment = (CCONV_MANAGED & CCONV_STACK_ALIGN_HALF16) ? CCONV_STACK_ALIGN16 + : CCONV_MANAGED & CCONV_STACK_ALIGN_MASK; + alignment = (alignment == 0) ? CCONV_STACK_ALIGN4 : alignment; + return ((sz + (alignment - 1)) & ~(alignment - 1)); } // @@ -378,4 +373,5 @@ }}; // ~namespace Jitrino::Jet #endif // ~__SFRAME_H_INCLUDED__ + Modified: harmony/enhanced/drlvm/trunk/vm/port/include/lil.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/include/lil.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/port/include/lil.h (original) +++ harmony/enhanced/drlvm/trunk/vm/port/include/lil.h Thu Nov 8 04:01:07 2007 @@ -108,10 +108,6 @@ rth = calling convention used to call runtime helpers stdcall = Windows's stdcall calling convention -20021204: The rth calling convention should be used for all runtime helpers. Unfortunately, on IA32 we are inconsistent in the calling - conventions used to call runtime helpers - some use stdcall, some use the managed code conventions. So for now, rth is to be - used for stdcall helpers, managed should be used for the rest. In the future we can harmonise this and correct the problem. - l is a label (sequence of alpha, digit, _, starting with alpha or _) v is a variable, one of: i0, i1, ... (input variables), sp0, sp1, ... (standard places), l0, l1, ... (local variables), o0, o1, ... (output variables), r (return variable) Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/lil_code_generator_ia32.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/lil_code_generator_ia32.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/lil_code_generator_ia32.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/lil_code_generator_ia32.cpp Thu Nov 8 04:01:07 2007 @@ -34,6 +34,7 @@ #include "m2n_ia32_internal.h" #include "vm_threads.h" #include "encoder.h" +#include "jit_runtime_support_common.h" // Strategy: // Up to 2 standard places @@ -1399,11 +1400,22 @@ { adjust_stack_for_return(); unsigned sz = sig_size_on_stack(ctxt.entry_sig); - if (ctxt.entry_cc.callee_pop && sz) { - *buf = ::ret(*buf, Imm_Opnd(sz)); - } else { - *buf = ::ret(*buf); + + if (ctxt.entry_cc.callee_pop) { + if (lil_sig_get_cc(ctxt.entry_sig) == LCC_Managed) { + // Managed calling convention assumes callee responsibility to + // handle alignment properly. Assuming that arguments were aligned, + // size of input arguments plus return pointer on the stack also should be aligned + sz += sizeof(POINTER_SIZE_INT); + sz = (sz + (MANAGED_STACK_ALIGNMENT - 1)) & ~(MANAGED_STACK_ALIGNMENT - 1); + sz -= sizeof(POINTER_SIZE_INT); + } + if (sz != 0) { + *buf = ::ret(*buf, Imm_Opnd(sz)); + return; + } } + *buf = ::ret(*buf); } void push_m2n(Method_Handle method, frame_type current_frame_type, bool handles) Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_runtime_support_common.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_runtime_support_common.h?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_runtime_support_common.h (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_runtime_support_common.h Thu Nov 8 04:01:07 2007 @@ -30,12 +30,35 @@ #include "platform_lowlevel.h" #include "heap.h" +/** + * When entering managed function, obey the (sp)%%4 == 0 rule. + */ +#define STACK_ALIGN4 (0x00000004) + +/** + * When entering managed function, obey the (sp)%%8 == 0 rule. + */ +#define STACK_ALIGN_HALF16 (0x00000008) + +/** + * When entering managed function, obey the (sp)%%16 == 0 rule. + */ +#define STACK_ALIGN16 (0x00000010) + + +#ifdef _EM64T_ + #define MANAGED_STACK_ALIGNMENT STACK_ALIGN_HALF16 +#else + // Use 16-byte stack pointer alignment to avoid perf penalty on SSE usage in JITted code. + #define MANAGED_STACK_ALIGNMENT STACK_ALIGN16 +#endif + VMEXPORT // temporary solution for interpreter unplug int __stdcall vm_instanceof(ManagedObject *obj, Class *c); // Implements VM_RT_AASTORE void * __stdcall -vm_rt_aastore(ManagedObject *elem, int idx, Vector_Handle array); +vm_rt_aastore(Vector_Handle array, int idx, ManagedObject *elem); // Implements VM_RT_AASTORE_TEST int __stdcall Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp Thu Nov 8 04:01:07 2007 @@ -1027,7 +1027,7 @@ NativeCodePtr addr = NULL; void (*p_throw_ame)(Class_Handle, Method_Handle) = prepare_throw_abstract_method_error; - LilCodeStub* cs = lil_parse_code_stub("entry 0:rth::void;" + LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall::void;" "push_m2n 0, 0;" "m2n_save_all;" "out platform:pint,pint:void;" @@ -1066,7 +1066,7 @@ NativeCodePtr addr = NULL; void (*p_throw_iae)(Class_Handle, Method_Handle) = prepare_throw_illegal_access_error; - LilCodeStub* cs = lil_parse_code_stub("entry 0:rth::void;" + LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall::void;" "push_m2n 0, 0;" "m2n_save_all;" "out platform:pint,pint:void;" Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Thu Nov 8 04:01:07 2007 @@ -690,7 +690,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed:ref:void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall:ref:void;" "push_m2n 0, 0;" "m2n_save_all;" "out platform:ref,pint,pint,pint:void;"); assert(cs); @@ -799,14 +799,14 @@ const unsigned cap_and_size = (unsigned)((0<<16) | 16); #ifdef _IPF_ - LilCodeStub *cs = lil_parse_code_stub("entry 1:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 1:stdcall::void;" "push_m2n 0, 0, handles;" "m2n_save_all;" "out platform:ref,pint,pint,pint:void;" "o0=0:ref;" "o1=sp0;" "o2=0;" "o3=0;" "call.noret %0i;", exn_athrow); #else - LilCodeStub *cs = lil_parse_code_stub("entry 1:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 1:stdcall::void;" "push_m2n 0, 0, handles;" "m2n_save_all;" "locals 1;" @@ -842,7 +842,7 @@ Class *exn_clss = VM_Global_State::loader_env->java_lang_NullPointerException_Class; LilCodeStub *cs = - lil_parse_code_stub("entry 0:managed::void;" "std_places 1;" + lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_clss, lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -883,7 +883,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_get_illegal_monitor_state_exception_type(), lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline()) @@ -910,7 +910,7 @@ Global_Env *env = VM_Global_State::loader_env; Class *exn_clss = env->java_lang_ArrayIndexOutOfBoundsException_Class; - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_clss, lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -950,7 +950,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_get_negative_array_size_exception_type(), lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -990,7 +990,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_get_illegal_state_exception_type(), lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -1013,7 +1013,7 @@ } Global_Env *env = VM_Global_State::loader_env; - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", env->java_lang_ArrayStoreException_Class, lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -1037,7 +1037,7 @@ } Global_Env *env = VM_Global_State::loader_env; - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", env->java_lang_ArithmeticException_Class, lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -1067,7 +1067,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_get_class_cast_exception_type(), lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); @@ -1106,7 +1106,7 @@ return addr; } - LilCodeStub *cs = lil_parse_code_stub("entry 0:managed::void;" + LilCodeStub *cs = lil_parse_code_stub("entry 0:stdcall::void;" "std_places 1;" "sp0=%0i;" "tailcall %1i;", exn_get_incompatible_class_change_exception_type(), lil_npc_to_fp(exn_get_rth_throw_lazy_trampoline())); Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?rev=593136&r1=593135&r2=593136&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Thu Nov 8 04:01:07 2007 @@ -295,7 +295,7 @@ if (is_synchronised) { if (is_static) { cs = lil_parse_onto_end(cs, - "out managed:pint:void;" + "out stdcall:pint:void;" "o0=%0i;" "call %1i;", clss, @@ -303,7 +303,7 @@ assert(cs); } else { cs = lil_parse_onto_end(cs, - "out managed:ref:void;" + "out stdcall:ref:void;" "o0=i0;" "call %0i;", lil_npc_to_fp(vm_get_rt_support_addr(VM_RT_MONITOR_ENTER))); @@ -461,7 +461,7 @@ if (is_synchronised) { if (is_static) { cs = lil_parse_onto_end(cs, - "out managed:pint:void;" + "out stdcall:pint:void;" "o0=%0i;" "call %1i;", clss, @@ -469,7 +469,7 @@ } else { cs = lil_parse_onto_end(cs, "ld l0,[l0+%0i:ref];" - "out managed:ref:void; o0=l0; call %1i;", + "out stdcall:ref:void; o0=l0; call %1i;", oh_get_handle_offset(0), lil_npc_to_fp(vm_get_rt_support_addr(VM_RT_MONITOR_EXIT))); } @@ -880,4 +880,5 @@ } } +