You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2007/05/30 07:37:28 UTC

svn commit: r542754 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: codegenerator/ codegenerator/ia32/ codegenerator/ipf/ codegenerator/ipf/include/ dynopt/ main/ optimizer/ shared/ vm/drl/

Author: varlax
Date: Tue May 29 22:37:26 2007
New Revision: 542754

URL: http://svn.apache.org/viewvc?view=rev&rev=542754
Log:
Applied HARMONY-3991 [drlvm][jit] Memory management improvements in Jitrino compiler

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h
    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/Ia32CodeGenerator.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/MemoryEstimates.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h Tue May 29 22:37:26 2007
@@ -479,7 +479,7 @@
     // Any subsequently generated instructions have no associated ID.
     virtual void            clearCurrentPersistentId() = 0;
     // Set current HIR instruction in order to allow Code Generator propagate bc offset info
-    virtual void setCurrentHIRInstrID(uint64 HIRInstrID) = 0; 
+    virtual void setCurrentHIRInstrID(uint32 HIRInstrID) = 0; 
 private:
 };
 
@@ -581,8 +581,8 @@
 
     virtual void* getAddressOfThis(MethodDesc* methodDesc, const ::JitFrameContext* context, bool isFirst) = 0;
 
-    virtual bool getBcLocationForNative(MethodDesc* method, uint64 native_pc, uint16 *bc_pc) = 0;
-    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, uint64 *native_pc) = 0;
+    virtual bool getBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc) = 0;
+    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, POINTER_SIZE_INT *native_pc) = 0;
 
 #ifdef USE_SECURITY_OBJECT
     virtual void* getAddressOfSecurityObject(MethodDesc* methodDesc, const ::JitFrameContext* context) = 0;

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=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BCMap.h Tue May 29 22:37:26 2007
@@ -30,6 +30,10 @@
 namespace Jitrino {
 
 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;
 /**
    * 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
@@ -38,31 +42,25 @@
 
 class BcMap {
 public:
-    BcMap() {}
-    BcMap(MemoryManager& memMgr) {
-        theMap = new(memMgr) StlHashMap<uint64, uint64>(memMgr);
-#ifdef _DEBUG
-        revMultiMap = new(memMgr) StlHashMultiMap<uint64, uint64>(memMgr);
-#endif
-    }
+    BcMap(MemoryManager& memMgr) : theMap(memMgr) {}
 
     POINTER_SIZE_INT getByteSize() {
-        POINTER_SIZE_INT mapSize = (POINTER_SIZE_INT)theMap->size();
-
-        return  (mapSize * (byteCodeOffsetSize + wordSize) + wordSize);
+        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));
     }
 
     void write(Byte* output) {
         POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)output;
-        StlHashMap<uint64, uint64>::const_iterator citer;
+        BCByNCMap::const_iterator citer;
         POINTER_SIZE_INT mapSize;
         POINTER_SIZE_INT i = 0;
 
-        mapSize = (POINTER_SIZE_INT)theMap->size();
+        mapSize = (POINTER_SIZE_INT)theMap.size();
         data[0] = mapSize; //store map size
         data = data + 1;
 
-        for (citer = theMap->begin(); citer != theMap->end(); citer++) {
+        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++;
@@ -74,8 +72,9 @@
         POINTER_SIZE_INT* data = (POINTER_SIZE_INT*)input;
         POINTER_SIZE_INT sizeOfMap = data[0];
 
-        return (sizeOfMap * (byteCodeOffsetSize + wordSize) + wordSize);
+        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;
@@ -86,9 +85,8 @@
         data = data + 1;
 
         for (i = 0; i < mapSize; i++) {
-            uint64 ncAddr, bcOffset;
-            ncAddr = data[i * 2];
-            bcOffset = data[i * 2 + 1];
+            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;
@@ -100,22 +98,12 @@
 
         return;
     }
-    void setEntry(uint64 key, uint64 value) {
-        (*theMap)[key] =  value;
-#ifdef _DEBUG
-        revMultiMap->insert(IntPair(value, key));
-#endif
-    }
-
-    /** this method is deprecated  since creating HashMap is too cost */
-    uint64 get_bc_location_for_native_prev(uint64 ncAddr) {
-        StlHashMap<uint64, uint64>::const_iterator citer = theMap->find(ncAddr);
-        if ( citer!= theMap->end()) {
-            return citer->second;
-        } else return ILLEGAL_VALUE;
+    void setEntry(POINTER_SIZE_INT key, uint16 value) {
+        theMap[key] =  value;
     }
 
-    static uint64 get_bc_location_for_native(uint64 ncAddress, Byte* output) {
+    
+    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;
@@ -124,15 +112,14 @@
         data = data + 1;
 
         for (i = 0; i < mapSize; i++) {
-            uint64 ncAddr, bcOffset;
-            ncAddr = data[i * 2];
-            bcOffset = data[i * 2 + 1];
+            POINTER_SIZE_INT ncAddr = data[i * 2];
+            uint16 bcOffset = (uint16)data[i * 2 + 1];
             if (ncAddr == ncAddress) return bcOffset;
         }
-        return ILLEGAL_VALUE;
+        return ILLEGAL_BC_MAPPING_VALUE;
     }
 
-    static uint64 get_native_location_for_bc(uint64 bcOff, Byte* output) {
+    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;
@@ -140,59 +127,19 @@
         mapSize = data[0]; //read map size 
         data = data + 1;
 
-        uint64 ncAddress = ILLEGAL_VALUE;
+        POINTER_SIZE_INT ncAddress = 0xdeadbeef;
 
         for (i = 0; i < mapSize; i++) {
-            POINTER_SIZE_INT ncAddr, bcOffset;
-            ncAddr = data[i * 2];
-            bcOffset = data[i * 2 + 1];
+            POINTER_SIZE_INT ncAddr = data[i * 2];
+            uint16 bcOffset = (uint16)data[i * 2 + 1];
             if (bcOffset == bcOff) ncAddress = ncAddr;
         }
 
         return ncAddress;
     }
 
-    /** this method is deprecated  since creating HashMap is too cost */
-    uint64 get_native_location_for_bc_prev(uint64 bcOff, Byte* output) {
-        uint64 ncAddress = ILLEGAL_VALUE;
-#ifdef _DEBUG
-        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, bcOffset;
-            ncAddr = data[i * 2];
-            bcOffset = data[i * 2 + 1];
-            setEntry(ncAddr, bcOffset);  // read key i.e. native addr and read value i.e. bc offset
-        }
-
-        StlHashMultiMap<uint64, uint64>::const_iterator citer = revMultiMap->find(bcOff);
-        for ( citer = revMultiMap->begin(); citer != revMultiMap->end(); citer++) {
-            if (ncAddress > citer->second) ncAddress = citer->second;
-        }
-#endif
-        return ncAddress;
-    }
-
-    bool isBcOffsetExist(uint64 bcOff) {
-#ifdef _DEBUG
-        if (revMultiMap->has(bcOff)) return true;
-#endif
-        return false;
-    }
-protected:
 private:
-    POINTER_SIZE_INT sizeInBytes;
-    POINTER_SIZE_INT mapSize;
-    StlHashMap<uint64, uint64>* theMap;
-    StlHashMultiMap<uint64, uint64>* revMultiMap;
-    const static int wordSize = sizeof(POINTER_SIZE_INT); // 4 bytes for ia32
-    const static int byteCodeOffsetSize = sizeof(POINTER_SIZE_INT); // byteCodeAddrSize should be 2, 4 will allow easy mem alignment
-    typedef ::std::pair <uint64, uint64> IntPair;
+    BCByNCMap theMap;
 };
 
 }} //namespace

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=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Tue May 29 22:37:26 2007
@@ -124,7 +124,7 @@
     };
     
     // bc to native map stuff
