harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r559409 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H4514/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/main/
Date Wed, 25 Jul 2007 11:54:40 GMT
Author: mfursov
Date: Wed Jul 25 04:54:38 2007
New Revision: 559409

URL: http://svn.apache.org/viewvc?view=rev&rev=559409
Log:
Fix for HARMONY-4514 with regression test
Fix for HARMONY-4520

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H4514/
    harmony/enhanced/drlvm/trunk/src/test/regression/H4514/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H4514/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
    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/Ia32RuntimeInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H4514/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H4514/Test.java?view=auto&rev=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H4514/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H4514/Test.java Wed Jul 25 04:54:38 2007
@@ -0,0 +1,62 @@
+package org.apache.harmony.drlvm.tests.regression.h4514;
+import junit.framework.*;
+public class Test extends TestCase {
+    
+    public void testTrace1() {
+        try {
+            assertEquals(0, 1); //the number of this line must be in tracktracelement
+        } catch (Throwable e) {
+            StackTraceElement thisFrame = findThisFrame(e);
+            assertEquals(7, thisFrame.getLineNumber());
+        }
+    }
+
+    public void testTrace2() {
+        try {
+            fail();//the number of this line must be in tracktracelement
+        } catch (Throwable e) {
+            StackTraceElement thisFrame = findThisFrame(e);
+            assertEquals(16, thisFrame.getLineNumber());
+        }
+    }
+
+    public void testTrace3() {
+        try {
+            assertEquals(true, false);//the number of this line must be in tracktracelement
+        } catch (Throwable e) {
+            StackTraceElement thisFrame = findThisFrame(e);
+            assertEquals(25, thisFrame.getLineNumber());
+        }
+
+    }
+
+    public void testTrace4() {
+        try {
+            assertNotNull(null);//the number of this line must be in tracktracelement
+        } catch (Throwable e) {
+            StackTraceElement thisFrame = findThisFrame(e);
+            assertEquals(35, thisFrame.getLineNumber());
+        }
+
+    }
+
+    public void testTrace5() {
+        try {
+            assertEquals("", "fail");//the number of this line must be in tracktracelement
+        } catch (Throwable e) {
+            StackTraceElement thisFrame = findThisFrame(e);
+            assertEquals(45, thisFrame.getLineNumber());
+        }
+
+    }
+
+    static StackTraceElement findThisFrame(Throwable e) {
+        StackTraceElement[] frames =  e.getStackTrace();
+        for (StackTraceElement frame : frames) {
+            if (frame.getClassName().equals(Test.class.getName())) {
+                return frame;
+            }
+        }
+        return null;
+    }
+}

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H4514/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H4514/run.test.xml?view=auto&rev=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H4514/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H4514/run.test.xml Wed Jul 25 04:54:38
2007
@@ -0,0 +1,13 @@
+<project name="RUN HARMONY-4514 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+            test="org.apache.harmony.drlvm.tests.regression.h4514.Test"
+            vmarg="-Xem:jet">
+        </run-junit-test>
+        <run-junit-test 
+            test="org.apache.harmony.drlvm.tests.regression.h4514.Test"
+            vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h?view=diff&rev=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h Wed Jul 25
04:54:38 2007
@@ -31,12 +31,10 @@
 
 namespace Ia32 {
 
-const static int byteCodeOffsetSize = sizeof(POINTER_SIZE_INT); // byteCodeAddrSize should
be 2, 4 will allow easy mem alignment
-
-typedef StlHashMap<POINTER_SIZE_INT, uint16>      BCByNCMap;
+typedef StlHashMap<uint32, uint16>      BCByNCMap;
 /**
-   * Bcmap is simple storage with precise mapping between native address to
-   * byte code, i.e. if there is no byte code for certain native address then
+   * Bcmap is simple storage with precise mapping between native offset in a method to
+   * byte code, i.e. if there is no byte code for certain native offset in a method then
    * invalid value is returned.
    */
 
@@ -44,98 +42,62 @@
 public:
     BcMap(MemoryManager& memMgr) : theMap(memMgr) {}
 
-    POINTER_SIZE_INT getByteSize() {
-        POINTER_SIZE_INT mapSize = (POINTER_SIZE_INT)theMap.size();
-        //TODO: use only 2 byte to keep BC offset but not 4 nor 8!!
-        return  (mapSize * (byteCodeOffsetSize + sizeof(POINTER_SIZE_INT)) + sizeof(POINTER_SIZE_INT));
+    uint32 getByteSize() const {
+        return 4 /*size*/+theMap.size() * (4 + 2/*native offset + bc offset*/);
     }
 
-    void write(Byte* output) {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)output;
-        BCByNCMap::const_iterator citer;
-        POINTER_SIZE_INT mapSize;
-        POINTER_SIZE_INT i = 0;
-
-        mapSize = (POINTER_SIZE_INT)theMap.size();
-        data[0] = mapSize; //store map size
-        data = data + 1;
-
-        for (citer = theMap.begin(); citer != theMap.end(); citer++) {
-            data[i*2] = (POINTER_SIZE_INT)citer->first;  // write key i.e. native addr
-            data[i*2+1] = (POINTER_SIZE_INT)citer->second;  // write value i.e. bc offset
-            i++;
+    void write(Byte* image) {
+        *((uint32*)image)=theMap.size();
+        uint32 imageOffset = 4;
+        for (BCByNCMap::const_iterator it = theMap.begin(), end = theMap.end(); it!=end;
it++) {
+            uint32 nativeOffset = it->first;
+            uint16 bcOffset = it->second;
+            *((uint32*)(image + imageOffset)) = nativeOffset;
+            imageOffset+=4;
+            *((uint16*)(image + imageOffset)) = bcOffset;
+            imageOffset+=2;
         }
         return;
     }
 
-    POINTER_SIZE_INT readByteSize(const Byte* input) const {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)input;
-        POINTER_SIZE_INT sizeOfMap = data[0];
-
-        return (sizeOfMap * (byteCodeOffsetSize + sizeof(POINTER_SIZE_INT)) + sizeof(POINTER_SIZE_INT));
-    }
-
-    /** read is deprecated method since creating HashMap is too cost */
-    void read(const Byte* output) {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)output;
-        POINTER_SIZE_INT mapSize;
-        POINTER_SIZE_INT i = 0;
-
-        mapSize = data[0]; //read map size
-        data = data + 1;
-
-        for (i = 0; i < mapSize; i++) {
-            POINTER_SIZE_INT ncAddr = data[i * 2];
-            uint16 bcOffset = (uint16)data[i * 2 + 1];
-            setEntry(ncAddr, bcOffset);  // read key i.e. native addr and read value i.e.
bc offset
-        }
-        return;
+    POINTER_SIZE_INT readByteSize(const Byte* image) const {
+        uint32 sizeOfMap = *(uint32*)image;;
+        return 4 + sizeOfMap * (4+2);
     }
 
-    void writeZerroSize(Byte* output) {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)(output);
-        data[0] = 0;
-
-        return;
-    }
-    void setEntry(POINTER_SIZE_INT key, uint16 value) {
+    
+    void setEntry(uint32 key, uint16 value) {
         theMap[key] =  value;
     }
 
-    
-    static uint16 get_bc_location_for_native(POINTER_SIZE_INT ncAddress, Byte* output) {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)output;
-        POINTER_SIZE_INT mapSize;
-        POINTER_SIZE_INT i = 0;
-
-        mapSize = data[0]; //read map size 
-        data = data + 1;
-
-        for (i = 0; i < mapSize; i++) {
-            POINTER_SIZE_INT ncAddr = data[i * 2];
-            uint16 bcOffset = (uint16)data[i * 2 + 1];
-            if (ncAddr == ncAddress) return bcOffset;
+    static uint16 get_bc_offset_for_native_offset(uint32 ncOffset, Byte* image) {
+        uint32 mapSize = *(uint32*)image; //read map size
+        uint32 imageOffset=4;
+        for (uint32 i = 0; i < mapSize; i++) {
+            uint32 nativeOffset = *(uint32*)(image+imageOffset);
+            imageOffset+=4;
+            uint16 bcOffset = *(uint16*)(image+imageOffset);
+            imageOffset+=2;
+            if (nativeOffset == ncOffset) {
+                return bcOffset;
+            }
         }
         return ILLEGAL_BC_MAPPING_VALUE;
     }
 
-    static POINTER_SIZE_INT get_native_location_for_bc(uint16 bcOff, Byte* output) {
-        POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)output;
-        POINTER_SIZE_INT mapSize;
-        POINTER_SIZE_INT i = 0;
-
-        mapSize = data[0]; //read map size 
-        data = data + 1;
-
-        POINTER_SIZE_INT ncAddress = 0xdeadbeef;
-
-        for (i = 0; i < mapSize; i++) {
-            POINTER_SIZE_INT ncAddr = data[i * 2];
-            uint16 bcOffset = (uint16)data[i * 2 + 1];
-            if (bcOffset == bcOff) ncAddress = ncAddr;
+    static uint32 get_native_offset_for_bc_offset(uint16 bcOff, Byte* image) {
+        uint32 mapSize = *(uint32*)image; //read map size
+        uint32 imageOffset=4;
+        for (uint32 i = 0; i < mapSize; i++) {
+            uint32 nativeOffset = *(uint32*)(image+imageOffset);
+            imageOffset+=4;
+            uint16 bcOffset = *(uint16*)(image+imageOffset);
+            imageOffset+=2;
+            if (bcOffset == bcOff) {
+                return nativeOffset;
+            }
         }
-
-        return ncAddress;
+        return MAX_UINT32;
     }
 
 private:

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=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Wed
Jul 25 04:54:38 2007
@@ -45,7 +45,7 @@
         :memoryManager("CodeEmitter"),
         exceptionHandlerInfos(memoryManager), constantAreaLayout(memoryManager),
         traversalInfo(memoryManager), methodLocationMap(memoryManager), 
-        entryExitMap(memoryManager), instSizeMap(memoryManager)
+        entryExitMap(memoryManager), instSizeMap(memoryManager), bcMap(NULL), inlineBCMap(NULL)
     {
     }
 
@@ -68,8 +68,8 @@
     void registerDirectCall(MethodDesc * md, void * instStartAddr);
     
     ///methods fo registering bc-offsets for inlined methods
-    void registerInlineInfoOffsets(Node* node, InlineInfoMap::Entry* parentEntry, InlineInfoMap*
inlineBCMap);
-    void registerInlineInfoOffsets( void );
+    void registerBCOffsets(Node* node, InlineInfoMap::Entry* parentEntry);
+    void registerBCMappingAndInlineInfo();
 
     void orderNodesAndMarkInlinees(StlList<MethodMarkerPseudoInst*>& container,

         Node * node, bool isForward);
@@ -135,6 +135,8 @@
     StlMap<MethodMarkerPseudoInst*, CompiledMethodInfo* > methodLocationMap;
     StlMap<MethodMarkerPseudoInst*, MethodMarkerPseudoInst* > entryExitMap;
     StlMap<POINTER_SIZE_INT, unsigned> instSizeMap;
+    BcMap* bcMap;
+    InlineInfoMap* inlineBCMap;
 };
 
 typedef StlMap<POINTER_SIZE_INT, uint16> LocationMap;
@@ -291,7 +293,6 @@
 //________________________________________________________________________________________
 void CodeEmitter::runImpl()
 {
-    irManager->setInfo(INLINE_INFO_KEY, new(irManager->getMemoryManager()) InlineInfoMap(irManager->getMemoryManager()));
     constantAreaLayout.doLayout(irManager);
     irManager->resolveRuntimeInfo();
     emitCode();
@@ -300,7 +301,7 @@
     constantAreaLayout.finalizeSwitchTables();
     traversalInfo.resize(irManager->getFlowGraph()->getMaxNodeId() + 1, 0);
     registerExceptionHandlers();
-    registerInlineInfoOffsets();
+    registerBCMappingAndInlineInfo();
     if (irManager->getCompilationInterface().isCompileLoadEventRequired()) {
         reportCompiledInlinees();
     }
@@ -328,7 +329,14 @@
 
 typedef StlVector<MethodMarkerPseudoInst*> Markers;
 
-void CodeEmitter::registerInlineInfoOffsets(Node* node, InlineInfoMap::Entry* parentEntry,
InlineInfoMap* inlineBCMap) {
+static uint16 getTopLevelEntryOffset(InlineInfoMap::Entry* entry) {
+    if (entry->parentEntry==NULL) {
+        return entry->bcOffset;
+    } 
+    return getTopLevelEntryOffset(entry->parentEntry);
+}
+
+void CodeEmitter::registerBCOffsets(Node* node, InlineInfoMap::Entry* parentEntry) {
     assert(traversalInfo[node->getId()] == 0);
     traversalInfo[node->getId()] = 1;   
     
@@ -355,20 +363,35 @@
                 assert(parentEntry->method == endMarker->getMethodDesc()->getMethodHandle());
                 parentEntry = parentEntry->parentEntry;
             }
-        } else if (isBCMapCandidate(inst) && parentEntry!=NULL) {
+        } else if (isBCMapCandidate(inst)) {
+            uint16 globalBCMapOffset = inst->getBCOffset(); 
+            POINTER_SIZE_INT nativeInstStartOffset = (POINTER_SIZE_INT)inst->getCodeStartAddr()
- (POINTER_SIZE_INT)irManager->getCodeStartAddr();
+            POINTER_SIZE_INT nativeInstEndOffset = nativeInstStartOffset + inst->getCodeSize();
+            assert(fit32(nativeInstStartOffset));
+            if (parentEntry) {
+                if (Log::isEnabled()) {
+                    IRPrinter::printIndent(Log::out(), parentEntry->getInlineDepth()+1);
+                    IRPrinter::printInst(Log::out(), inst);
+                    Log::out()<<" native-offset="<<nativeInstEndOffset<<"
bc-offset="<<inst->getBCOffset();
+                }
+                uint16 bcOffset = inst->getBCOffset();
+                globalBCMapOffset = getTopLevelEntryOffset(parentEntry);
+                assert(bcOffset!=ILLEGAL_BC_MAPPING_VALUE || !InstUtils::instMustHaveBCMapping(inst));

+                InlineInfoMap::Entry* e = inlineBCMap->newEntry(parentEntry, parentEntry->method,
bcOffset);
+
+                //register whole entry chain now
+                inlineBCMap->registerEntry(e, (uint32)nativeInstEndOffset);
+            }
             if (Log::isEnabled()) {
-                IRPrinter::printIndent(Log::out(), parentEntry->getInlineDepth()+1);
-                IRPrinter::printInst(Log::out(), inst);
-                Log::out()<<" bc offset="<<inst->getBCOffset()<<std::endl;
+                if (!parentEntry) {
+                    IRPrinter::printInst(Log::out(), inst);
+                    Log::out()<<" native-offset="<<nativeInstStartOffset;
+                }
+                Log::out()<<" global-bc-offset="<<globalBCMapOffset<<std::endl;
+            }
+            if (globalBCMapOffset!=ILLEGAL_BC_MAPPING_VALUE) {
+                bcMap->setEntry(nativeInstStartOffset, globalBCMapOffset);
             }
-            uint16 bcOffset = inst->getBCOffset();
-            assert(bcOffset!=ILLEGAL_BC_MAPPING_VALUE || !InstUtils::instMustHaveBCMapping(inst));

-            InlineInfoMap::Entry* e = inlineBCMap->newEntry(parentEntry, parentEntry->method,
bcOffset);
-
-            //register whole entry chain now
-            POINTER_SIZE_INT nativeOffset = (POINTER_SIZE_INT)inst->getCodeStartAddr()
+ inst->getCodeSize() - (POINTER_SIZE_INT)irManager->getCodeStartAddr();
-            assert(fit32(nativeOffset));
-            inlineBCMap->registerEntry(e, (uint32)nativeOffset);
         }
     }
     const Edges& edges = node->getOutEdges();
@@ -376,7 +399,7 @@
         Edge* e = *ite;
         Node* n = e->getTargetNode();
         if (traversalInfo[n->getId()]==0) {
-            registerInlineInfoOffsets(n, parentEntry, inlineBCMap);
+            registerBCOffsets(n, parentEntry);
         }
     }
     
@@ -384,18 +407,22 @@
 }
 
 //________________________________________________________________________________________
-void CodeEmitter::registerInlineInfoOffsets() 
+void CodeEmitter::registerBCMappingAndInlineInfo() 
 {
+    bcMap = new(irManager->getMemoryManager()) BcMap(irManager->getMemoryManager());
+    irManager->setInfo(BCMAP_INFO_KEY, bcMap);
+    
+    inlineBCMap = new(irManager->getMemoryManager()) InlineInfoMap(irManager->getMemoryManager());
+    irManager->setInfo(INLINE_INFO_KEY, inlineBCMap);
+
     //process all inlined methods and register all insts that can throw exceptions in InlineInfoMap
     assert(traversalInfo.size() == irManager->getFlowGraph()->getMaxNodeId() + 1);
     std::fill(traversalInfo.begin(), traversalInfo.end(), 0);
-    InlineInfoMap* inlineBCMap = (InlineInfoMap*)irManager->getInfo(INLINE_INFO_KEY);
-    assert(inlineBCMap!=NULL && inlineBCMap->isEmpty());
     Node* entry = irManager->getFlowGraph()->getEntryNode();
     
-    Log::out()<<"--Inline info offsets registration STARTED"<<std::endl;
-    registerInlineInfoOffsets(entry, NULL, inlineBCMap);
-    Log::out()<<"--Inline info offsets registration FINISHED"<<std::endl;
+    Log::out()<<"--BC mapping info offsets registration STARTED"<<std::endl;
+    registerBCOffsets(entry, NULL);
+    Log::out()<<"--BC mapping info offsets registration FINISHED"<<std::endl;
 }
 
 //________________________________________________________________________________________
@@ -560,9 +587,6 @@
 //________________________________________________________________________________________
 void CodeEmitter::postPass()
 {  
-    MemoryManager& irmm = irManager->getMemoryManager();
-    BcMap* bcMap = new(irmm) BcMap(irmm);
-    irManager->setInfo(BCMAP_INFO_KEY, bcMap);
     bool newOpndsCreated = false;
     for( BasicBlock * bb = (BasicBlock*)irManager->getFlowGraph()->getEntryNode();
bb != NULL; bb=bb->getLayoutSucc()) {
         for (Inst* inst = (Inst*)bb->getFirstInst(); inst!=NULL; inst = inst->getNextInst())
{
@@ -590,8 +614,6 @@
                 } else 
                     continue;
                 int64 offset=targetCodeStartAddr-instCodeEndAddr;
-
-                uint16 bcOffset = inst->getBCOffset();
 #ifdef _EM64T_
                 if ( !fit32(offset) ) { // offset is not a signed value that fits into 32
bits
                     // this is for direct calls only
@@ -626,14 +648,6 @@
                         // code patcher knows about this collision
                         registerDirectCall(md,callAddr);
                     }
-
-                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
-                        bcMap->setEntry((POINTER_SIZE_INT)movAddr, bcOffset); // MOV
-                        // add both possible calls into bcMap
-                        bcMap->setEntry((POINTER_SIZE_INT)callAddr, bcOffset); // CALL
(immediate)
-                        bcMap->setEntry((POINTER_SIZE_INT)callAddr+2, bcOffset); // CALL
(register)
-                    }
-
                     newOpndsCreated = true;
                 } 
                 else 
@@ -645,19 +659,6 @@
 
                     if (inst->hasKind(Inst::Kind_CallInst) && md){
                         registerDirectCall(md,instCodeStartAddr);
-                    }
-
-                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE && isBCMapCandidate(inst))
{
-                        if (Log::isEnabled()) {
-                            Log::out()<<"Registering inst in BCMAP:"; IRPrinter::printInst(Log::out(),
inst); 
-                            Log::out()<<" bcOffset="<<bcOffset<<std::endl;
-                        }
-                        bcMap->setEntry((POINTER_SIZE_INT)instCodeStartAddr, bcOffset);
-                        if (inst->hasKind(Inst::Kind_CallInst)){
-                            // the call can be moved two bytes further after transformation
-                            // into register form during code patching 
-                            bcMap->setEntry((POINTER_SIZE_INT)instCodeStartAddr+2, bcOffset);
-                        }
                     }
                 }
             }   

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=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Wed Jul 25
04:54:38 2007
@@ -591,13 +591,7 @@
     stackInfo->write(infoBlock);
     gcMap->write(infoBlock+stackInfoSize);
 
