Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 61641 invoked from network); 30 Oct 2007 13:16:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2007 13:16:24 -0000 Received: (qmail 96797 invoked by uid 500); 30 Oct 2007 13:16:10 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 96773 invoked by uid 500); 30 Oct 2007 13:16:10 -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 96748 invoked by uid 99); 30 Oct 2007 13:16:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Oct 2007 06:16:10 -0700 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; Tue, 30 Oct 2007 13:16:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 961261A9832; Tue, 30 Oct 2007 06:15:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r590063 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32: Ia32CgUtils.cpp Ia32CgUtils.h Ia32CodeEmitter.cpp Ia32GCSafePoints.cpp Ia32Inst.h Ia32InstCodeSelector.cpp Date: Tue, 30 Oct 2007 13:15:55 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071030131558.961261A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Tue Oct 30 06:15:53 2007 New Revision: 590063 URL: http://svn.apache.org/viewvc?rev=590063&view=rev Log: Final fix for HARMONY-5016 [drlvm][jit][opt] code patching may corrupt calls to helpers on x86-64 in OPT mode Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp?rev=590063&r1=590062&r2=590063&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp Tue Oct 30 06:15:53 2007 @@ -229,6 +229,19 @@ return m_opndFloatZero; } +Opnd* OpndUtils::findImmediateSource(Opnd* opnd) +{ + Opnd* res = opnd; + while (!res->isPlacedIn(OpndKind_Imm)) { + Inst* defInst = res->getDefiningInst(); + if (!defInst || defInst->getMnemonic()!=Mnemonic_MOV) { + return NULL; + } + res = defInst->getOpnd(1); + } + return res; +} + //All CALL insts except some special helpers that never cause stacktrace printing bool InstUtils::instMustHaveBCMapping(Inst* inst) { if (!inst->hasKind(Inst::Kind_CallInst)) { @@ -236,7 +249,8 @@ } CallInst* callInst = (CallInst*)inst; Opnd * targetOpnd=callInst->getOpnd(callInst->getTargetOpndIndex()); - Opnd::RuntimeInfo * ri=targetOpnd->getRuntimeInfo(); + Opnd* immOpnd = OpndUtils::findImmediateSource(targetOpnd); + Opnd::RuntimeInfo * ri = immOpnd ? immOpnd->getRuntimeInfo() : NULL; if(!ri) { return true; } else if (ri->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress) { Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h?rev=590063&r1=590062&r2=590063&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h Tue Oct 30 06:15:53 2007 @@ -177,6 +177,13 @@ * Tests 2 operands for equality. */ static bool equals(const Opnd* a, const Opnd* b); + + /** + * Searches for a source of an immediate value (if any) of the specified operand. + * Returns the "defining" operand or \c NULL. + */ + static Opnd* findImmediateSource(Opnd* opnd); + // // The following are not static and require IRManager // 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?rev=590063&r1=590062&r2=590063&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Tue Oct 30 06:15:53 2007 @@ -641,9 +641,11 @@ Type* targetType = irManager->getTypeManager().getInt64Type(); Opnd* targetVal = irManager->newImmOpnd(targetType,(int64)targetCodeStartAddr); + targetVal->setRuntimeInfo(inst->getOpnd(targetOpndIndex)->getRuntimeInfo()); Opnd* targetReg = irManager->newRegOpnd(targetType, RegName_R11); Inst* movInst = irManager->newInst(Mnemonic_MOV, targetReg, targetVal); + targetReg->setDefiningInst(movInst); inst->setOpnd(targetOpndIndex,targetReg); @@ -684,8 +686,9 @@ } } } - if (newOpndsCreated) + if (newOpndsCreated) { irManager->fixLivenessInfo(); + } } //________________________________________________________________________________________ Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp?rev=590063&r1=590062&r2=590063&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp Tue Oct 30 06:15:53 2007 @@ -23,6 +23,7 @@ #include "Ia32GCSafePoints.h" #include "XTimer.h" #include "BitSet.h" +#include "Ia32CgUtils.h" namespace Jitrino @@ -334,18 +335,6 @@ #endif } -static Opnd* findImmediateSource(Opnd* opnd) { - Opnd* res = opnd; - while (!res->isPlacedIn(OpndKind_Imm)) { - Inst* defInst = res->getDefiningInst(); - if (!defInst || defInst->getMnemonic()!=Mnemonic_MOV) { - return NULL; - } - res = defInst->getOpnd(1); - } - return res; -} - int32 GCSafePointsInfo::getOffsetFromImmediate(Opnd* offsetOpnd) const { if (offsetOpnd->isPlacedIn(OpndKind_Immediate)) { if (offsetOpnd->getImmValue() == 0 && offsetOpnd->getRuntimeInfo()!=NULL) { @@ -538,7 +527,7 @@ case Mnemonic_SUB: fromOpnd = opnd; Opnd* offsetOpnd = inst->getOpnd(useIndex1); - Opnd* immOffset = findImmediateSource(offsetOpnd); + Opnd* immOffset = OpndUtils::findImmediateSource(offsetOpnd); if (immOffset) { if (isHeapBase(immOffset)) { offset = 0; 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=590063&r1=590062&r2=590063&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 Tue Oct 30 06:15:53 2007 @@ -289,7 +289,7 @@ /** * Returns the number of occurrences of the operand in LIR. * The value may take into account basic block execution count (profile information). - * Non-zero result means the operand is used in LIR and non-zero means it is not. + * Non-zero result means the operand is used in LIR and zero means it is not. * * The refCount value is calculated during IRManager::calculateOpndStatistics. */ @@ -300,13 +300,18 @@ /** * Return the defining inst for operands with a single definition. - * If the operand has multiple deinitions the method returns 0. + * If the operand has multiple definitions the method returns 0. * - * The definingInst value is calculated during IRManager::calculateOpndStatistics. + * The definingInst value is normally calculated during IRManager::calculateOpndStatistics. */ Inst * getDefiningInst()const{ return definingInst; } /** + * Assigns the defining inst for operands with a single definition. + */ + void setDefiningInst(Inst * inst); + + /** * Returns true if the operand is used in liveness analysis. * For example, immediate values and heap operands do not participate * in liveness analysis. @@ -333,8 +338,6 @@ void addRefCount(uint32& index, uint32 blockExecCount); - void setDefiningInst(Inst * inst); - #ifdef _DEBUG void checkConstraints(); #else @@ -344,7 +347,9 @@ //------------------------------------------------------------------------- Opnd(uint32 _id, Type * t, Constraint c) - :id(_id), firstId(_id), type(t), memOpndKind(MemOpndKind_Null), segReg(RegName_Null), immValue(0), runtimeInfo(NULL) + :id(_id), firstId(_id), type(t), memOpndKind(MemOpndKind_Null), + defScope(DefScope_Null), definingInst(NULL), refCount(0), + segReg(RegName_Null), immValue(0), runtimeInfo(NULL) { constraints[ConstraintKind_Initial]=constraints[ConstraintKind_Calculated]=c; } //------------------------------------------------------------------------- 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=590063&r1=590062&r2=590063&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 Tue Oct 30 06:15:53 2007 @@ -207,7 +207,7 @@ { assert(currentBasicBlock); inst->setBCOffset(currentHIRInstBCOffset); - assert(!InstUtils::instMustHaveBCMapping(inst) || currentHIRInstBCOffset!=ILLEGAL_BC_MAPPING_VALUE); + assert(currentHIRInstBCOffset!=ILLEGAL_BC_MAPPING_VALUE || !InstUtils::instMustHaveBCMapping(inst)); if (Log::isEnabled()){ Inst * i=inst; do {