-    VectorHandler* bc2LIRMapHandler;
+    void* bc2LIRMapHandler;
 
     MemoryManager                   memoryManager;
     StlVector<ExceptionHandlerInfo> exceptionHandlerInfos;
@@ -291,7 +291,7 @@
 {
     if (irManager->getCompilationInterface().isBCMapInfoRequired()) {
         MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
-        bc2LIRMapHandler = new(memoryManager) VectorHandler(bcOffset2LIRHandlerName, meth);
+        bc2LIRMapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
     }
 
     irManager->setInfo(INLINE_INFO_KEY, new(irManager->getMemoryManager()) InlineInfoMap(irManager->getMemoryManager()));
@@ -527,7 +527,7 @@
                     continue;
                 int64 offset=targetCodeStartAddr-instCodeEndAddr;
 
-                uint64 bcOffset = isBcRequired ? bc2LIRMapHandler->getVectorEntry(inst->getId()) : ILLEGAL_VALUE;
+                uint16 bcOffset = isBcRequired ? getBCMappingEntry(bc2LIRMapHandler, inst->getId()) : ILLEGAL_BC_MAPPING_VALUE;
 #ifdef _EM64T_
                 if ( !fit32(offset) ) { // offset is not a signed value that fits into 32 bits
                     // this is for direct calls only
@@ -563,11 +563,11 @@
                         registerDirectCall(md,callAddr);
                     }
 
-                    if (bcOffset != ILLEGAL_VALUE) {
-                        bcMap->setEntry((uint64)(POINTER_SIZE_INT)movAddr, bcOffset); // MOV
+                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+                        bcMap->setEntry((POINTER_SIZE_INT)movAddr, bcOffset); // MOV
                         // add both possible calls into bcMap
-                        bcMap->setEntry((uint64)(POINTER_SIZE_INT)callAddr, bcOffset); // CALL (immediate)
-                        bcMap->setEntry((uint64)(POINTER_SIZE_INT)callAddr+2, bcOffset); // CALL (register)
+                        bcMap->setEntry((POINTER_SIZE_INT)callAddr, bcOffset); // CALL (immediate)
+                        bcMap->setEntry((POINTER_SIZE_INT)callAddr+2, bcOffset); // CALL (register)
                     }
 
                     newOpndsCreated = true;
@@ -583,12 +583,12 @@
                         registerDirectCall(md,instCodeStartAddr);
                     }
 
-                    if (bcOffset != ILLEGAL_VALUE) {
-                        bcMap->setEntry((uint64)(POINTER_SIZE_INT)instCodeStartAddr, bcOffset);
+                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+                        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((uint64)(POINTER_SIZE_INT)instCodeStartAddr+2, bcOffset);
+                            bcMap->setEntry((POINTER_SIZE_INT)instCodeStartAddr+2, bcOffset);
                         }
                     }
                 }
@@ -854,14 +854,14 @@
                     if( ! inst->hasKind(Inst::Kind_PseudoInst)) {
                         instSizeMap[(POINTER_SIZE_INT) inst->getCodeStartAddr()] = inst->getCodeSize();
                     }
-                    uint64 instID = inst->getId();
-                    uint64 bcOffset = bc2LIRMapHandler->getVectorEntry(instID);
+                    uint32 instID = inst->getId();
+                    uint16 bcOffset = getBCMappingEntry(bc2LIRMapHandler, instID);
                     methInfo->includeInst(inst,bcOffset);
                     // addLocation with ILLEGAL_VALUE for all outers
                     MethodMarkerPseudoInst* outerEntry = methInfo->getOuterMethodEntry();
                     while (outerEntry) {
                         CompiledMethodInfo* outerInfo = methodLocationMap[outerEntry];
-                        outerInfo->includeInst(inst, ILLEGAL_VALUE);
+                        outerInfo->includeInst(inst, ILLEGAL_BC_MAPPING_VALUE);
                         outerEntry = outerInfo->getOuterMethodEntry();
                     }
                 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp Tue May 29 22:37:26 2007
@@ -117,9 +117,10 @@
     
     MethodDesc* meth = ci->getMethodToCompile();
     if (ci->isBCMapInfoRequired()) {
-        StlVector<uint64>* lirMap = new(mm) StlVector<uint64> (mm, 
-            (size_t) getVectorSize(bcOffset2HIRHandlerName, meth) * 
-            ESTIMATED_LIR_SIZE_PER_HIR + 5, ILLEGAL_VALUE);
+        void* hirMapping = getContainerHandler(bcOffset2HIRHandlerName, meth);
+        StlVector<uint16>* lirMap = new(mm) StlVector<uint16> (mm, 
+            getNumBCMapEntries(hirMapping) * ESTIMATED_LIR_SIZE_PER_HIR + 5, 
+            ILLEGAL_BC_MAPPING_VALUE);
         addContainerHandler(lirMap, bcOffset2LIRHandlerName, meth);
     }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp Tue May 29 22:37:26 2007
@@ -65,8 +65,8 @@
 
     if (compIntfc.isBCMapInfoRequired()) {
         MethodDesc* meth = compIntfc.getMethodToCompile();
-        bc2HIRmapHandler = new(irMemManager) VectorHandler(bcOffset2HIRHandlerName, meth);
-        bc2LIRmapHandler = new(irMemManager) VectorHandler(bcOffset2LIRHandlerName, meth);
+        bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
+        bc2LIRmapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
    }
     InstCodeSelector::onCFGInit(irManager);
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h Tue May 29 22:37:26 2007
@@ -136,8 +136,8 @@
     //
     // bc map info
     //
-    VectorHandler* bc2HIRmapHandler;
-    VectorHandler* bc2LIRmapHandler;
+    void* bc2HIRmapHandler;
+    void* bc2LIRmapHandler;
 
     friend class InstCodeSelector;
 };

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp Tue May 29 22:37:26 2007
@@ -340,11 +340,10 @@
 void CopyExpansion::runImpl()
 {
     CompilationInterface& compIntfc = irManager->getCompilationInterface();
-    VectorHandler* bc2LIRmapHandler = NULL;
-    MemoryManager& mm = irManager->getMemoryManager();
+    void* bc2LIRmapHandler = NULL;
 
     if (compIntfc.isBCMapInfoRequired()) {
-        bc2LIRmapHandler = new(mm) VectorHandler(bcOffset2LIRHandlerName, compIntfc.getMethodToCompile());
+        bc2LIRmapHandler = getContainerHandler(bcOffset2LIRHandlerName, compIntfc.getMethodToCompile());
     }
 
     // call SimpleStackOpndCoalescer before all other things including finalizeCallSites
@@ -402,20 +401,19 @@
                         }
                         copySequence = irManager->newCopySequence(mn, inst->getOpnd(0), NULL, gpRegUsageMask, flagsRegUsageMask);
                     }