-    if (compIntf.isBCMapInfoRequired()) {
-        bcMap->write(infoBlock + stackInfoSize + gcInfoSize);
-    } else {
-        // if no bc info write size equal to zerro
-        // this will make possible handle errors in case
-        bcMap->writeZerroSize(infoBlock + stackInfoSize + gcInfoSize);
-    } 
+    bcMap->write(infoBlock + stackInfoSize + gcInfoSize);
 }
 
 }} //namespace

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=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Wed Jul
25 04:54:38 2007
@@ -1071,15 +1071,24 @@
                 Inst * defInst = base->getDefiningInst();
                 if(defInst && defInst->getMnemonic() == Mnemonic_MOV) {
                     addr = defInst->getOpnd(1);
-                    if(!addr->getRuntimeInfo())
-                        addr = NULL;
+                    if(!addr->getRuntimeInfo()) {
+                        // addr opnd may be spilled. Let's try deeper
+                        defInst = addr->getDefiningInst();
+                        if(defInst && defInst->getMnemonic() == Mnemonic_MOV)
{
+                            addr = defInst->getOpnd(1);
+                        } else {
+                            addr = NULL;
+                        }
+                    }
                 }
             }
 #else
             Opnd * addr = sourceOpnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement);
 #endif
-            void * fpPtr = (void *)((ConstantAreaItem *)addr->getRuntimeInfo()->getValue(0))->getValue();
-            if( addr && addr->getRuntimeInfo()->getKind()==Opnd::RuntimeInfo::Kind_ConstantAreaItem)
{
+            Opnd::RuntimeInfo* addrRI = addr == NULL ? NULL : addr->getRuntimeInfo();
+
+            if( addrRI && addrRI->getKind()==Opnd::RuntimeInfo::Kind_ConstantAreaItem)
{
+                void * fpPtr = (void *)((ConstantAreaItem *)addrRI->getValue(0))->getValue();
                 if (sourceByteSize==4) {
                     float val = *(float *)fpPtr;
                     if(val == 0 && !signbit(val)) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp?view=diff&rev=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
Wed Jul 25 04:54:38 2007
@@ -81,16 +81,15 @@
     POINTER_SIZE_INT stackInfoSize = stackInfo.readByteSize(infoBlock);
     POINTER_SIZE_INT gcMapSize = GCMap::readByteSize(infoBlock + stackInfoSize);
 
-    const char* methName;
-
-    uint16 bcOffset = BcMap::get_bc_location_for_native(native_pc, infoBlock + stackInfoSize
+ gcMapSize);
+    POINTER_SIZE_INT nativeOffset = (POINTER_SIZE_INT)native_pc - (POINTER_SIZE_INT)method->getCodeBlockAddress(0);
+    assert(nativeOffset<=1024*1024*1024);//extra check: we do not generate such a large
methods..
+    uint16 bcOffset = BcMap::get_bc_offset_for_native_offset((uint32)nativeOffset, infoBlock
+ stackInfoSize + gcMapSize);
     if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
         *bc_pc = bcOffset;
         return true;
-    } else if (Log::isLogEnabled(LogStream::RT)) {
-        methName = method->getName();
-        Log::log(LogStream::RT) << "Native code for method: " << methName <<
" BC = " << bc_pc 
-                << " not found " << std::endl;
+    } 
+    if (Log::isLogEnabled(LogStream::RT)) {
+        Log::log(LogStream::RT) << "Native code for method: "<<method->getName()<<"
BC = " << bc_pc << " not found " << std::endl;
     }
     return false;
 }
@@ -101,16 +100,13 @@
     POINTER_SIZE_INT stackInfoSize = stackInfo.readByteSize(infoBlock);
     POINTER_SIZE_INT gcMapSize = GCMap::readByteSize(infoBlock + stackInfoSize);
 
-    const char* methName;
-
-    POINTER_SIZE_INT ncAddr = BcMap::get_native_location_for_bc(bc_pc, infoBlock + stackInfoSize
+ gcMapSize);
-    if (ncAddr != ILLEGAL_BC_MAPPING_VALUE) {
-        *native_pc =  ncAddr;
+    uint32 nativeOffset = BcMap::get_native_offset_for_bc_offset(bc_pc, infoBlock + stackInfoSize
+ gcMapSize);
+    if (nativeOffset!= MAX_UINT32) {
+        *native_pc =  (POINTER_SIZE_INT)(method->getCodeBlockAddress(0) + nativeOffset);
         return true;
-    } else if (Log::isLogEnabled(LogStream::RT)) {
-        methName = method->getName();
-        Log::log(LogStream::RT) << "Native code for method: " << methName <<
" BC = " << bc_pc 
-                << " not found " << std::endl;
+    } 
+    if (Log::isLogEnabled(LogStream::RT)) {
+        Log::log(LogStream::RT) << "Native code for method: "<<method->getName()<<"
BC = " << bc_pc << " not found " << std::endl;
     }
     return false;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp?view=diff&rev=559409&r1=559408&r2=559409
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp Wed Jul 25 04:54:38 2007
@@ -292,13 +292,21 @@
 Method_Handle
 Jitrino::GetInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
 {
-    return runtimeInterface->getInlinedMethod(ptr, offset, inline_depth);
+    //+1 here because VM counts inlined methods range like: [0...max_depth)
+    //where 0 is the first inlined frame.
+    //but Jitrino.OPT algorithm counts methods like [0...max_depth]
+    //where 0 is an original method
+    return runtimeInterface->getInlinedMethod(ptr, offset, inline_depth+1);
 }
 
 uint16
 Jitrino::GetInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
 {
-    return runtimeInterface->getInlinedBc(ptr, offset, inline_depth);
+    //+1 here because VM counts inlined methods range like: [0...max_depth)
+    //where 0 is the first inlined frame.
+    //but Jitrino.OPT algorithm counts methods like [0...max_depth]
+    //where 0 is an original method
+    return runtimeInterface->getInlinedBc(ptr, offset, inline_depth + 1);
 }
 
 bool



Mime
View raw message