-                    // CopyPseudoInst map entries should be changed by new copy sequence instrutions in byte code map
+                    // CopyPseudoInst map entries should be changed by new copy sequence instructions in byte code map
                     if (compIntfc.isBCMapInfoRequired() && copySequence != NULL) {
-                        uint64 instID = inst->getId();
-                        uint64 bcOffs = bc2LIRmapHandler->getVectorEntry(instID);
-                        if (bcOffs != ILLEGAL_VALUE) {
+                        uint32 instID = inst->getId();
+                        uint16 bcOffs = getBCMappingEntry(bc2LIRmapHandler, instID);
+                        if (bcOffs != ILLEGAL_BC_MAPPING_VALUE) {
                             Inst * cpInst=NULL, * nextCpInst=copySequence, * lastCpInst=copySequence->getPrev(); 
                             do { 
                                 cpInst=nextCpInst;
                                 nextCpInst=cpInst->getNext();
-                                uint64 cpInstID = cpInst->getId();
-                                bc2LIRmapHandler->setVectorEntry(cpInstID, bcOffs);
+                                uint32 cpInstID = cpInst->getId();
+                                setBCMappingEntry(bc2LIRmapHandler, cpInstID, bcOffs);
                             } while ((cpInst != lastCpInst) && (cpInst != NULL));
                         }
-                        bc2LIRmapHandler->removeVectorEntry(instID);
                     }
                     // End of code map change
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h Tue May 29 22:37:26 2007
@@ -527,45 +527,6 @@
 
 #define VERIFY_OUT(s) { if (Log::isEnabled()) Log::out() << s; std::cerr << s; }
 
-/** MapHandler is auxilary class to eliminate direct usage of map handlers between HLO and codegenerator */
-
-class MapHandler {
-public:
-    MapHandler(const char* handlerName, MethodDesc* meth) {
-        handler = getContainerHandler(handlerName, meth);
-    }
-    uint64 getMapEntry(uint64 key) {
-        return ::Jitrino::getMapEntry(handler, key);
-    }
-    void setMapEntry(uint64 key, uint64 value) {
-        ::Jitrino::setMapEntry(handler, key, value);
-    }
-    void removeMapEntry(uint64 key) {
-        ::Jitrino::removeMapEntry(handler, key);
-    }
-private:
-    void* handler;
-};
-
-class VectorHandler {
-public:
-    VectorHandler(const char* handlerName, MethodDesc* meth) {
-        handler = getContainerHandler(handlerName, meth);
-    }
-    uint64 getVectorEntry(uint64 key) {
-        return ::Jitrino::getVectorEntry(handler, key);
-    }
-    void setVectorEntry(uint64 key, uint64 value) {
-        ::Jitrino::setVectorEntry(handler, key, value);
-    }
-    void removeVectorEntry(uint64 key) {
-        ::Jitrino::removeVectorEntry(handler, key);
-    }
-private:
-    void* handler;
-};
-
-
 
 //========================================================================================
 // class Ia32::SessionAction

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?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Tue May 29 22:37:26 2007
@@ -203,9 +203,11 @@
 {
     assert(currentBasicBlock);
     if (compilationInterface.isBCMapInfoRequired()) {
-        uint64 bcOffset = codeSelector.bc2HIRmapHandler->getVectorEntry(currentHIRInstrID);
-        uint64 insID = inst->getId();
-        if (bcOffset != ILLEGAL_VALUE) codeSelector.bc2LIRmapHandler->setVectorEntry(insID, bcOffset);
+        uint16 bcOffset = getBCMappingEntry(codeSelector.bc2HIRmapHandler, currentHIRInstrID);
+        uint32 insID = inst->getId();
+        if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+            setBCMappingEntry(codeSelector.bc2LIRmapHandler, insID, bcOffset);
+        }
     }
     if (Log::isEnabled()){
         Inst * i=inst; 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h Tue May 29 22:37:26 2007
@@ -309,14 +309,14 @@
     //
     // Set current HIR instruction in order to allow Code Generator propagate bc offset info
     //
-    virtual void setCurrentHIRInstrID(uint64 HIRInstrID) {
+    virtual void setCurrentHIRInstrID(uint32 HIRInstrID) {
         currentHIRInstrID =  HIRInstrID;
     }
 private: 
     //
     // pointer to HIR instruction with bytecode offset 
     //
-    uint64 currentHIRInstrID;
+    uint32 currentHIRInstrID;
 
     Opnd *  convertIntToInt(Opnd * srcOpnd, Type * dstType, Opnd * dstOpnd=NULL, bool isZeroExtend=false);
     Opnd *  convertIntToFp(Opnd * srcOpnd, Type * dstType, Opnd * dstOpnd=NULL);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp Tue May 29 22:37:26 2007
@@ -819,10 +819,10 @@
 
     if (bb) {
         out << "\\l|\\" << std::endl;
-        VectorHandler* lirMapHandler = NULL;
+        void* lirMapHandler = NULL;
         if (irManager->getCompilationInterface().isBCMapInfoRequired()) {
             MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
-            lirMapHandler = new(irManager->getMemoryManager()) VectorHandler(bcOffset2LIRHandlerName, meth);
+            lirMapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
             assert(lirMapHandler);
         }
         for (Inst * inst = (Inst*)bb->getFirstInst(); inst != NULL; inst = inst->getNextInst()) {
@@ -830,10 +830,10 @@
             if ((kind & instFilter)==(uint32)kind){
                 printInst(inst);
                 if (lirMapHandler != NULL) {
-                    uint64 bcOffset = 0;
-                    uint64 instID = inst->getId();
-                    bcOffset = lirMapHandler->getVectorEntry(instID);
-                    if (bcOffset != ILLEGAL_VALUE) out<<" bcOff: "<< (uint16)bcOffset << " ";
+                    uint16 bcOffset = 0;
+                    uint32 instID = inst->getId();
+                    bcOffset = getBCMappingEntry(lirMapHandler, instID);
+                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) out<<" bcOff: "<< (uint16)bcOffset << " ";
                 }
                 out << "\\l\\" << ::std::endl;
             }

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=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp Tue May 29 22:37:26 2007
@@ -70,7 +70,7 @@
     stackInfo.fixHandlerContext(context);
 }
 
-bool RuntimeInterface::getBcLocationForNative(MethodDesc* method, uint64 native_pc, uint16 *bc_pc)
+bool RuntimeInterface::getBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc)
 {
     StackInfo stackInfo;
 
@@ -84,9 +84,9 @@
 
     const char* methName;
 
-    uint64 bcOffset = BcMap::get_bc_location_for_native(native_pc, infoBlock + stackInfoSize + gcMapSize);
-    if (bcOffset != ILLEGAL_VALUE) {
-        *bc_pc = (uint16)bcOffset;
+    uint16 bcOffset = BcMap::get_bc_location_for_native(native_pc, infoBlock + stackInfoSize + gcMapSize);
+    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+        *bc_pc = bcOffset;
         return true;
     } else if (Log::isLogEnabled(LogStream::RT)) {
         methName = method->getName();
@@ -95,7 +95,7 @@
     }
     return false;
 }
-bool RuntimeInterface::getNativeLocationForBc(MethodDesc* method, uint16 bc_pc, uint64 *native_pc) {
+bool RuntimeInterface::getNativeLocationForBc(MethodDesc* method, uint16 bc_pc, POINTER_SIZE_INT *native_pc) {
     StackInfo stackInfo;
 
     Byte* infoBlock = method->getInfoBlock();
@@ -104,8 +104,8 @@
 
     const char* methName;
 
-    uint64 ncAddr = BcMap::get_native_location_for_bc(bc_pc, infoBlock + stackInfoSize + gcMapSize);
-    if (ncAddr != ILLEGAL_VALUE) {
+    POINTER_SIZE_INT ncAddr = BcMap::get_native_location_for_bc(bc_pc, infoBlock + stackInfoSize + gcMapSize);
+    if (ncAddr != ILLEGAL_BC_MAPPING_VALUE) {
         *native_pc =  ncAddr;
         return true;
     } else if (Log::isLogEnabled(LogStream::RT)) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.h Tue May 29 22:37:26 2007
@@ -58,8 +58,8 @@
 
     virtual bool  recompiledMethodEvent(MethodDesc * methodDesc, void * data);
 
-    virtual bool getBcLocationForNative(MethodDesc* method, uint64 native_pc, uint16 *bc_pc);
-    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, uint64 *native_pc);
+    virtual bool getBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc);
+    virtual bool getNativeLocationForBc(MethodDesc* method,  uint16 bc_pc, POINTER_SIZE_INT *native_pc);
 
     virtual uint32          getInlineDepth(InlineInfoPtr ptr, uint32 offset);
     virtual Method_Handle   getInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32WebMaker.cpp Tue May 29 22:37:26 2007
@@ -351,7 +351,7 @@
     {
         Opndx* opndxp = 0;
         if (!irManager->getOpnd(i)->hasAssignedPhysicalLocation())
-            opndxp = new Opndx(mm);
+            opndxp = new (mm) Opndx(mm);
         opndxs[i] = opndxp;
     }
 
@@ -441,7 +441,7 @@
 {
     nodexs.resize(nodecount);
     for (size_t n = 0; n != nodecount; ++n)
-        nodexs[n] = new Nodex(mm, globcount);
+        nodexs[n] = new (mm) Nodex(mm, globcount);
 
     Opndx* opndxp;
     for (size_t i = 0; i != opandcount; ++i)
@@ -633,7 +633,7 @@
                         else
                         {// global oprand
                             if (opdefp->useps == 0)
-                                opdefp->useps = new OpDef::Instps(mm);
+                                opdefp->useps = new (mm) OpDef::Instps(mm);
                             if (!isdef)
                                 opdefp->useps->push_back(instp);
                         }
@@ -713,7 +713,7 @@
 BitSet* WebMaker::bitsetp (BitSet*& bsp)
 {
     if (bsp == 0)
-        bsp = new BitSet(mm, globcount);
+        bsp = new (mm) BitSet(mm, globcount);
     else
         bsp->resize(globcount);
     return bsp;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfRuntimeInterface.cpp Tue May 29 22:37:26 2007
@@ -211,7 +211,7 @@
 
 //----------------------------------------------------------------------------------------//
 
-bool RuntimeInterface::getBcLocationForNative(MethodDesc *methodDesc, uint64 native_pc, uint16 *bc_pc) {
+bool RuntimeInterface::getBcLocationForNative(MethodDesc *methodDesc, POINTER_SIZE_INT native_pc, uint16 *bc_pc) {
 
     std::cout << "FIXME: IPF::RuntimeInterface::getBcLocationForNative " << methodDesc->getName() << endl;
 //    assert(0);
@@ -221,7 +221,7 @@
 
 //----------------------------------------------------------------------------------------//
 
-bool RuntimeInterface::getNativeLocationForBc(MethodDesc *methodDesc,  uint16 bc_pc, uint64 *native_pc) {
+bool RuntimeInterface::getNativeLocationForBc(MethodDesc *methodDesc,  uint16 bc_pc, POINTER_SIZE_INT *native_pc) {
 
     std::cout << "FIXME: IPF::RuntimeInterface::getNativeLocationForBc " << methodDesc->getName() << endl;
     assert(0);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h Tue May 29 22:37:26 2007
@@ -243,8 +243,7 @@
     void          opndMaybeGlobal(CG_OpndHandle* opnd)            {}
     void          setCurrentPersistentId(PersistentInstructionId) {}
     void          clearCurrentPersistentId()                      {}
-    void          setCurrentHIRHandler(uint64)                    {} 
-    void          setCurrentHIRInstrID(uint64)                    {}
+    void          setCurrentHIRInstrID(uint32)                    {}
 
     //---------------------------------------------------------------------------//
     // Methods that are not going to be implemented

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp Tue May 29 22:37:26 2007
@@ -97,10 +97,10 @@
                         continue;
                     }
                 }
-                VectorHandler* bc2HIRMapHandler = new (mm) VectorHandler(bcOffset2HIRHandlerName, &md);
-                uint64 callInstId = (uint64)lastInst->getId();
-                key = (uint32)bc2HIRMapHandler->getVectorEntry(callInstId);
-                assert(key != ILLEGAL_VALUE);
+                void* bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, &md);
+                uint32 callInstId = lastInst->getId();
+                key = (uint32)getBCMappingEntry(bc2HIRMapHandler, callInstId);
+                assert(key != ILLEGAL_BC_MAPPING_VALUE);
                 assert(key != 0);
                 if (debug) {
                     Log::out() << "Use call instruction bcOffset = " << (int32)key << std::endl;

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=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp Tue May 29 22:37:26 2007
@@ -239,36 +239,16 @@
 }
 
 bool compileMethod(CompilationContext* cc) {
-    
     if(Jitrino::flags.skip) {
         return false;
     }
 
-    //
-    // IRManager contains the method's IR for the global optimizer.
-    // It contains a memory manager that is live during optimization
-    //
-    
     MethodDesc* methDesc = cc->getVMCompilationInterface()->getMethodToCompile();
     MemoryManager& ir_mmgr = cc->getCompilationLevelMemoryManager();
-    
     initHandleMap(ir_mmgr, methDesc);
 
-    // add bc <-> HIR code map handler
-    StlVector<uint64> *bc2HIRMap;
-    if (cc->getVMCompilationInterface()->isBCMapInfoRequired()) {
-        bc2HIRMap = new(ir_mmgr) StlVector<uint64>(ir_mmgr, methDesc->getByteCodeSize() 
-                * (ESTIMATED_HIR_SIZE_PER_BYTECODE) + 5, ILLEGAL_VALUE);
-        addContainerHandler(bc2HIRMap, bcOffset2HIRHandlerName, methDesc);
-    }
-
     runPipeline(cc);
     
-    // remove bc <-> HIR code map handler
-    if (cc->getVMCompilationInterface()->isBCMapInfoRequired()) {
-        removeContainerHandler(bcOffset2HIRHandlerName, methDesc);
-    }
-    
     bool success = !cc->isCompilationFailed();
     return success;
 }
@@ -357,12 +337,12 @@
 }
 
 bool 
-Jitrino::GetBcLocationForNative(MethodDesc* method, uint64 native_pc, uint16 *bc_pc) { 
+Jitrino::GetBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc) { 
     return runtimeInterface->getBcLocationForNative(method, native_pc, bc_pc);
 }
 
 bool
-Jitrino::GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, uint64 *native_pc) { 
+Jitrino::GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, POINTER_SIZE_INT *native_pc) { 
     return runtimeInterface->getNativeLocationForBc(method, bc_pc, native_pc);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.h Tue May 29 22:37:26 2007
@@ -59,8 +59,8 @@
     static bool  RecompiledMethodEvent(MethodDesc * recompiledMethodDesc, void * data);
     static MemoryManager& getGlobalMM() { return *global_mm; }
 
-    static bool GetBcLocationForNative(MethodDesc* method, uint64 native_pc, uint16 *bc_pc);
-    static bool GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, uint64 *native_pc);
+    static bool GetBcLocationForNative(MethodDesc* method, POINTER_SIZE_INT native_pc, uint16 *bc_pc);
+    static bool GetNativeLocationForBc(MethodDesc* method, uint16 bc_pc, POINTER_SIZE_INT *native_pc);
 
     static uint32 GetInlineDepth(InlineInfoPtr ptr, uint32 offset);
     static Method_Handle GetInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp Tue May 29 22:37:26 2007
@@ -2102,8 +2102,7 @@
             Log::out() << ::std::endl;
         }
         if (irmanager.getCompilationInterface().isBCMapInfoRequired()) {
-            //POINTER_SIZE_INT instAddr = (POINTER_SIZE_INT) inst;
-            uint64 instID = inst->getId();
+            uint32 instID = inst->getId();
             instructionCallback.setCurrentHIRInstrID(instID);
         }
         genInstCode(instructionCallback, inst, !sinkConstants);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp Tue May 29 22:37:26 2007
@@ -594,7 +594,7 @@
         // update the BCMap
         if(irManager->getCompilationInterface().isBCMapInfoRequired()) {
             MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
-            VectorHandler *bc2HIRmapHandler = new(inlineManager) VectorHandler(bcOffset2HIRHandlerName, meth);
+            void *bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
 
             // update the BCMap for each copied node
             NodeRenameTable::Iter nodeIter(nodeRenameTable);
@@ -606,9 +606,9 @@
                 Inst* newLast = (Inst*)newNode->getLastInst();
                 if (oldLast->asMethodCallInst() || oldLast->asCallInst()) {
                     assert(newLast->asMethodCallInst() || newLast->asCallInst());
-                    uint32 bcOffset = bc2HIRmapHandler->getVectorEntry(oldLast->getId());
-                    assert((bcOffset != 0) && (bcOffset != ILLEGAL_VALUE));
-                    bc2HIRmapHandler->setVectorEntry(newLast->getId(), bcOffset);
+                    uint16 bcOffset = getBCMappingEntry(bc2HIRmapHandler, oldLast->getId());
+                    assert((bcOffset != 0) && (bcOffset != ILLEGAL_BC_MAPPING_VALUE));
+                    setBCMappingEntry(bc2HIRmapHandler, newLast->getId(), bcOffset);
                 }
 
             }
@@ -1216,16 +1216,8 @@
     if (!node->isEmpty()) {
         out << "\\l|\\" << std::endl;
         Inst* first = (Inst*)node->getFirstInst();
-        VectorHandler* bc2HIRMapHandler = NULL;
         for (Inst* i = first->getNextInst(); i != NULL; i=i->getNextInst()) { // skip label inst
             i->print(out); 
-            if (bc2HIRMapHandler != NULL) {
-                uint64 bcOffset = 0;
-                //POINTER_SIZE_INT instAddr = (POINTER_SIZE_INT) i;
-                uint64 instID = i->getId();
-                bcOffset = bc2HIRMapHandler->getVectorEntry(instID);
-                if (bcOffset != ILLEGAL_VALUE) out<<" "<<"bcOff:"<< (uint16)bcOffset<<" ";
-            }
             out << "\\l\\" << std::endl;
         }
         out << "}";

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp Tue May 29 22:37:26 2007
@@ -285,8 +285,7 @@
 simplifier(NULL),
 tauMethodSafeOpnd(NULL),
 offset(0),
-bc2HIRmapHandler(NULL),
-lostBCMapOffsetHandler(NULL)
+bc2HIRmapHandler(NULL)
 {
     
 }
@@ -313,7 +312,7 @@
 
     if (irBuilderFlags.isBCMapinfoRequired) {
         MethodDesc* meth = irm->getCompilationInterface().getMethodToCompile();
-        bc2HIRmapHandler = new(irm->getMemoryManager()) VectorHandler(bcOffset2HIRHandlerName, meth);
+        bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
     }
 }
 
@@ -326,16 +325,12 @@
 Inst* IRBuilder::appendInst(Inst* inst) {
     assert(currentLabel);
     if (irBuilderFlags.isBCMapinfoRequired) {
-        //POINTER_SIZE_INT instAddr = (POINTER_SIZE_INT) inst;
-        uint64 instID = inst->getId();
+        uint32 instID = inst->getId();
         if (irBuilderFlags.fullBcMap) {
-            bc2HIRmapHandler->setVectorEntry(instID, offset);
+            setBCMappingEntry(bc2HIRmapHandler, instID, (uint16)offset);
         } else if (inst->asMethodCallInst() || inst->asCallInst()) {
-            bc2HIRmapHandler->setVectorEntry(instID, offset);
+            setBCMappingEntry(bc2HIRmapHandler, instID, (uint16)offset);
         }
-//#ifdef _DEBUG
-//        lostBCMapOffsetHandler->setMapEntry((uint64) offset, 0x01);
-//#endif
     }
     currentLabel->getNode()->appendInst(inst);
     if(Log::isEnabled()) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h Tue May 29 22:37:26 2007
@@ -472,8 +472,7 @@
 
     // current bc offset
     uint32 offset;
-    VectorHandler* bc2HIRmapHandler;
-    MapHandler* lostBCMapOffsetHandler;
+    void* bc2HIRmapHandler;
 };
 
 } //namespace Jitrino 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp Tue May 29 22:37:26 2007
@@ -415,11 +415,11 @@
     MethodDesc* rootMethodDesc = regionIRM.getCompilationInterface().getMethodToCompile();
 
     // Get bytecode offset of the call
-    VectorHandler* bc2HIRMapHandler = new VectorHandler(bcOffset2HIRHandlerName, rootMethodDesc);
-    uint64 callInstId = (uint64)call->getId();
-    uint32 bcOffset = (uint32)bc2HIRMapHandler->getVectorEntry(callInstId);
+    void* bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, rootMethodDesc);
+    uint32 callInstId = call->getId();
+    uint16 bcOffset = getBCMappingEntry(bc2HIRMapHandler, callInstId);
     assert(bcOffset != 0);
-    assert(bcOffset != ILLEGAL_VALUE);
+    assert(bcOffset != ILLEGAL_BC_MAPPING_VALUE);
     Log::out() << "Call instruction bcOffset = " << (int32)bcOffset << std::endl;
 
     // Get profiled vtable value

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Tue May 29 22:37:26 2007
@@ -114,7 +114,7 @@
     if (compInterface.isBCMapInfoRequired()) {
         isBCmapRequired = true;
         MethodDesc* meth = compInterface.getMethodToCompile();
-        bc2HIRMapHandler = new VectorHandler(bcOffset2HIRHandlerName, meth);
+        bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
     } else {
         isBCmapRequired = false;
         bc2HIRMapHandler = NULL;
@@ -6328,11 +6328,11 @@
 void
 EscAnalyzer::setNewBCMap(Inst* new_i, Inst* old_i) {
     if (isBCmapRequired) {
-        uint64 bcOffset = ILLEGAL_VALUE;
-        uint64 instID = old_i->getId();
-        bcOffset = bc2HIRMapHandler->getVectorEntry(instID);
-        if (bcOffset != ILLEGAL_VALUE) {
-            bc2HIRMapHandler->setVectorEntry(new_i->getId(), bcOffset);
+        uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
+        uint32 instID = old_i->getId();
+        bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
+        if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+            setBCMappingEntry(bc2HIRMapHandler, new_i->getId(), bcOffset);
         }
     }
 }  // setNewBCMap(Inst* new_i, Inst* old_i)
@@ -6345,11 +6345,11 @@
 void
 EscAnalyzer::remBCMap(Inst* inst) {
     if (isBCmapRequired) {
-        uint64 bcOffset = ILLEGAL_VALUE;
-        uint64 instID = inst->getId();
-        bcOffset = bc2HIRMapHandler->getVectorEntry(instID);
-        if (bcOffset != ILLEGAL_VALUE) {
-            bc2HIRMapHandler->setVectorEntry(instID, ILLEGAL_VALUE);
+        uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
+        uint32 instID = inst->getId();
+        bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
+        if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+            setBCMappingEntry(bc2HIRMapHandler, instID, ILLEGAL_BC_MAPPING_VALUE);
         }
     }
 }  // remBCMap(Inst* inst)

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h Tue May 29 22:37:26 2007
@@ -1002,7 +1002,7 @@
 // BCMap support
     // Byte code map info
     bool isBCmapRequired;
-    VectorHandler* bc2HIRMapHandler;
+    void* bc2HIRMapHandler;
 /**
  * Sets bcmap offset in bc2HIRMapHandler.
  * @param new_i - instruction to set offset,

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Tue May 29 22:37:26 2007
@@ -82,7 +82,7 @@
     if (irm.getCompilationInterface().isBCMapInfoRequired()) {
         isBCmapRequired = true;
         MethodDesc* meth = irm.getCompilationInterface().getMethodToCompile();
-        bc2HIRMapHandler = new VectorHandler(bcOffset2HIRHandlerName, meth);
+        bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
     } else {
         isBCmapRequired = false;
         bc2HIRMapHandler = NULL;
@@ -842,16 +842,16 @@
                 // InlineInfo order is parent-first 
                 //     (ii might be non-empty when translation-level inlining is on)
                 //
-                uint32 bcOff = ILLEGAL_VALUE;
+                uint16 bcOff = ILLEGAL_BC_MAPPING_VALUE;
 
                 if (isBCmapRequired) {
-                    uint64 callIinstID = (uint64) callInst->getId();
-                    uint64 iinstID = (uint64) i->getId();
-                    bcOff = (uint32)bc2HIRMapHandler->getVectorEntry(iinstID);
+                    uint32 callIinstID = callInst->getId();
+                    uint32 iinstID = i->getId();
+                    bcOff = getBCMappingEntry(bc2HIRMapHandler, iinstID);
                     if (iinstID != callIinstID) {
-                        uint32 inlinedBcOff = ILLEGAL_VALUE;
-                        inlinedBcOff = (uint32)bc2HIRMapHandler->getVectorEntry(callIinstID);
-                        bc2HIRMapHandler->setVectorEntry(iinstID, inlinedBcOff);
+                        uint16 inlinedBcOff = ILLEGAL_BC_MAPPING_VALUE;
+                        inlinedBcOff = getBCMappingEntry(bc2HIRMapHandler, callIinstID);
+                        setBCMappingEntry(bc2HIRMapHandler, iinstID, inlinedBcOff);
                     }
                 }
 
@@ -966,14 +966,6 @@
     // Augment inline tree
     InlineNode *inlineNode = new (_tmpMM) InlineNode(*inlinedIRM, call, call->getNode());
     
-    // Call a translator 
-    if (isBCmapRequired) {
-        uint32 methodByteSize = methodDesc->getByteCodeSize();
-        size_t incSize = methodByteSize * ESTIMATED_HIR_SIZE_PER_BYTECODE;
-        MethodDesc* parentMethod = _toplevelIRM.getCompilationInterface().getMethodToCompile();
-        incVectorHandlerSize(bcOffset2HIRHandlerName, parentMethod, incSize);
-    }
-
     inlineCC.setHIRManager(inlinedIRM);
     
     //prepare type info

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.h Tue May 29 22:37:26 2007
@@ -189,7 +189,7 @@
 
     bool _usesOptimisticBalancedSync;
     bool isBCmapRequired;
-    VectorHandler* bc2HIRMapHandler;
+    void* bc2HIRMapHandler;
     TranslatorAction* translatorAction;
 };
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h Tue May 29 22:37:26 2007
@@ -208,38 +208,6 @@
     OptimizerFlags&          _optFlags;
 };
 
-/** MapHandler is auxilary class to eliminate direct usage of map hanlers between HLO and codegenerator */
-
-class MapHandler {
-public:
-    MapHandler(const char* handlerName, MethodDesc* meth) {
-        handler = getContainerHandler(handlerName, meth);
-        }
-    uint64 getMapEntry(uint64 key) {
-        return ::Jitrino::getMapEntry(handler, key);
-    }
-    void setMapEntry(uint64 key, uint64 value) {
-        ::Jitrino::setMapEntry(handler, key, value);
-    }
-private:
-    void* handler;
-};
-
-class VectorHandler {
-public:
-    VectorHandler(const char* handlerName, MethodDesc* meth) {
-        handler = getContainerHandler(handlerName, meth);
-    }
-    uint64 getVectorEntry(uint64 key) {
-        return ::Jitrino::getVectorEntry(handler, key);
-    }
-    void setVectorEntry(uint64 key, uint64 value) {
-        ::Jitrino::setVectorEntry(handler, key, value);
-    }
-private:
-    void* handler;
-};
-
 } //namespace Jitrino 
 
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp Tue May 29 22:37:26 2007
@@ -50,7 +50,7 @@
     if (compInterface.isBCMapInfoRequired()) {
         isBCmapRequired = true;
         MethodDesc* meth = compInterface.getMethodToCompile();
-        bc2HIRMapHandler = new VectorHandler(bcOffset2HIRHandlerName, meth);
+        bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
     } else {
         isBCmapRequired = false;
         bc2HIRMapHandler = NULL;
@@ -540,12 +540,12 @@
                 tinst->unlink();
 
                 if (isBCmapRequired) {
-                    uint64 bcOffset = ILLEGAL_VALUE;
-                    uint64 instID = iinst->getId();
-                    bcOffset = bc2HIRMapHandler->getVectorEntry(instID);
-                    if (bcOffset != ILLEGAL_VALUE) {
-                        bc2HIRMapHandler->setVectorEntry(mptinst->getId(), bcOffset);
-                        bc2HIRMapHandler->setVectorEntry(tlinst->getId(), bcOffset);
+                    uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
+                    uint32 instID = iinst->getId();
+                    bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
+                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+                        setBCMappingEntry(bc2HIRMapHandler, mptinst->getId(), bcOffset);
+                        setBCMappingEntry(bc2HIRMapHandler, tlinst->getId(), bcOffset);
                     }
                 }
             }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h Tue May 29 22:37:26 2007
@@ -176,7 +176,7 @@
     static int level;
     // Byte code map info
     bool isBCmapRequired;
-    VectorHandler* bc2HIRMapHandler;
+    void* bc2HIRMapHandler;
 };
 
 } // namespace Jitrino

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp Tue May 29 22:37:26 2007
@@ -82,6 +82,15 @@
         OptimizerFlags& flags = myAction->optimizerFlags;
         IRManager* irm = new (mm) IRManager(mm, *cc->getVMCompilationInterface(), flags);
         cc->setHIRManager(irm);
+
+        MethodDesc* methDesc = cc->getVMCompilationInterface()->getMethodToCompile();
+
+        // add bc <-> HIR code map handler
+        if (cc->getVMCompilationInterface()->isBCMapInfoRequired()) {
+            StlVector<uint16> *bc2HIRMap = new(mm) StlVector<uint16>(mm, methDesc->getByteCodeSize() 
+                * (ESTIMATED_HIR_SIZE_PER_BYTECODE) + 5, ILLEGAL_BC_MAPPING_VALUE);
+            addContainerHandler(bc2HIRMap, bcOffset2HIRHandlerName, methDesc);
+        }
     }
 
 };

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp Tue May 29 22:37:26 2007
@@ -4204,7 +4204,7 @@
                                             numArgs, args, 
                                             methodDesc);
     if ( inlineBuilder ) {
-        uint32 callOffset = ILLEGAL_VALUE;
+        uint32 callOffset = ILLEGAL_BC_MAPPING_VALUE;
         inlineBuilder->buildInlineInfoForInst(inst, callOffset, methodDesc);
     }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.cpp Tue May 29 22:37:26 2007
@@ -25,262 +25,68 @@
 #include <string>
 #include <functional>
 #include "Type.h"
-//#include "Timer.h"
 
 #define QUAL_NAME_LENGTH 1024
 
 namespace Jitrino {
 
-typedef ::std::pair<POINTER_SIZE_INT, POINTER_SIZE_INT> KeyPair;
-
-StlHashMap< uint64, void* > * handlMap = NULL;
-
 const char* bcOffset2LIRHandlerName = "bcOffset2InstructionLIRHandler";
 const char* bcOffset2HIRHandlerName = "bcOffset2InstructionHIRHandler";
 const char* lostBCOffsetHandlerName = "bcOffsetHandler";
 
-MemoryManager* handleMapMM = NULL;
-
-
-//static Timer* mapTimer = NULL;
-//static Timer* mapHandlerTimer = NULL;
 
 void initHandleMap(MemoryManager& mm, MethodDesc* meth) {
     StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
     handleMap = new(mm) StlHashMap< POINTER_SIZE_INT, void* >(mm);
     assert(meth->getHandleMap() == NULL);
     meth->setHandleMap(handleMap);
-    //handleMapMM = &mm;
 }
 //static Timer* addMapHandlerTimer = NULL;
 void addContainerHandler(void* mapHandler, const char* name, MethodDesc* meth) {
-    //POINTER_SIZE_INT methID = (POINTER_SIZE_INT)meth;
-    //ltoa((long)methID, ptrToMethStr, 8);
-    //::std::string qualHandlerName(name);
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getParentType()->getName();
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getName(); 
-    //qualHandlerName += meth->getSignatureString();
-    //const char* qualName = qualHandlerName.c_str();
-
-    //char qualName[QUAL_NAME_LENGTH] = "";
-    //strcpy(qualName, name);
-    //strcat(qualName, meth->getParentType()->getName());
-    //strcat(qualName, meth->getName());
-    //strcat(qualName, meth->getSignatureString());
-
     StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
     handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
     POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
 
     assert(handleMap->find(keyVal) == handleMap->end());
     (*handleMap)[keyVal] =  mapHandler;
 }
-//static Timer* remMapHandlerTimer = NULL;
-void removeContainerHandler(const char* name, MethodDesc* meth) {  
-    //PhaseTimer tm(remMapHandlerTimer, "remMapHandler");
-    //::std::string qualHandlerName(name);
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getParentType()->getName();
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getName(); 
-    //qualHandlerName += meth->getSignatureString();
-    //const char* qualName = qualHandlerName.c_str();
-
-    //char qualName[QUAL_NAME_LENGTH] = "";
-    //strcpy(qualName, name);
-    //strcat(qualName, meth->getParentType()->getName());
-    //strcat(qualName, meth->getName());
-    //strcat(qualName, meth->getSignatureString());
-    //assert(handlMap->find(qualName) != handlMap->end());
-
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
-    POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
 
-    assert(handleMap->find(keyVal) != handleMap->end());
-    handleMap->erase(keyVal); 
-}
 //static Timer* getMapHandlerTimer = NULL;
 void* getContainerHandler(const char* name, MethodDesc* meth) {  
-    //PhaseTimer tm(getMapHandlerTimer, "getMapHandler");
-    //::std::string qualHandlerName(name);
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getParentType()->getName();
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getName(); 
-    //qualHandlerName += meth->getSignatureString();
-    //const char* qualName = qualHandlerName.c_str();
-
-    //char qualName[QUAL_NAME_LENGTH] = "";
-    //strcpy(qualName, name);
-    //strcat(qualName, meth->getParentType()->getName());
-    //strcat(qualName, meth->getName());
-    //strcat(qualName, meth->getSignatureString());
-    //assert(handlMap->find(qualName) != handlMap->end());
-    
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
-    POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
-
-    assert(handleMap->find(keyVal) != handleMap->end());
-    return handleMap->find(keyVal)->second; 
-}
-
-bool isContainerHandlerExist(const char* name, MethodDesc* meth) {  
-    //PhaseTimer tm(mapHandlerTimer, "MapHandler");
-    //::std::string qualHandlerName(name);
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getParentType()->getName();
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getName(); 
-    //qualHandlerName += meth->getSignatureString();
-    //const char* qualName = qualHandlerName.c_str();
-
-    //char qualName[QUAL_NAME_LENGTH] = "";
-    //strcpy(qualName, name);
-    //strcat(qualName, meth->getParentType()->getName());
-    //strcat(qualName, meth->getName());
-    //strcat(qualName, meth->getSignatureString());
-
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
-    POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
-
-    return (handleMap->find(keyVal) != handleMap->end());
-}
-uint64 getMapHandlerSize(const char* name, MethodDesc* meth) {  
-    //PhaseTimer tm(mapHandlerTimer, "MapHandler");
-    //::std::string qualHandlerName(name);
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getParentType()->getName();
-    //qualHandlerName += "::";
-    //qualHandlerName += meth->getName(); 
-    //qualHandlerName += meth->getSignatureString();
-    //const char* qualName = qualHandlerName.c_str();
-
-    //char qualName[QUAL_NAME_LENGTH] = "";
-    //strcpy(qualName, name);
-    //strcat(qualName, meth->getParentType()->getName());
-    //strcat(qualName, meth->getName());
-    //strcat(qualName, meth->getSignatureString());
-
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
-    POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
-
-    assert(handleMap->find(keyVal) != handleMap->end());
-    StlHashMap<uint64, uint64>* mapHandler = (StlHashMap<uint64, uint64>*) handleMap->find(keyVal)->second;
-
-    return (uint64)mapHandler->size();
-}
-void incVectorHandlerSize(const char* name, MethodDesc* meth, size_t incSize) {
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
-    POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
 
-    assert(handleMap->find(keyVal) != handleMap->end());
-    StlVector<uint64>* vector = (StlVector<uint64>*)handleMap->find(keyVal)->second;  
-    vector->resize(vector->size() + incSize, ILLEGAL_VALUE);
-}
-uint64 getVectorSize(const char* name, MethodDesc* meth) {
     StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
     handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
     POINTER_SIZE_INT keyVal = (POINTER_SIZE_INT) name;
-    //KeyPair keyVal((POINTER_SIZE_INT)name, (POINTER_SIZE_INT) meth);
-
     assert(handleMap->find(keyVal) != handleMap->end());
-    StlVector<uint64>* vector = (StlVector<uint64>*)handleMap->find(keyVal)->second;  
-    return (uint64)vector->size();
+    return handleMap->find(keyVal)->second; 
 }
-void enumerateHandlMap(MethodDesc* meth) {  
-    StlHashMap< POINTER_SIZE_INT, void* >* handleMap;
-    handleMap = (StlHashMap< POINTER_SIZE_INT, void* >*) meth->getHandleMap();
 
-    StlHashMap< POINTER_SIZE_INT, void* >::const_iterator citer;
 
-    ::std::cout << "=================" << ::std::endl;
-    ::std::cout<<"Method: "<<meth->getName()<<::std::endl;
 
-    for (citer = handleMap->begin(); citer != handleMap->end(); citer++) {
-        ::std::cout << (const char*)citer->first << " " << citer->second << ::std::endl;
-    }
-    ::std::cout << "=================" << ::std::endl;
-}
 /************************************************************************/
-//static Timer* getEntryTimer = NULL;
-uint64 getMapEntry(void* mapHandler, uint64 key) { 
-    //PhaseTimer tm(getEntryTimer, "getEntry");
-    assert(mapHandler);
-    StlHashMap<uint64, uint64>* theMap = (StlHashMap<uint64, uint64>*) mapHandler;
-    if (theMap->find(key) == theMap->end()) return ILLEGAL_VALUE;
-    return theMap->find(key)->second;
-}
-//static Timer* setEntryTimer = NULL;
-void setMapEntry(void* mapHandler, uint64 key, uint64 value) {
-    //PhaseTimer tm(setEntryTimer, "setEntry");
-    assert(mapHandler);
-    //PhaseTimer tm(mapTimer, "setEntry");
-    StlHashMap<uint64, uint64>* theMap = (StlHashMap<uint64, uint64>*) mapHandler;
-    (*theMap)[key] =  value;
-}
-void removeMapEntry(void* mapHandler, uint64 key) {
-    //PhaseTimer tm(mapTimer, "Entry");
-    assert(mapHandler);
-    StlHashMap<uint64, uint64>* theMap = (StlHashMap<uint64, uint64>*) mapHandler;
-    theMap->erase(key);
-}
-/************************************************************************/
-uint64 getVectorEntry(void* vectorHandler, uint64 key) { 
-    //PhaseTimer tm(getEntryTimer, "getEntry");
+size_t getNumBCMapEntries(void* vectorHandler) { 
     assert(vectorHandler);
-    StlVector<uint64>* theVector = (StlVector<uint64>*) vectorHandler;
-    if (key >= (uint64) theVector->size()) return ILLEGAL_VALUE;
-    return (*theVector)[(size_t)key];
+    StlVector<uint16>* theVector = (StlVector<uint16>*) vectorHandler;
+    return theVector->size();
 }
-//static Timer* setEntryTimer = NULL;
-void setVectorEntry(void* vectorHandler, uint64 key, uint64 value) {
-    //PhaseTimer tm(setEntryTimer, "setEntry");
+
+uint16 getBCMappingEntry(void* vectorHandler, uint32 key) { 
     assert(vectorHandler);
-    StlVector<uint64>* theVector = (StlVector<uint64>*) vectorHandler;
-    assert((size_t)key <  theVector->size()); // increase ESTIMATED_LIR_SIZE_PER_HIR 
-                                                              // or ESTIMATED_HIR_SIZE_PER_BYTECODE 
-    (*theVector)[(size_t)key] =  value;
+    StlVector<uint16>* theVector = (StlVector<uint16>*) vectorHandler;
+    if (key >= theVector->size()) return ILLEGAL_BC_MAPPING_VALUE;
+    return (*theVector)[key];
 }
-void removeVectorEntry(void* vectorHandler, uint64 key) {
-    //PhaseTimer tm(mapTimer, "Entry");
+
+void setBCMappingEntry(void* vectorHandler, uint32 key, uint16 value) {
     assert(vectorHandler);
-    StlVector<uint64>* theVector = (StlVector<uint64>*) vectorHandler;
-    (*theVector)[(size_t)key] = (uint64)ILLEGAL_VALUE;
+    StlVector<uint16>* theVector = (StlVector<uint16>*) vectorHandler;
+    if (key >=  theVector->size()) {
+        assert(key<1000*1000);//we do not have methods with 1M insts..
+        size_t newSize = (size_t)(key * 1.5);
+        theVector->resize(newSize, ILLEGAL_BC_MAPPING_VALUE);
+    }
+    assert(key<theVector->size());
+    (*theVector)[key] =  value;
 }
-
-/************************************************************************/
-//void addMapHandler(void* mapHandler, const char* name) {
-//    assert(handlMap->find(name) == handlMap->end());
-//    (*handlMap)[name] =  mapHandler;
-//}
-//
-//void removeMapHandler(const char* name) {  
-//    assert(handlMap->find(name) != handlMap->end());
-//    handlMap->erase(name); 
-//}
-//
-//void* getMapHandler(const char* name) { 
-//    assert(handlMap->find(name) != handlMap->end());
-//    return handlMap->find(name)->second; 
-//}
-//bool isHandlerExist(const char* name) {
-//    return (handlMap->find(name) != handlMap->end());
-//}
-
-/************************************************************************/
-
 
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/CGSupport.h Tue May 29 22:37:26 2007
@@ -22,8 +22,7 @@
 #include "MemoryManager.h"
 #include "VMInterface.h"
 
-//FIXME 64-bit usage
-#define ILLEGAL_VALUE 0xFFFFFFFF
+#define ILLEGAL_BC_MAPPING_VALUE 0xFFFF
 
 #define ESTIMATED_LIR_SIZE_PER_HIR 0x3
 #define ESTIMATED_HIR_SIZE_PER_BYTECODE 0x8
@@ -32,38 +31,15 @@
 
 extern const char* bcOffset2LIRHandlerName;
 extern const char* bcOffset2HIRHandlerName;
-extern const char* lostBCOffsetHandlerName;
 
 void initHandleMap(MemoryManager& mm, MethodDesc* meth);
-void enumerateHandlMap(MethodDesc* meth);
-
-//  Old interface to work with MapHandlers is deprecated since
-//  it inefficient due to problems with reenterability on resolution
-
-//void addMapHandler(void *mapHandler, const char* name);
-//void removeMapHandler(const char* name);
-//void* getMapHandler(const char* name);
-//uint64 getHandlerSize(const char* name);
-//bool isHandlerExist(const char* name);
 
 void addContainerHandler(void* contHandler, const char* name, MethodDesc* meth);
-void removeContainerHandler(const char* name, MethodDesc* meth);
 void* getContainerHandler(const char* name, MethodDesc* meth);
-bool isContainerHandlerExist(const char* name, MethodDesc* meth);
-
-void incVectorHandlerSize(const char* name, MethodDesc* meth, size_t incSize);
-uint64 getVectorSize(const char* name, MethodDesc* meth);
-
-uint64 getMapHandlerSize(const char* name, MethodDesc* meth);
-
-uint64 getMapEntry(void* mapHandler, uint64 key);
-void setMapEntry(void* mapHandler, uint64 key, uint64 value);
-void removeMapEntry(void* mapHandler, uint64 key);
-
-uint64 getVectorEntry(void* vectorHandler, uint64 key);
-void setVectorEntry(void* vectorHandler, uint64 key, uint64 value);
-void removeVectorEntry(void* vectorHandler, uint64 key);
 
+size_t getNumBCMapEntries(void* vectorHandler);
+uint16 getBCMappingEntry(void* mappingHandler, uint32 key);
+void setBCMappingEntry(void* mappingHandler, uint32 key, uint16 bcOffset);
 }
 
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/MemoryEstimates.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/MemoryEstimates.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/MemoryEstimates.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/MemoryEstimates.h Tue May 29 22:37:26 2007
@@ -26,7 +26,6 @@
 
 namespace Jitrino {
 
-#define ESTIMATED_MEMORY_PER_BYTECODE 128
 #define ESTIMATED_TRANSLATOR_MEMORY_PER_BYTECODE 128
 
 } //namespace Jitrino 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h Tue May 29 22:37:26 2007
@@ -362,12 +362,14 @@
     // The two types are pointer types, could their values be the same (i.e. point to the same locations)?
     static bool mayAliasPtr(Type*, Type*);
 
-    const uint32 id;
     uint32 getId() { return id; }
+
 protected:
     virtual bool    _isFinalClass()    {return false;}
     static uint32 nextTypeId;
- 
+
+private:
+    const uint32 id;
 };
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp?view=diff&rev=542754&r1=542753&r2=542754
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp Tue May 29 22:37:26 2007
@@ -1,4 +1,4 @@
-/*
+    /*
  *  Licensed to the Apache Software Foundation (ASF) under one or more
  *  contributor license agreements.  See the NOTICE file distributed with
  *  this work for additional information regarding copyright ownership.
@@ -235,9 +235,7 @@
                                Method_Handle method_handle,
                                OpenMethodExecutionParams compilation_params)
 {
-    MemoryManager memManager(method_get_byte_code_size(method_handle)*
-                             ESTIMATED_MEMORY_PER_BYTECODE,
-                             "JIT_compile_method.memManager");
+    MemoryManager memManager(method_get_byte_code_size(method_handle), "JIT_compile_method.memManager");
     JIT_Handle jitHandle = method_get_JIT_id(compilation);
     JITInstanceContext* jitContext = Jitrino::getJITInstanceContext(jitHandle);
     assert(jitContext!= NULL);
@@ -573,7 +571,7 @@
 #endif
 
     MethodDesc methDesc(method, jit);
-    uint64* ncAddr = (uint64*) native_pc;
+    POINTER_SIZE_INT* ncAddr = (POINTER_SIZE_INT*) native_pc;
 
     if (Jitrino::GetNativeLocationForBc(&methDesc, bc_pc, ncAddr)) {
         return EXE_ERROR_NONE;
@@ -595,7 +593,7 @@
 
     MethodDesc methDesc(method, jit);
     POINTER_SIZE_INT ncAddr = (POINTER_SIZE_INT) native_pc;
-    if (Jitrino::GetBcLocationForNative(&methDesc, (uint64)ncAddr, bc_pc)) {
+    if (Jitrino::GetBcLocationForNative(&methDesc, ncAddr, bc_pc)) {
         return EXE_ERROR_NONE;
     }
     return EXE_ERROR_INVALID_LOCATION;