harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r556007 [1/3] - in /harmony/enhanced/drlvm/trunk/vm: jitrino/src/codegenerator/ jitrino/src/codegenerator/ia32/ jitrino/src/codegenerator/ipf/ jitrino/src/codegenerator/ipf/include/ jitrino/src/dynopt/ jitrino/src/main/ jitrino/src/optimize...
Date Fri, 13 Jul 2007 14:19:39 GMT
Author: mfursov
Date: Fri Jul 13 07:19:35 2007
New Revision: 556007

URL: http://svn.apache.org/viewvc?view=rev&rev=556007
Log:
Fix for HARMONY-2114.
Bytecode mapping and inline-info support in Jitrino.OPT was refactored.


Removed:
    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/InlineInfo.h
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/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/Ia32GCMap.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.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/optimizer/CodeGenerator.cpp
    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/IRBuilderFlags.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opcode.cpp
    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/helper_inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    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/optimizer/simplifier.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaFlowGraphBuilder.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/CodeGenIntfc.h Fri Jul 13 07:19:35 2007
@@ -34,7 +34,6 @@
 
 namespace Jitrino
 {
-class InlineInfo;
 
     // struct ::JitFrameContext;    
     class CG_OpndHandle {
@@ -262,21 +261,21 @@
     virtual CG_OpndHandle*  tau_ldIntfTableAddr(Type *dstType, CG_OpndHandle* base, 
                                                 NamedType* vtableType) = 0;
     virtual CG_OpndHandle*  call(uint32 numArgs, CG_OpndHandle** args, Type* retType,
-                                 MethodDesc *desc, InlineInfo* ii = NULL) = 0;
+                                 MethodDesc *desc) = 0;
     virtual CG_OpndHandle*  arraycopyReverse(uint32 numArgs, CG_OpndHandle** args) = 0;
     virtual CG_OpndHandle*  arraycopy(uint32 numArgs, CG_OpndHandle** args) = 0;
     virtual CG_OpndHandle*  tau_call(uint32 numArgs, CG_OpndHandle** args, Type* retType,
                                      MethodDesc *desc,
                                      CG_OpndHandle *tauNullChecked,
-                                     CG_OpndHandle *tauTypesChecked, InlineInfo* ii = NULL) = 0;
+                                     CG_OpndHandle *tauTypesChecked) = 0;
     // for callvirt this reference is in args[0]
     virtual CG_OpndHandle*  tau_callvirt(uint32 numArgs, CG_OpndHandle** args, Type* retType,
                                          MethodDesc *desc, CG_OpndHandle* tauNullChecked,
-                                         CG_OpndHandle* tauTypesChecked, InlineInfo* ii = NULL) = 0;
+                                         CG_OpndHandle* tauTypesChecked) = 0;
     virtual CG_OpndHandle*  tau_calli(uint32 numArgs,CG_OpndHandle** args, Type* retType,
                                       CG_OpndHandle* methodPtr, 
                                       CG_OpndHandle* tauNullChecked,
-                                      CG_OpndHandle* tauTypesChecked, InlineInfo* ii = NULL) = 0;
+                                      CG_OpndHandle* tauTypesChecked) = 0;
     virtual CG_OpndHandle*  tau_callintr(uint32 numArgs, CG_OpndHandle** args, Type* retType,
                                          IntrinsicCallOp::Id callId,
                                          CG_OpndHandle* tauNullChecked,
@@ -284,7 +283,7 @@
     virtual CG_OpndHandle*  callhelper(uint32 numArgs, CG_OpndHandle** args, Type* retType,
                                        JitHelperCallOp::Id callId) = 0;
     virtual CG_OpndHandle*  callvmhelper(uint32 numArgs, CG_OpndHandle** args, Type* retType,
-                                       CompilationInterface::RuntimeHelperId callId, InlineInfo* ii = NULL) = 0;
+                                       CompilationInterface::RuntimeHelperId callId) = 0;
 
     virtual CG_OpndHandle*  ldc_i4(int32 val) = 0;
     virtual CG_OpndHandle*  ldc_i8(int64 val) = 0;
@@ -478,8 +477,9 @@
     // Clear the current persistent instruction id.  
     // 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(uint32 HIRInstrID) = 0; 
+    // Set current HIR instruction bytecode offset
+    virtual void   setCurrentHIRInstBCOffset(uint16 val) = 0; 
+    virtual uint16 getCurrentHIRInstBCOffset() const = 0; 
 private:
 };
 
@@ -517,7 +517,7 @@
     public:
         enum BlockKind {Prolog, InnerBlock, Epilog};
         virtual ~Callback() {}
-        virtual uint32  genDispatchNode(uint32 numInEdges,uint32 numOutEdges,double cnt) = 0;
+        virtual uint32  genDispatchNode(uint32 numInEdges,uint32 numOutEdges, const StlVector<MethodDesc*>& inlineEndMarkers, double cnt) = 0;
         virtual uint32  genBlock(uint32 numInEdges,uint32 numOutEdges, BlockKind blockKind,
                                  BlockCodeSelector&, double cnt) = 0;
         virtual uint32  genUnwindNode(uint32 numInEdges, uint32 numOutEdges,double cnt) = 0;
@@ -596,38 +596,47 @@
 
 };
 
+/* serialized inline_info layout
+    nativeOffset1 -> offset to InlineInfoMap::Entry in the image with max inline depth   (32bit + 32bit)
+    nativeOffset2 -> offset to InlineInfoMap::Entry in the image with max inline depth
+    nativeOffset3 -> offset to InlineInfoMap::Entry in the image with max inline depth
+    ...
+    0 -> 0
+    InlineInfoMap::Entry1
+    InlineInfoMap::Entry2
+    ...
+*/
+
 class InlineInfoMap {
-    class OffsetPair {
+public:
+    //Inline info for a single call site
+    class Entry {
     public:
-        OffsetPair() : offset(0), inline_info(NULL) {}
-        OffsetPair(uint32 off, InlineInfo* ii) : offset(off), inline_info(ii) {}
-        uint32 offset;
-        InlineInfo* inline_info;
-    };
-    typedef StlList<OffsetPair> InlineInfoList;
-public:
-    InlineInfoMap(MemoryManager& mm) 
-        : list(mm), memManager(mm)
-    {}
-    void registerOffset(uint32 offset, InlineInfo* ii);
-    bool isEmpty() const;
-    uint32 computeSize() const;
+        Entry(Entry* parent, uint16 _bcOffset, Method_Handle _method) 
+            : parentEntry(parent), bcOffset(_bcOffset), method(_method){}
+        
+        Entry* parentEntry;
+        uint16  bcOffset;
+        Method_Handle method;
+
+        uint32 getInlineDepth() const { 
+            return (parentEntry == 0) ? 0 : 1 + parentEntry->getInlineDepth(); 
+        }
+    };
+
+    InlineInfoMap(MemoryManager& mm) : memManager(mm), entries(mm), entryByOffset(mm){}
+    Entry* newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset);
+    void registerEntry(Entry* entry, uint32 nativeOff);
+    bool isEmpty() const { return entries.empty();}
+    uint32 getImageSize() const;
     void write(InlineInfoPtr output);
-    static uint32 get_inline_depth(InlineInfoPtr ptr, uint32 offset);
-    static Method_Handle get_inlined_method(InlineInfoPtr ptr, uint32 offset, 
-            uint32 inline_depth);
-    static uint16 get_inlined_bc(InlineInfoPtr ptr, uint32 offset, 
-            uint32 inline_depth);
+
+    static const Entry* getEntryWithMaxDepth(InlineInfoPtr ptr, uint32 nativeOffs);
+    static const Entry* getEntry(InlineInfoPtr ptr, uint32 nativeOffs, uint32 inlineDepth);
 private:
-    static POINTER_SIZE_INT ptr_to_uint64(void *ptr);
-    static Method_Handle uint64_to_mh(POINTER_SIZE_INT value);
-    // 
-    // returns pointer to serialized data corresponding to offset:
-    //   depth mh[depth]
-    //
-    static POINTER_SIZE_INT* find_offset(InlineInfoPtr ptr, uint32 offset);
-    InlineInfoList list;
     MemoryManager& memManager;
+    StlVector<Entry*> entries;
+    StlMap<uint32, Entry*> entryByOffset;
 };
 
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp Fri Jul 13 07:19:35 2007
@@ -225,6 +225,11 @@
                 ControlFlowGraph* bbpCFG = bbp.createBBPSubCFG(*irManager, tlsBaseReg);
             
                 // Inlining bbpCFG at edge
+                if (fg->getUnwindNode()==NULL) {//inlined cfg has dispatch flow -> add unwind to parent if needed
+                    Node* unwind = fg->createDispatchNode();
+                    fg->addEdge(unwind, fg->getExitNode());
+                    fg->setUnwindNode(unwind);
+                }
                 fg->spliceFlowGraphInline(edge, *bbpCFG);
                 bbp.setBBPSubCFGController(originalTargetId,sourceDispatchId,edge->getTargetNode());
             }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.cpp Fri Jul 13 07:19:35 2007
@@ -229,23 +229,37 @@
     return m_opndFloatZero;
 }
 
-
-
-bool InstUtils::isPseudoInst(const Inst* inst)
-{
-    return inst->hasKind(Inst::Kind_PseudoInst);
+//All CALL insts except some special helpers that never cause stacktrace printing
+bool InstUtils::instMustHaveBCMapping(Inst* inst) {
+    if (!inst->hasKind(Inst::Kind_CallInst)) {
+        return false;
+    }
+    CallInst* callInst = (CallInst*)inst;
+    Opnd * targetOpnd=callInst->getOpnd(callInst->getTargetOpndIndex());
+    Opnd::RuntimeInfo * ri=targetOpnd->getRuntimeInfo();
+    if(!ri) {
+        return true;
+    } else if (ri->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress) { 
+        return false;
+    } else if (ri->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress) { 
+        CompilationInterface::RuntimeHelperId helperId = (CompilationInterface::RuntimeHelperId)(POINTER_SIZE_INT)ri->getValue(0);
+        switch (helperId) {
+            case CompilationInterface::Helper_GetTLSBase:
+            case CompilationInterface::Helper_EnableThreadSuspension:
+                return false;
+            default:
+                break;
+        }
+    }
+    return true;
 }
 
-void InstUtils::removeInst(Inst* toBeRemoved)
-{
-    toBeRemoved->unlink();
-}
 
 void InstUtils::replaceInst(Inst* toBeReplaced, Inst* brandNewInst)
 {
     BasicBlock* bb = toBeReplaced->getBasicBlock();
     bb->appendInst(brandNewInst, toBeReplaced);
-    removeInst(toBeReplaced);
+    toBeReplaced->unlink();
 }
 
 void InstUtils::replaceOpnd(Inst* inst, unsigned index, Opnd* newOpnd)
@@ -365,7 +379,7 @@
 {
     ControlFlowGraph* mainCFG = m_irManager->getFlowGraph();
     mainCFG->spliceFlowGraphInline(inst, *m_subCFG);
-    InstUtils::removeInst(inst);
+    inst->unlink();
     if (purgeEmptyNodes) {
         mainCFG->purgeEmptyNodes(true, false);
     }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CgUtils.h Fri Jul 13 07:19:35 2007
@@ -196,10 +196,9 @@
 
 class InstUtils : virtual protected IRManagerHolder {
 public:
-    static bool isPseudoInst(const Inst*);
-    static void removeInst(Inst* toBeRemoved);
     static void replaceInst(Inst* old, Inst* brandNewInst);
     static void replaceOpnd(Inst* inst, unsigned index, Opnd* newOpnd);
+    static bool instMustHaveBCMapping(Inst* inst);
 };
 
 class SubCfgBuilderUtils : virtual protected IRManagerHolder {

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Fri Jul 13 07:19:35 2007
@@ -20,7 +20,6 @@
  */
 
 #include "Ia32IRManager.h"
-#include "CGSupport.h"
 #include "Log.h"
 #include "Ia32RuntimeInterface.h"
 #include "Ia32Printer.h"
@@ -28,7 +27,7 @@
 #include "Ia32GCMap.h"
 #include "Ia32BCMap.h"
 #include "EMInterface.h"
-#include "InlineInfo.h"
+#include "Ia32CgUtils.h"
 
 namespace Jitrino
 {
@@ -67,6 +66,9 @@
     void packCode();
     void postPass();
     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 orderNodesAndMarkInlinees(StlList<MethodMarkerPseudoInst*>& container, 
@@ -129,7 +131,7 @@
     MemoryManager                   memoryManager;
     StlVector<ExceptionHandlerInfo> exceptionHandlerInfos;
     ConstantAreaLayout              constantAreaLayout;
-    StlVector<int> traversalInfo;
+    StlVector<char> traversalInfo;
     StlMap<MethodMarkerPseudoInst*, CompiledMethodInfo* > methodLocationMap;
     StlMap<MethodMarkerPseudoInst*, MethodMarkerPseudoInst* > entryExitMap;
     StlMap<POINTER_SIZE_INT, unsigned> instSizeMap;
@@ -289,11 +291,6 @@
 //________________________________________________________________________________________
 void CodeEmitter::runImpl()
 {
-    if (irManager->getCompilationInterface().isBCMapInfoRequired()) {
-        MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
-        bc2LIRMapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
-    }
-
     irManager->setInfo(INLINE_INFO_KEY, new(irManager->getMemoryManager()) InlineInfoMap(irManager->getMemoryManager()));
     constantAreaLayout.doLayout(irManager);
     irManager->resolveRuntimeInfo();
@@ -301,37 +298,104 @@
     packCode();
     postPass();
     constantAreaLayout.finalizeSwitchTables();
+    traversalInfo.resize(irManager->getFlowGraph()->getMaxNodeId() + 1, 0);
     registerExceptionHandlers();
     registerInlineInfoOffsets();
     if (irManager->getCompilationInterface().isCompileLoadEventRequired()) {
         reportCompiledInlinees();
     }
 }
-//________________________________________________________________________________________
-void CodeEmitter::registerInlineInfoOffsets() 
-{
-    InlineInfoMap * inlineMap = (InlineInfoMap *)irManager->getInfo(INLINE_INFO_KEY);
-    const Nodes& nodes = irManager->getFlowGraph()->getNodes();
-    for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
-        Node* node = *it;
-        if (node->isBlockNode()){
-            for (Inst * inst=(Inst*)node->getFirstInst(); inst!=NULL; inst=inst->getNextInst()){
-                if(inst->getMnemonic() == Mnemonic_CALL) {
-                    CallInst* callinst = (CallInst*)inst;
-                    if ( callinst->getInlineInfo() ) {
-                        Log::out() << "callinstr, at offset=" << (POINTER_SIZE_INT)inst->getCodeStartAddr()+inst->getCodeSize() << std::endl;
-                        Log::out() << "has inline info:" << std::endl;
-                        callinst->getInlineInfo()->printLevels(Log::out());
-                        // report offset 1 bundle forward
-                        POINTER_SIZE_INT offset = (POINTER_SIZE_INT)inst->getCodeStartAddr() + inst->getCodeSize() - (POINTER_SIZE_INT)irManager->getCodeStartAddr();
-                        assert(fit32(offset));
-                        inlineMap->registerOffset((uint32)offset, callinst->getInlineInfo());
-                    }
-                    Log::out() << std::endl;
-                }
+
+//all CALL insts and all heap accesses
+static bool isBCMapCandidate(Inst* inst) {
+    if (inst->hasKind(Inst::Kind_CallInst)) {
+        return true;
+    } else if (inst->hasKind(Inst::Kind_PseudoInst)) {
+        return false;
+    }
+    //check if memory access can cause nullpointer exception
+    //TODO: filter out heap access insts that can't fail! Example: static field accessors..
+    Inst::Opnds opnds(inst, Inst::OpndRole_InstLevel | Inst::OpndRole_UseDef);
+    for (Inst::Opnds::iterator op = opnds.begin(), op_end = opnds.end(); op != op_end; op = opnds.next(op)) {
+        Opnd* opnd = opnds.getOpnd(op);
+        if (opnd->isPlacedIn(OpndKind_Mem) && opnd->getMemOpndKind() == MemOpndKind_Heap) {
+            return true;
+        }
+    }
+    return false;
+}
+
+
+typedef StlVector<MethodMarkerPseudoInst*> Markers;
+
+void CodeEmitter::registerInlineInfoOffsets(Node* node, InlineInfoMap::Entry* parentEntry, InlineInfoMap* inlineBCMap) {
+    assert(traversalInfo[node->getId()] == 0);
+    traversalInfo[node->getId()] = 1;   
+    
+    for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst()) {
+        if (inst->getKind() == Inst::Kind_MethodEntryPseudoInst) {
+            if (Log::isEnabled()) {
+                IRPrinter::printIndent(Log::out(), parentEntry ? parentEntry->getInlineDepth() + 1 : 0);
+                IRPrinter::printInst(Log::out(), inst);
+                Log::out()<<" bc offset="<<inst->getBCOffset()<<std::endl;
+            }
+            MethodMarkerPseudoInst* marker = (MethodMarkerPseudoInst*)inst;
+            Method_Handle mh = marker->getMethodDesc()->getMethodHandle();
+            uint16 bcOffset = marker->getBCOffset();
+            assert(bcOffset!=ILLEGAL_BC_MAPPING_VALUE);
+            parentEntry = inlineBCMap->newEntry(parentEntry, mh, bcOffset);
+        } else if (inst->getKind() == Inst::Kind_MethodEndPseudoInst) {
+            assert(parentEntry!=NULL);
+            if (Log::isEnabled()) {
+                IRPrinter::printIndent(Log::out(), parentEntry->getInlineDepth());
+                IRPrinter::printInst(Log::out(), inst); Log::out()<<std::endl;
+            }
+            if (parentEntry!=NULL) { //check to avoid crash in release mode
+                MethodMarkerPseudoInst* endMarker = (MethodMarkerPseudoInst*)inst;
+                assert(parentEntry->method == endMarker->getMethodDesc()->getMethodHandle());
+                parentEntry = parentEntry->parentEntry;
             }
+        } else if (isBCMapCandidate(inst) && parentEntry!=NULL) {
+            if (Log::isEnabled()) {
+                IRPrinter::printIndent(Log::out(), parentEntry->getInlineDepth()+1);
+                IRPrinter::printInst(Log::out(), inst);
+                Log::out()<<" bc offset="<<inst->getBCOffset()<<std::endl;
+            }
+            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();
+    for (Edges::const_iterator ite = edges.begin(), ende = edges.end(); ite!=ende; ++ite) {
+        Edge* e = *ite;
+        Node* n = e->getTargetNode();
+        if (traversalInfo[n->getId()]==0) {
+            registerInlineInfoOffsets(n, parentEntry, inlineBCMap);
+        }
+    }
+    
+
+}
+
+//________________________________________________________________________________________
+void CodeEmitter::registerInlineInfoOffsets() 
+{
+    //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;
 }
 
 //________________________________________________________________________________________
@@ -496,7 +560,6 @@
 void CodeEmitter::postPass()
 {  
     MemoryManager& irmm = irManager->getMemoryManager();
-    bool isBcRequired = irManager->getCompilationInterface().isBCMapInfoRequired();
     BcMap* bcMap = new(irmm) BcMap(irmm);
     irManager->setInfo(BCMAP_INFO_KEY, bcMap);
     bool newOpndsCreated = false;
@@ -527,7 +590,7 @@
                     continue;
                 int64 offset=targetCodeStartAddr-instCodeEndAddr;
 
-                uint16 bcOffset = isBcRequired ? getBCMappingEntry(bc2LIRMapHandler, inst->getId()) : ILLEGAL_BC_MAPPING_VALUE;
+                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
@@ -583,7 +646,11 @@
                         registerDirectCall(md,instCodeStartAddr);
                     }
 
-                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
+                    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
@@ -848,14 +915,13 @@
                 entryExitMap[methMarkerInst] = inlineStack.back();
                 inlineStack.pop_back();
                 methMarkerInst = NULL;
-            } else {              //handle usual instructions
+            } else { //handle usual instructions
                 if (methMarkerInst != NULL) {    // inlined locations for methMarkerInst 
                     assert(methInfo == methodLocationMap[methMarkerInst]);
                     if( ! inst->hasKind(Inst::Kind_PseudoInst)) {
                         instSizeMap[(POINTER_SIZE_INT) inst->getCodeStartAddr()] = inst->getCodeSize();
                     }
-                    uint32 instID = inst->getId();
-                    uint16 bcOffset = getBCMappingEntry(bc2LIRMapHandler, instID);
+                    uint16 bcOffset = inst->getBCOffset();
                     methInfo->includeInst(inst,bcOffset);
                     // addLocation with ILLEGAL_VALUE for all outers
                     MethodMarkerPseudoInst* outerEntry = methInfo->getOuterMethodEntry();
@@ -967,7 +1033,8 @@
 
 void CodeEmitter::reportCompiledInlinees() {
     StlList<MethodMarkerPseudoInst*> inlineList(memoryManager);
-    traversalInfo.resize(irManager->getFlowGraph()->getMaxNodeId() + 1, 0);
+    assert(traversalInfo.size() == irManager->getFlowGraph()->getMaxNodeId() + 1);
+    std::fill(traversalInfo.begin(), traversalInfo.end(), 0);
     bool isForward = true;
     orderNodesAndMarkInlinees(inlineList, irManager->getFlowGraph()->getEntryNode(), isForward);
 

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeGenerator.cpp Fri Jul 13 07:19:35 2007
@@ -115,15 +115,6 @@
 #endif     
     cc->setLIRManager(irManager);
     
-    MethodDesc* meth = ci->getMethodToCompile();
-    if (ci->isBCMapInfoRequired()) {
-        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);
-    }
-
     bool slowLdString = sa->getBoolArg("SlowLdString", false); 
     MemoryManager  codeSelectorMemManager("CodeGenerator::selectCode.codeSelectorMemManager");
     MethodCodeSelector    codeSelector(*ci, mm, codeSelectorMemManager, *irManager, slowLdString);

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp Fri Jul 13 07:19:35 2007
@@ -63,18 +63,13 @@
     for (i = 0; i < numNodes; i++) 
         nodes[i] = NULL;
 
-    if (compIntfc.isBCMapInfoRequired()) {
-        MethodDesc* meth = compIntfc.getMethodToCompile();
-        bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
-        bc2LIRmapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
-   }
     InstCodeSelector::onCFGInit(irManager);
 }
 
 //_______________________________________________________________________________________________
 /**  Create an exception handling (dispatching) node */
 
-uint32 CfgCodeSelector::genDispatchNode(uint32 numInEdges,uint32 numOutEdges, double cnt) 
+uint32 CfgCodeSelector::genDispatchNode(uint32 numInEdges,uint32 numOutEdges, const StlVector<MethodDesc*>& inlineEndMarkers, double cnt) 
 {
     assert(nextNodeId < numNodes);
     uint32 nodeId = nextNodeId++;
@@ -82,6 +77,10 @@
     node->setExecCount(cnt);
     nodes[nodeId] = node;
     hasDispatchNodes = true;
+    for (StlVector<MethodDesc*>::const_iterator it = inlineEndMarkers.begin(), end = inlineEndMarkers.end(); it!=end; ++it) {
+        MethodDesc*  desc = *it;
+        node->appendInst(irManager.newMethodEndPseudoInst(desc));
+    }
     return nodeId;
 }
 
@@ -106,7 +105,7 @@
     }
 
     currBlock = NULL;
-    //  Set prolog or epilog node
+    //  Set prolog or epilogue node
     switch (blockKind) {
     case Prolog:
         {

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.h Fri Jul 13 07:19:35 2007
@@ -36,7 +36,7 @@
 
 
 //========================================================================================================
-//  Forward delcarations
+//  Forward declarations
 //========================================================================================================
 
 class Inst;
@@ -69,10 +69,9 @@
                          MemoryManager& codeSelectorMM, uint32 nNodes, 
                          IRManager& irM);
 
-    uint32  genDispatchNode(uint32 numInEdges, uint32 numOutEdges, double cnt);
+    uint32  genDispatchNode(uint32 numInEdges, uint32 numOutEdges, const StlVector<MethodDesc*>& inlineEndMarkers, double cnt);
     uint32  genBlock(uint32 numInEdges, uint32 numOutEdges, BlockKind blockKind,
-                     BlockCodeSelector& codeSelector,
-                     double cnt);
+                     BlockCodeSelector& codeSelector, double cnt);
     uint32  genUnwindNode(uint32 numInEdges, uint32 numOutEdges,double cnt);
     uint32  genExitNode(uint32 numInEdges, double cnt);
     void    genUnconditionalEdge(uint32 tailNodeId,uint32 headNodeId, double prob);
@@ -133,11 +132,6 @@
 
     Opnd *                  returnOperand;
 
-    //
-    // bc map info
-    //
-    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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CopyExpansion.cpp Fri Jul 13 07:19:35 2007
@@ -340,11 +340,6 @@
 void CopyExpansion::runImpl()
 {
     CompilationInterface& compIntfc = irManager->getCompilationInterface();
-    void* bc2LIRmapHandler = NULL;
-
-    if (compIntfc.isBCMapInfoRequired()) {
-        bc2LIRmapHandler = getContainerHandler(bcOffset2LIRHandlerName, compIntfc.getMethodToCompile());
-    }
 
     // call SimpleStackOpndCoalescer before all other things including finalizeCallSites
     // as they add new local operands and fixLivenessInfo would be necessary 
@@ -417,15 +412,13 @@
                     }
                     // CopyPseudoInst map entries should be changed by new copy sequence instructions in byte code map
                     if (compIntfc.isBCMapInfoRequired() && copySequence != NULL) {
-                        uint32 instID = inst->getId();
-                        uint16 bcOffs = getBCMappingEntry(bc2LIRmapHandler, instID);
+                        uint16 bcOffs = inst->getBCOffset();
                         if (bcOffs != ILLEGAL_BC_MAPPING_VALUE) {
                             Inst * cpInst=NULL, * nextCpInst=copySequence, * lastCpInst=copySequence->getPrev(); 
                             do { 
                                 cpInst=nextCpInst;
                                 nextCpInst=cpInst->getNext();
-                                uint32 cpInstID = cpInst->getId();
-                                setBCMappingEntry(bc2LIRmapHandler, cpInstID, bcOffs);
+                                cpInst->setBCOffset(bcOffs);
                             } while ((cpInst != lastCpInst) && (cpInst != NULL));
                         }
                     }

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Fri Jul 13 07:19:35 2007
@@ -579,7 +579,7 @@
     CompilationInterface& compIntf = irManager->getCompilationInterface();
 
     if ( !inlineInfo->isEmpty() ) {
-        inlineInfo->write(compIntf.allocateJITDataBlock(inlineInfo->computeSize(), 8));
+        inlineInfo->write(compIntf.allocateJITDataBlock(inlineInfo->getImageSize(), 8));
     }
 
     uint32 stackInfoSize = (uint32)stackInfo->getByteSize();

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.cpp Fri Jul 13 07:19:35 2007
@@ -489,9 +489,9 @@
 
 //_________________________________________________________________________________________________
 CallInst * IRManager::newCallInst(Opnd * targetOpnd, const CallingConvention * cc, 
-        uint32 argCount, Opnd ** args, Opnd * retOpnd, InlineInfo* ii)
+        uint32 argCount, Opnd ** args, Opnd * retOpnd)
 {
-    CallInst * callInst=new(memoryManager, (argCount + (retOpnd ? 1 : 0)) * 2 + 1) CallInst(this, instId++, cc, ii, targetOpnd->getRuntimeInfo());
+    CallInst * callInst=new(memoryManager, (argCount + (retOpnd ? 1 : 0)) * 2 + 1) CallInst(this, instId++, cc, targetOpnd->getRuntimeInfo());
     CallingConventionClient & ccc = callInst->callingConventionClient;
     uint32 i=0;
     if (retOpnd!=NULL){
@@ -514,7 +514,7 @@
 
 //_________________________________________________________________________________________________
 CallInst * IRManager::newRuntimeHelperCallInst(CompilationInterface::RuntimeHelperId helperId, 
-    uint32 numArgs, Opnd ** args, Opnd * retOpnd, InlineInfo* ii)
+    uint32 numArgs, Opnd ** args, Opnd * retOpnd)
 {
     Inst * instList = NULL;
     Opnd * target=newImmOpnd(typeManager.getInt32Type(), Opnd::RuntimeInfo::Kind_HelperAddress, (void*)helperId);
@@ -1898,12 +1898,18 @@
 #endif
                        )){
                         Node* throwBasicBlock = fg->createBlockNode();
-                        throwBasicBlock->appendInst(newRuntimeHelperCallInst(CompilationInterface::Helper_NullPtrException, 0, NULL, NULL));
+                        Inst* throwInst = newRuntimeHelperCallInst(CompilationInterface::Helper_NullPtrException, 0, NULL, NULL);
+                        throwInst->setBCOffset(lastInst->getBCOffset());
+                        throwBasicBlock->appendInst(throwInst);
 #ifndef _EM64T_
-                        bb->appendInst(newInst(Mnemonic_CMP, opnd, newImmOpnd(opnd->getType(), 0)));
+                        Inst* cmpInst = newInst(Mnemonic_CMP, opnd, newImmOpnd(opnd->getType(), 0));
+                        bb->appendInst(cmpInst);
 #else
-                        bb->appendInst(newInst(Mnemonic_CMP, opnd,newImmOpnd(opnd->getType(), (Type::isCompressedReference(opnd->getType()->tag) || !opnd->getType()->isReference())? 0: (POINTER_SIZE_INT)VMInterface::getHeapBase())));
+                        Inst* cmpInst = newInst(Mnemonic_CMP, opnd,newImmOpnd(opnd->getType(), (Type::isCompressedReference(opnd->getType()->tag) || !opnd->getType()->isReference())? 0: (POINTER_SIZE_INT)VMInterface::getHeapBase()));
+                        bb->appendInst(cmpInst);
 #endif
+                        cmpInst->setBCOffset(lastInst->getBCOffset());
+
                         bb->appendInst(newBranchInst(Mnemonic_JZ, throwBasicBlock, oldTarget));
                         fg->addEdge(bb, throwBasicBlock, 0);
 
@@ -2364,8 +2370,10 @@
     if (isLogEnabled(LogStream::IRDUMP)) {
         irManager->updateLoopInfo();
         irManager->updateLivenessInfo();
-        dumpIR(subKind, "opnds");
-        dumpIR(subKind, "liveness");
+        if (isLogEnabled("irdump_verbose")) {
+            dumpIR(subKind, "opnds");
+            dumpIR(subKind, "liveness");
+        }
         dumpIR(subKind);
     }
 

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32IRManager.h Fri Jul 13 07:19:35 2007
@@ -33,7 +33,6 @@
 #include "XTimer.h"
 #include "Log.h"
 #include "PlatformDependant.h"
-#include "CGSupport.h"
 #include "CompilationContext.h"
 #include "JITInstanceContext.h"
 #include "PMFAction.h"
@@ -205,11 +204,11 @@
 
     /** Creates a CallInst instance. */
     CallInst *  newCallInst(Opnd * targetOpnd, const CallingConvention * cc, 
-        uint32 numArgs, Opnd ** args, Opnd * retOpnd, InlineInfo* ii = NULL);
+        uint32 numArgs, Opnd ** args, Opnd * retOpnd);
 
     /** A specialization of the newCallInst to create a VM Helper CallInst. */
     CallInst *  newRuntimeHelperCallInst(CompilationInterface::RuntimeHelperId helperId, 
-        uint32 numArgs, Opnd ** args, Opnd * retOpnd, InlineInfo* ii = NULL);
+        uint32 numArgs, Opnd ** args, Opnd * retOpnd);
     /** A specialization of the newCallInst to create an internal helper CallInst. */
     CallInst *  newInternalRuntimeHelperCallInst(const char * internalHelperID, uint32 numArgs, Opnd ** args, Opnd * retOpnd);
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.cpp Fri Jul 13 07:19:35 2007
@@ -20,7 +20,6 @@
 
 #include "Ia32Inst.h"
 #include "Ia32IRManager.h"
-#include "InlineInfo.h"
 #include "Ia32CFG.h"
 
 namespace Jitrino
@@ -584,6 +583,9 @@
 //_________________________________________________________________________________________________
 void * Inst::getCodeStartAddr() const 
 {
+    if (hasKind(Inst::Kind_PseudoInst)) {
+        return (void*)0xDEADBEEF;
+    }
     BasicBlock* bb = getBasicBlock();
     return bb!=NULL?(uint8*)bb->getCodeStartAddr()+codeOffset:0;
 }
@@ -905,12 +907,9 @@
 // class CallInst
 //=================================================================================================
 //_________________________________________________________________________________________________
-CallInst::CallInst(IRManager * irm, int id, const CallingConvention * cc, InlineInfo* ii, Opnd::RuntimeInfo* rri)  
-        : ControlTransferInst(Mnemonic_CALL, id), callingConventionClient(irm->getMemoryManager(), cc), inlineInfo(NULL), runtimeInfo(rri)
+CallInst::CallInst(IRManager * irm, int id, const CallingConvention * cc, Opnd::RuntimeInfo* rri)  
+        : ControlTransferInst(Mnemonic_CALL, id), callingConventionClient(irm->getMemoryManager(), cc), runtimeInfo(rri)
 { 
-    if (ii && (!ii->isEmpty()) ) {
-        inlineInfo = ii;
-    }
     kind=Kind_CallInst; 
     callingConventionClient.setOwnerInst(this); 
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Inst.h Fri Jul 13 07:19:35 2007
@@ -1288,17 +1288,15 @@
         return callingConventionClient.getCallingConvention()->getCalleeSavedRegs(regKind);
     }
 
-    InlineInfo * getInlineInfo() const { return inlineInfo; }
     Opnd::RuntimeInfo*  getRuntimeInfo() const {return runtimeInfo;}
 
 protected:
     CallingConventionClient callingConventionClient;
-    CallInst(IRManager * irm, int id, const CallingConvention * cc, InlineInfo* ii, Opnd::RuntimeInfo* targetInfo);
+    CallInst(IRManager * irm, int id, const CallingConvention * cc, Opnd::RuntimeInfo* targetInfo);
 
     //--------------------------------------------------------------------
     friend class    IRManager;
 private:
-    InlineInfo * inlineInfo;
     Opnd::RuntimeInfo* runtimeInfo;
 };
 

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Fri Jul 13 07:19:35 2007
@@ -26,6 +26,7 @@
 #include "VMInterface.h"
 #include "Opcode.h"
 #include "Ia32Tls.h"
+#include "Ia32CgUtils.h"
 
 #include <float.h>
 #include <math.h>
@@ -202,13 +203,8 @@
 Inst * InstCodeSelector::appendInsts(Inst *inst)
 {
     assert(currentBasicBlock);
-    if (compilationInterface.isBCMapInfoRequired()) {
-        uint16 bcOffset = getBCMappingEntry(codeSelector.bc2HIRmapHandler, currentHIRInstrID);
-        uint32 insID = inst->getId();
-        if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
-            setBCMappingEntry(codeSelector.bc2LIRmapHandler, insID, bcOffset);
-        }
-    }
+    inst->setBCOffset(currentHIRInstBCOffset);
+    assert(!InstUtils::instMustHaveBCMapping(inst) || currentHIRInstBCOffset!=ILLEGAL_BC_MAPPING_VALUE);
     if (Log::isEnabled()){
         Inst * i=inst; 
         do {
@@ -1553,8 +1549,10 @@
         cmpType = CompareOp::I;
 
     Node* throwBasicBlock = irManager.getFlowGraph()->createBlockNode();
-    throwBasicBlock->appendInst(irManager.newRuntimeHelperCallInst(
-                CompilationInterface::Helper_ArrayBoundsException, 0, NULL, NULL));
+    Inst* throwInst = irManager.newRuntimeHelperCallInst(CompilationInterface::Helper_ArrayBoundsException, 0, NULL, NULL);
+    throwInst->setBCOffset(currentHIRInstBCOffset);
+    throwBasicBlock->appendInst(throwInst);
+                
 
     branch(CompareOp::Geu, cmpType, (Opnd*)index, (Opnd*)arrayLen);
     codeSelector.genTrueEdge(currentBasicBlock, throwBasicBlock, 0);
@@ -1585,8 +1583,10 @@
         cmpOp = CompareOp::Gtu;
     }
     Node* throwBasicBlock = irManager.getFlowGraph()->createBlockNode();
-    throwBasicBlock->appendInst(irManager.newRuntimeHelperCallInst(
-                CompilationInterface::Helper_ArrayBoundsException, 0, NULL, NULL));
+    Inst* throwInst = irManager.newRuntimeHelperCallInst(CompilationInterface::Helper_ArrayBoundsException, 0, NULL, NULL);
+    throwInst->setBCOffset(currentHIRInstBCOffset);
+    throwBasicBlock->appendInst(throwInst);
+    
 
     branch(cmpOp, cmpType, (Opnd*)a, (Opnd*)b);
     codeSelector.genTrueEdge(currentBasicBlock, throwBasicBlock, 0);
@@ -1613,8 +1613,10 @@
                                                       CG_OpndHandle* tauIsArray) 
 {
     Node* throwBasicBlock = irManager.getFlowGraph()->createBlockNode();
-    throwBasicBlock->appendInst(irManager.newRuntimeHelperCallInst(
-                CompilationInterface::Helper_ElemTypeException, 0, NULL, NULL));
+    Inst* throwInst = irManager.newRuntimeHelperCallInst(CompilationInterface::Helper_ElemTypeException, 0, NULL, NULL);
+    assert(currentHIRInstBCOffset!=ILLEGAL_BC_MAPPING_VALUE);
+    throwInst->setBCOffset(currentHIRInstBCOffset);
+    throwBasicBlock->appendInst(throwInst);
 
     Opnd * args[] = { (Opnd*)src, (Opnd*)array };
     Opnd * flag = irManager.newOpnd(typeManager.getInt32Type());
@@ -1634,8 +1636,10 @@
 CG_OpndHandle*  InstCodeSelector::tau_checkZero(CG_OpndHandle* src) 
 {
     Node* throwBasicBlock = irManager.getFlowGraph()->createBlockNode();
-    throwBasicBlock->appendInst(irManager.newRuntimeHelperCallInst(
-                CompilationInterface::Helper_DivideByZeroException, 0, NULL, NULL));
+    Inst* throwInst = irManager.newRuntimeHelperCallInst(CompilationInterface::Helper_DivideByZeroException, 0, NULL, NULL);
+    assert(currentHIRInstBCOffset!=ILLEGAL_BC_MAPPING_VALUE);
+    throwInst->setBCOffset(currentHIRInstBCOffset);
+    throwBasicBlock->appendInst(throwInst);
     Opnd * srcOpnd = (Opnd*)src;
     Type * type = srcOpnd->getType();
     CompareZeroOp::Types opType = CompareZeroOp::I;
@@ -2441,8 +2445,7 @@
 CG_OpndHandle* InstCodeSelector::calli(uint32            numArgs, 
                                           CG_OpndHandle**   args, 
                                           Type*             retType, 
-                                          CG_OpndHandle*    methodPtr,
-                                          InlineInfo*       ii)
+                                          CG_OpndHandle*    methodPtr)
 {
     return tau_calli(numArgs, args, retType, methodPtr, getTauUnsafe(), getTauUnsafe());
 }
@@ -2455,13 +2458,11 @@
                                               Type*             retType, 
                                               CG_OpndHandle*    methodPtr,
                                               CG_OpndHandle*    nonNullFirstArgTau,
-                                              CG_OpndHandle*    tauTypesChecked,
-                                              InlineInfo*       ii)
+                                              CG_OpndHandle*    tauTypesChecked)
 {
     Opnd * target=irManager.newMemOpnd(typeManager.getUnmanagedPtrType(typeManager.getUIntPtrType()), (Opnd*)methodPtr);
     Opnd * retOpnd=createResultOpnd(retType);
-    CallInst * callInst=irManager.newCallInst(target, irManager.getDefaultManagedCallingConvention(), 
-        numArgs, (Opnd **)args, retOpnd, ii);
+    CallInst * callInst=irManager.newCallInst(target, irManager.getDefaultManagedCallingConvention(), numArgs, (Opnd **)args, retOpnd);
     appendInsts(callInst);
     return retOpnd;
 }
@@ -2474,8 +2475,7 @@
 CG_OpndHandle* InstCodeSelector::call(uint32          numArgs, 
                                          CG_OpndHandle** args, 
                                          Type*           retType,
-                                         MethodDesc *    desc,
-                                         InlineInfo*       ii)
+                                         MethodDesc *    desc)
 {
     return tau_call(numArgs, args, retType, desc, getTauUnsafe(), getTauUnsafe());
 }
@@ -2574,8 +2574,7 @@
                                              Type*           retType,
                                              MethodDesc *    desc,
                                              CG_OpndHandle* tauNullCheckedFirstArg,
-                                             CG_OpndHandle* tauTypesChecked,
-                                             InlineInfo*       ii)
+                                             CG_OpndHandle* tauTypesChecked)
 {
     // target address here has Int32 type. On EM64T platform it can be larger, but this situations are managed
     // in Ia32CodeEmitter::postPass method (transforming direct calls into register form if target offset
@@ -2585,7 +2584,7 @@
     Opnd * target=irManager.newImmOpnd(typeManager.getInt32Type(), Opnd::RuntimeInfo::Kind_MethodDirectAddr, desc);
     Opnd * retOpnd=createResultOpnd(retType);
     CallInst * callInst=irManager.newCallInst(target, irManager.getDefaultManagedCallingConvention(), 
-        numArgs, (Opnd **)args, retOpnd, ii);
+        numArgs, (Opnd **)args, retOpnd);
     appendInsts(callInst);
     return retOpnd;
 }
@@ -2599,8 +2598,7 @@
                                                  Type*           retType,
                                                  MethodDesc *    desc,
                                                  CG_OpndHandle * tauNullChecked,
-                                                 CG_OpndHandle * tauTypesChecked,
-                                                 InlineInfo*       ii)
+                                                 CG_OpndHandle * tauTypesChecked)
 {
     CG_OpndHandle * vtableAddr = NULL;
     NamedType* vtableType = desc->getParentType();
@@ -2746,8 +2744,7 @@
 CG_OpndHandle* InstCodeSelector::callvmhelper(uint32              numArgs, 
                                               CG_OpndHandle**     args, 
                                               Type*               retType,
-                                              CompilationInterface::RuntimeHelperId  callId,
-                                              InlineInfo* ii) 
+                                              CompilationInterface::RuntimeHelperId  callId) 
 {
     Opnd* dstOpnd=NULL;
     switch(callId) {
@@ -2764,7 +2761,7 @@
         hlpArgs[numArgs] = irManager.newImmOpnd(getRuntimeIdType(), 
                                                Opnd::RuntimeInfo::Kind_MethodRuntimeId, md);
         appendInsts(irManager.newRuntimeHelperCallInst(CompilationInterface::Helper_Throw_Lazy,
-                                                       numArgs+1, (Opnd**)hlpArgs, dstOpnd, ii));
+                                                       numArgs+1, (Opnd**)hlpArgs, dstOpnd));
         break;
     }
     case CompilationInterface::Helper_GetTLSBase:

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.h Fri Jul 13 07:19:35 2007
@@ -24,7 +24,6 @@
 
 #include "CodeGenIntfc.h"
 #include "Ia32CodeSelector.h"
-#include "CGSupport.h"
 namespace Jitrino
 {
 namespace Ia32{
@@ -210,23 +209,22 @@
     CG_OpndHandle* getVTableAddr(Type *dstType, ObjectType *base);
     CG_OpndHandle* tau_ldIntfTableAddr(Type *dstType, CG_OpndHandle* base,NamedType* vtableTypeDesc);
     CG_OpndHandle* calli(uint32 numArgs,CG_OpndHandle** args, Type* retType,
-                         CG_OpndHandle* methodPtr, InlineInfo* ii = NULL);
+                         CG_OpndHandle* methodPtr);
     CG_OpndHandle* tau_calli(uint32 numArgs,CG_OpndHandle** args, Type* retType,
                              CG_OpndHandle* methodPtr, CG_OpndHandle* nonNullFirstArgTau,
-                             CG_OpndHandle* tauTypesChecked, InlineInfo* ii = NULL);
-    CG_OpndHandle* call(uint32 numArgs, CG_OpndHandle** args, Type* retType,
-                        MethodDesc *desc, InlineInfo* ii = NULL);
+                             CG_OpndHandle* tauTypesChecked);
+    CG_OpndHandle* call(uint32 numArgs, CG_OpndHandle** args, Type* retType, MethodDesc *desc);
     CG_OpndHandle* arraycopyReverse(uint32 numArgs, CG_OpndHandle** args);
     CG_OpndHandle* arraycopy(uint32 numArgs, CG_OpndHandle** args);
     CG_OpndHandle* tau_call(uint32 numArgs, CG_OpndHandle** args, Type* retType,
                             MethodDesc *desc, CG_OpndHandle *nonNullFirstArgTau,
-                            CG_OpndHandle *tauTypesChecked, InlineInfo* ii = NULL);
-    CG_OpndHandle* tau_callvirt(uint32 numArgs,CG_OpndHandle** args, Type* retType, MethodDesc *desc,             CG_OpndHandle* tauNullChecked, CG_OpndHandle* tauTypesChecked, InlineInfo* ii = NULL);
+                            CG_OpndHandle *tauTypesChecked);
+    CG_OpndHandle* tau_callvirt(uint32 numArgs,CG_OpndHandle** args, Type* retType, MethodDesc *desc,             CG_OpndHandle* tauNullChecked, CG_OpndHandle* tauTypesChecked);
     CG_OpndHandle* callintr(uint32 numArgs, CG_OpndHandle** args, Type* retType,IntrinsicCallOp::Id callId);
     CG_OpndHandle* tau_callintr(uint32 numArgs, CG_OpndHandle** args, Type* retType,IntrinsicCallOp::Id callId,      CG_OpndHandle *tauNullsChecked, CG_OpndHandle *tauTypesChecked);
     CG_OpndHandle* callhelper(uint32 numArgs, CG_OpndHandle** args, Type* retType,JitHelperCallOp::Id callId);
     CG_OpndHandle* callvmhelper(uint32 numArgs, CG_OpndHandle** args, Type* retType,
-                                CompilationInterface::RuntimeHelperId callId, InlineInfo* ii = NULL);
+                                CompilationInterface::RuntimeHelperId callId);
     
     CG_OpndHandle* box(ObjectType * boxedType, CG_OpndHandle* val);
     CG_OpndHandle* unbox(Type * dstType, CG_OpndHandle* objHandle);
@@ -309,14 +307,13 @@
     //
     // Set current HIR instruction in order to allow Code Generator propagate bc offset info
     //
-    virtual void setCurrentHIRInstrID(uint32 HIRInstrID) {
-        currentHIRInstrID =  HIRInstrID;
-    }
+    virtual void   setCurrentHIRInstBCOffset(uint16 val) { currentHIRInstBCOffset =  val; }
+    virtual uint16 getCurrentHIRInstBCOffset() const { return currentHIRInstBCOffset; }
 private: 
     //
-    // pointer to HIR instruction with bytecode offset 
+    // info about current HIR instruction bytecode offset 
     //
-    uint32 currentHIRInstrID;
+    uint16 currentHIRInstBCOffset;
 
     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/Ia32PeepHole.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32PeepHole.cpp Fri Jul 13 07:19:35 2007
@@ -180,7 +180,7 @@
 {
     PeepHoleOpt::Changed temp;
 
-    if (isPseudoInst(inst)) {
+    if (inst->hasKind(Inst::Kind_PseudoInst)) {
         return Changed_Nothing;
     }
 
@@ -584,7 +584,7 @@
     if (isReg(dst) && equals(src, dst)) {
         // what: same register moved around
         // why:  useless thing
-        removeInst(inst);
+        inst->unlink();
         return Changed_Inst;
     }
     

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.cpp Fri Jul 13 07:19:35 2007
@@ -21,7 +21,6 @@
 
 #include "Ia32Printer.h"
 #include "Log.h"
-#include "CGSupport.h"
 #include "PlatformDependant.h"
 
 namespace Jitrino
@@ -228,7 +227,7 @@
 }
 
 //_____________________________________________________________________________________________
-void IRPrinter::printNodeInstList(const BasicBlock * bb, uint32 indent)
+void IRPrinter::printNodeInstList(const Node* bb, uint32 indent)
 {
     ::std::ostream& os = getStream();
     for (Inst * inst = (Inst*)bb->getFirstInst(); inst != NULL; inst = inst->getNextInst()) {
@@ -249,7 +248,7 @@
 {
     std::ostream& os = getStream();
     printNodeHeader(node, indent);
-    if (node->isBlockNode()) {
+    if (!node->isEmpty()) {
         os << std::endl;
         printNodeInstList((BasicBlock*)node, indent);
     }
@@ -357,6 +356,16 @@
     printedOpnds=printInstOpnds(inst, (Inst::OpndRole_Use|Inst::OpndRole_Implicit)&opndRolesFilter);
     if (printedOpnds){ os<<" "; printedOpndsTotal+=printedOpnds; }
 
+    if (inst->hasKind(Inst::Kind_CallInst) || inst->hasKind(Inst::Kind_MethodEntryPseudoInst)) {
+        os<<"[bcmap:";
+        if (inst->getBCOffset()==ILLEGAL_BC_MAPPING_VALUE) {
+            os<<"unknown";
+        } else {
+            os<<inst->getBCOffset();
+        }
+        os<<"] ";
+    }
+
     if (inst->hasKind(Inst::Kind_GCInfoPseudoInst)) {
         const GCInfoPseudoInst* gcInst = (GCInfoPseudoInst*)inst;
         Opnd * const * uses = gcInst->getOpnds();
@@ -818,24 +827,14 @@
         out<<", code="<<(void*)bb->getCodeStartAddr();
     }
 
-    if (bb) {
+    if (!node->isEmpty()) {
         out << "\\l|\\" << std::endl;
-        void* lirMapHandler = NULL;
-        if (irManager->getCompilationInterface().isBCMapInfoRequired()) {
-            MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
-            lirMapHandler = getContainerHandler(bcOffset2LIRHandlerName, meth);
-            assert(lirMapHandler);
-        }
-        for (Inst * inst = (Inst*)bb->getFirstInst(); inst != NULL; inst = inst->getNextInst()) {
+        for (Inst * inst = (Inst*)node->getFirstInst(); inst != NULL; inst = inst->getNextInst()) {
             Inst::Kind kind=inst->getKind();
             if ((kind & instFilter)==(uint32)kind){
                 printInst(inst);
-                if (lirMapHandler != NULL) {
-                    uint16 bcOffset = 0;
-                    uint32 instID = inst->getId();
-                    bcOffset = getBCMappingEntry(lirMapHandler, instID);
-                    if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) out<<" bcOff: "<< (uint16)bcOffset << " ";
-                }
+                uint16 bcOffset = inst->getBCOffset();
+                if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) out<<" bcOff: "<< bcOffset << " ";
                 out << "\\l\\" << ::std::endl;
             }
         }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32Printer.h Fri Jul 13 07:19:35 2007
@@ -164,7 +164,7 @@
     { IRPrinter p; p.setStream(os); p.printNodeName(node); }
 
     virtual void printNodeHeader(const Node * node, uint32 indent=0);
-    virtual void printNodeInstList(const BasicBlock * bb, uint32 indent=0);
+    virtual void printNodeInstList(const Node* bb, uint32 indent=0);
 
     virtual void printNode(const Node * node, uint32 indent=0);
     static void printNode(::std::ostream& os, const Node * node, uint32 indent=0)

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp Fri Jul 13 07:19:35 2007
@@ -24,7 +24,6 @@
 #include "Ia32StackInfo.h"
 #include "Ia32GCMap.h"
 #include "Ia32BCMap.h"
-#include "CGSupport.h"
 
 namespace Jitrino
 {
@@ -117,15 +116,18 @@
 }
 
 uint32  RuntimeInterface::getInlineDepth(InlineInfoPtr ptr, uint32 offset) {
-    return InlineInfoMap::get_inline_depth(ptr, offset);
+    const InlineInfoMap::Entry* e = InlineInfoMap::getEntryWithMaxDepth(ptr, offset);
+    return e == NULL ? 0 : e->getInlineDepth();
 }
 
 Method_Handle   RuntimeInterface::getInlinedMethod(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth) {
-    return InlineInfoMap::get_inlined_method(ptr, offset, inline_depth);
+    const InlineInfoMap::Entry* e = InlineInfoMap::getEntry(ptr, offset, inline_depth);
+    return e == NULL  ? 0 : e->method;
 }
 
 uint16 RuntimeInterface::getInlinedBc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth) {
-    return InlineInfoMap::get_inlined_bc(ptr, offset, inline_depth);
+    const InlineInfoMap::Entry* e = InlineInfoMap::getEntry(ptr, offset, inline_depth);
+    return e == NULL  ? 0 : e->bcOffset;
 }
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfCodeSelector.cpp Fri Jul 13 07:19:35 2007
@@ -128,6 +128,7 @@
 
 uint32 IpfCfgCodeSelector::genDispatchNode(uint32 numInEdges, 
                                            uint32 numOutEdges, 
+                                           const StlVector<MethodDesc*>& inlineInfo,
                                            double cnt) {
 
     Node *node = new(mm) Node(mm, opndManager->getNextNodeId(), (uint32) cnt, NODE_DISPATCH);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/IpfInstCodeSelector.cpp Fri Jul 13 07:19:35 2007
@@ -1285,10 +1285,9 @@
 CG_OpndHandle *IpfInstCodeSelector::call(uint32        numArgs, 
                                          CG_OpndHandle **args, 
                                          Type          *retType,
-                                         MethodDesc    *desc,
-                                         InlineInfo    *ii) {
+                                         MethodDesc    *desc) {
 
-    return tau_call(numArgs, args, retType, desc, NULL, NULL, ii);
+    return tau_call(numArgs, args, retType, desc, NULL, NULL);
 }
 
 //----------------------------------------------------------------------------//
@@ -1299,8 +1298,7 @@
                                              Type          *retType,
                                              MethodDesc    *desc,
                                              CG_OpndHandle *tauNullCheckedFirstArg,
-                                             CG_OpndHandle *tauTypesChecked,
-                                             InlineInfo    *ii) {
+                                             CG_OpndHandle *tauTypesChecked) {
 
     IPF_LOG << "      tau_call; method=" << desc->getName() 
         << ", desc=" << desc << ", addr=0x" << hex << *((uint64 *)desc->getIndirectAddress()) 
@@ -1326,8 +1324,7 @@
                                               Type          *retType, 
                                               CG_OpndHandle *methodPtr,
                                               CG_OpndHandle *nonNullFirstArgTau,
-                                              CG_OpndHandle *tauTypesChecked,
-                                              InlineInfo    *ii) {
+                                              CG_OpndHandle *tauTypesChecked) {
 
     IPF_LOG << "      tau_calli; numArgs=" << numArgs 
         << ", retType=" << (retType ? Type::tag2str(retType->tag) : "NULL") << endl;

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=556007&r1=556006&r2=556007
==============================================================================
--- 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 Fri Jul 13 07:19:35 2007
@@ -82,7 +82,7 @@
 class IpfCfgCodeSelector : public CFGCodeSelector::Callback {
 public:
                          IpfCfgCodeSelector(Cfg&, NodeVector&, OpndVector&, CompilationInterface&);
-    uint32               genDispatchNode(uint32, uint32, double);
+    uint32               genDispatchNode(uint32, uint32, const StlVector<MethodDesc*>&, double);
     uint32               genBlock(uint32, uint32, BlockKind, BlockCodeSelector&, double);
     uint32               genUnwindNode(uint32, uint32, double);
     uint32               genExitNode(uint32, double);
@@ -173,9 +173,9 @@
     void          bnzero(CompareZeroOp::Types, CG_OpndHandle*);
     void          tableSwitch(CG_OpndHandle*, uint32);       
 
-    CG_OpndHandle *call(uint32, CG_OpndHandle**, Type*, MethodDesc*, InlineInfo* ii = NULL);
-    CG_OpndHandle *tau_call(uint32, CG_OpndHandle**, Type*, MethodDesc*, CG_OpndHandle*, CG_OpndHandle*, InlineInfo* ii = NULL);
-    CG_OpndHandle *tau_calli(uint32,CG_OpndHandle**, Type*, CG_OpndHandle*, CG_OpndHandle*, CG_OpndHandle*, InlineInfo* ii = NULL);
+    CG_OpndHandle *call(uint32, CG_OpndHandle**, Type*, MethodDesc*);
+    CG_OpndHandle *tau_call(uint32, CG_OpndHandle**, Type*, MethodDesc*, CG_OpndHandle*, CG_OpndHandle*);
+    CG_OpndHandle *tau_calli(uint32,CG_OpndHandle**, Type*, CG_OpndHandle*, CG_OpndHandle*, CG_OpndHandle*);
     CG_OpndHandle *tau_callintr(uint32, CG_OpndHandle**, Type*, IntrinsicCallOp::Id, CG_OpndHandle*, CG_OpndHandle*);
     void          ret();
     void          ret(CG_OpndHandle*);
@@ -243,7 +243,8 @@
     void          opndMaybeGlobal(CG_OpndHandle* opnd)            {}
     void          setCurrentPersistentId(PersistentInstructionId) {}
     void          clearCurrentPersistentId()                      {}
-    void          setCurrentHIRInstrID(uint32)                    {}
+    void          setCurrentHIRInstBCOffset(uint16)               {}
+    uint16        getCurrentHIRInstBCOffset() const         {return 0xFFFF;}
 
     //---------------------------------------------------------------------------//
     // Methods that are not going to be implemented
@@ -274,7 +275,7 @@
     CG_OpndHandle *ldValueObj(Type*, CG_OpndHandle*)                       { NOT_IMPLEMENTED_C("ldValueObj") }
     CG_OpndHandle *tau_ckfinite(CG_OpndHandle*)                            { NOT_IMPLEMENTED_C("tau_ckfinite") }
     CG_OpndHandle *callhelper(uint32, CG_OpndHandle**, Type*, JitHelperCallOp::Id) { NOT_IMPLEMENTED_C("callhelper") }
-    CG_OpndHandle *tau_callvirt(uint32, CG_OpndHandle**, Type*, MethodDesc*, CG_OpndHandle*, CG_OpndHandle*, InlineInfo* ii = NULL)  { NOT_IMPLEMENTED_C("tau_callvirt") }
+    CG_OpndHandle *tau_callvirt(uint32, CG_OpndHandle**, Type*, MethodDesc*, CG_OpndHandle*, CG_OpndHandle*)  { NOT_IMPLEMENTED_C("tau_callvirt") }
     CG_OpndHandle *select(CompareOp::Types, CG_OpndHandle*, CG_OpndHandle*, CG_OpndHandle*) { NOT_IMPLEMENTED_C("select") }
     CG_OpndHandle *cmp3(CompareOp::Operators,CompareOp::Types, CG_OpndHandle*, CG_OpndHandle*) { NOT_IMPLEMENTED_C("cmp3") }
     CG_OpndHandle *pred_cmp(CompareOp::Operators,CompareOp::Types, CG_OpndHandle*, CG_OpndHandle*) { NOT_IMPLEMENTED_C("pred_cmp") }
@@ -303,7 +304,7 @@
     //---------------------------------------------------------------------------//
 
     CG_OpndHandle* callvmhelper(uint32, CG_OpndHandle**, Type*
-                        , CompilationInterface::RuntimeHelperId, InlineInfo*) { NOT_IMPLEMENTED_C("unbox") }
+                        , CompilationInterface::RuntimeHelperId) { NOT_IMPLEMENTED_C("unbox") }
 
     CG_OpndHandle* convUPtrToObject(ObjectType*, CG_OpndHandle*)              { NOT_IMPLEMENTED_C("convUPtrToObject") }
     CG_OpndHandle* convToUPtr(PtrType*, CG_OpndHandle*)                       { NOT_IMPLEMENTED_C("convToUPtr") }

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/ValueProfiler.cpp Fri Jul 13 07:19:35 2007
@@ -97,9 +97,7 @@
                         continue;
                     }
                 }
-                void* bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, &md);
-                uint32 callInstId = lastInst->getId();
-                key = (uint32)getBCMappingEntry(bc2HIRMapHandler, callInstId);
+                key = (uint32)lastInst->getBCOffset();
                 assert(key != ILLEGAL_BC_MAPPING_VALUE);
                 assert(key != 0);
                 if (debug) {
@@ -113,6 +111,7 @@
                 const uint32 numArgs = 2;
                 Opnd* args[numArgs] = {indexOpnd, valueOpnd};
                 Inst* addValueInst = instFactory.makeJitHelperCall(opndManager.getNullOpnd(), AddValueProfileValue, numArgs, args);
+                addValueInst->setBCOffset(call->getBCOffset());
                 ((CFGInst *)addValueInst)->insertBefore(call);
                 ((CFGInst *)loadIndexInst)->insertBefore(addValueInst);
             }

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/Jitrino.cpp Fri Jul 13 07:19:35 2007
@@ -43,7 +43,6 @@
     #include <sys/types.h>
 #endif 
 
-#include "CGSupport.h"
 #include "PlatformDependant.h"
 #include "JITInstanceContext.h"
 #include "PMF.h"
@@ -242,9 +241,6 @@
         return false;
     }
 
-    MethodDesc* methDesc = cc->getVMCompilationInterface()->getMethodToCompile();
-    MemoryManager& ir_mmgr = cc->getCompilationLevelMemoryManager();
-    initHandleMap(ir_mmgr, methDesc);
 
     runPipeline(cc);
     

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeGenerator.cpp Fri Jul 13 07:19:35 2007
@@ -56,145 +56,111 @@
 #endif
 }
 
-POINTER_SIZE_INT
-InlineInfoMap::ptr_to_uint64(void *ptr)
-{
-#ifdef POINTER64
-    return (POINTER_SIZE_INT)ptr;
-#else
-    return (POINTER_SIZE_INT)ptr;
-#endif
-}
 
-Method_Handle
-InlineInfoMap::uint64_to_mh(POINTER_SIZE_INT value)
-{
-#ifdef POINTER64
-    return (Method_Handle)value;
-#else
-    return (Method_Handle)((uint32)value);
-#endif
+
+InlineInfoMap::Entry* InlineInfoMap::newEntry(Entry* parent, Method_Handle mh, uint16 bcOffset) {
+    Entry* e = new (memManager) Entry(parent, bcOffset, mh);
+    return e;
 }
 
-void
-InlineInfoMap::registerOffset(uint32 offset, InlineInfo* ii)
-{
-    assert(ii->countLevels() > 0);
-    OffsetPair pair(offset, ii);
-    list.push_back(pair);
+void InlineInfoMap::registerEntry(Entry* e, uint32 nativeOffs) {
+    entryByOffset[nativeOffs] = e;
+    for (Entry* current = e; current!=NULL; current = current->parentEntry) {
+        if (std::find(entries.begin(), entries.end(), current)!=entries.end()) {
+            assert(current!=e); //possible if inlined method has multiple entries, skip this method marker.
+        } else {
+            entries.push_back(current);
+        }
+    }
 }
 
-bool
-InlineInfoMap::isEmpty() const
-{
-    return list.size() == 0;
+
+static uint32 getIndexSize(size_t nEntriesInIndex) {
+    return (uint32)(2 * nEntriesInIndex * sizeof(uint32) + sizeof(uint32)); //zero ending list of [nativeOffset, entryOffsetInImage] pairs
 }
 
-//
-// offset_cnt ( offset depth mh[depth] )[offset_cnt]
-//
-// sizeof(offset_cnt|offset|depth|mh) = 8 
-// size increased for better portability,
-// everybody is welcome to optimize this storage
-// 
-// size = sizeof(POINTER_SIZE_INT) * (2 * offset_cnt + 1 + total_mh_cnt * 2)
-//
 uint32
-InlineInfoMap::computeSize() const
-{
-    uint32 total_mh_cnt = 0;
-    uint32 offset_cnt = 0;
-    InlineInfoList::const_iterator it = list.begin();
-    for (; it != list.end(); it++) {
-        total_mh_cnt += it->inline_info->countLevels();
-        offset_cnt++;
+InlineInfoMap::getImageSize() const {
+    if (isEmpty()) {
+        return sizeof(uint32);
     }
-    return sizeof(POINTER_SIZE_INT) * (2 * offset_cnt + 1 + total_mh_cnt * 2);
+    return getIndexSize(entryByOffset.size())   //index size
+          + entries.size() * sizeof(Entry); //all entries size;
 }
 
 void
-InlineInfoMap::write(InlineInfoPtr output)
+InlineInfoMap::write(InlineInfoPtr image)
 {
-//    assert(((uint64)ptr_to_uint64(output) & 0x7) == 0);
-
-    POINTER_SIZE_INT* ptr = (POINTER_SIZE_INT *)output;
-    *ptr++ = (POINTER_SIZE_INT)list.size(); // offset_cnt
-
-    InlineInfoList::iterator it = list.begin();
-    for (; it != list.end(); it++) {
-        *ptr++ = (POINTER_SIZE_INT) it->offset;
-        POINTER_SIZE_INT depth = 0;
-        POINTER_SIZE_INT* depth_ptr = ptr++;
-        assert(it->inline_info->countLevels() > 0);
-        InlineInfo::InlinePairList::iterator desc_it = it->inline_info->inlineChain->begin();
-        for (; desc_it != it->inline_info->inlineChain->end(); desc_it++) {
-            MethodDesc* mdesc = (MethodDesc*)(*desc_it)->first;
-            uint32 bcOffset = (uint32)(*desc_it)->second;
-            //assert(dynamic_cast<DrlVMMethodDesc*>(mdesc)); // <-- some strange warning on Win32 here
-            *ptr++ = ptr_to_uint64(mdesc->getMethodHandle());
-            *ptr++ = (POINTER_SIZE_INT)bcOffset;
-            depth++;
+    if (isEmpty()) {
+        *(uint32*)image=0;
+        return;
+    }
+
+    //write all entries first;
+    Entry*  entriesInImage = (Entry*)((char*)image + getIndexSize(entryByOffset.size()));
+    Entry*  entriesPtr = entriesInImage; 
+    for (StlVector<Entry*>::iterator it = entries.begin(), end = entries.end(); it != end; it++) {
+        Entry* e = *it;
+        *entriesPtr = *e;
+        entriesPtr++;
+    }
+    assert(((char*)entriesPtr) == ((char*)image) + getImageSize());
+
+    //now update parentEntry reference to written entries
+    for (uint32 i=0; i < entries.size(); i++) {
+        Entry* imageChild = entriesInImage + i;
+        Entry* compileTimeParent = imageChild->parentEntry;
+        if (compileTimeParent!=NULL) {
+            size_t parentIdx = std::find(entries.begin(), entries.end(), compileTimeParent) - entries.begin();
+            assert(parentIdx<entries.size());
+            Entry* imageParent = entriesInImage + parentIdx;
+            imageChild->parentEntry = imageParent;
         }
-        assert(depth == it->inline_info->countLevels());
-        *depth_ptr = depth;
     }
-    assert((POINTER_SIZE_INT)ptr == (POINTER_SIZE_INT)output + computeSize());
-}
 
-POINTER_SIZE_INT*
-InlineInfoMap::find_offset(InlineInfoPtr ptr, uint32 offset)
-{
-    assert(((POINTER_SIZE_INT)ptr_to_uint64(ptr) & 0x7) == 0);
+    //now write index header
+    uint32* header = (uint32*)image;
+    for (StlMap<uint32, Entry*>::iterator it = entryByOffset.begin(), end = entryByOffset.end(); it!=end; it++) {
+        uint32 nativeOffset = it->first;
+        Entry* compileTimeEntry = it->second;
+        size_t entryIdx = std::find(entries.begin(), entries.end(), compileTimeEntry) - entries.begin();
+        assert(entryIdx<entries.size());
+        Entry* imageEntry = entriesInImage + entryIdx;
+        *header = nativeOffset;
+        header++;
+        *header = (char*)imageEntry - (char*)image;
+        header++;
+    }
+    *header = 0;
+    header++;
+    assert((char*)header == (char*)entriesInImage);
+}
 
-    POINTER_SIZE_INT* tmp_ptr = (POINTER_SIZE_INT *)ptr;
-    POINTER_SIZE_INT offset_cnt = *tmp_ptr++;
 
-    for (uint32 i = 0; i < offset_cnt; i++) {
-        POINTER_SIZE_INT curr_offs = *tmp_ptr++ ;
-        if ( offset == curr_offs ) {
-            return tmp_ptr;
+const InlineInfoMap::Entry* InlineInfoMap::getEntryWithMaxDepth(InlineInfoPtr ptr, uint32 nativeOffs) {
+    uint32* header = (uint32*)ptr;
+    while (*header!=0) {
+        uint32 nativeOffset = *header;
+        header++;
+        uint32 entryOffset = *header;
+        header++;
+        if (nativeOffset == nativeOffs) {
+            Entry* e = (Entry*)((char*)ptr + entryOffset);
+            return e;
         }
-        POINTER_SIZE_INT curr_depth  = (*tmp_ptr++)*2 ;
-        tmp_ptr += curr_depth;
     }
-
     return NULL;
 }
 
-uint32
-InlineInfoMap::get_inline_depth(InlineInfoPtr ptr, uint32 offset)
-{
-    POINTER_SIZE_INT* tmp_ptr = find_offset(ptr, offset);
-    if ( tmp_ptr != NULL ) {
-        return (uint32)*tmp_ptr;
-    }
-    return 0;
-}
-
-Method_Handle
-InlineInfoMap::get_inlined_method(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
-{
-    POINTER_SIZE_INT* tmp_ptr = find_offset(ptr, offset);
-    if ( tmp_ptr != NULL ) {
-        POINTER_SIZE_INT depth = *tmp_ptr++;
-        assert(inline_depth < depth);
-        tmp_ptr += ((depth - 1) - inline_depth ) * 2;
-        return uint64_to_mh(*tmp_ptr);
+const InlineInfoMap::Entry* InlineInfoMap::getEntry(InlineInfoPtr ptr, uint32 nativeOffs, uint32 inlineDepth) {
+    const Entry* e = getEntryWithMaxDepth(ptr, nativeOffs);
+    while (e!=NULL) {
+        if (e->getInlineDepth() == inlineDepth) {
+            return e;
+        }
+        e = e->parentEntry;
     }
     return NULL;
-}
-
-uint16
-InlineInfoMap::get_inlined_bc(InlineInfoPtr ptr, uint32 offset, uint32 inline_depth)
-{
-    POINTER_SIZE_INT* tmp_ptr = find_offset(ptr, offset);
-    if ( tmp_ptr != NULL ) {
-        POINTER_SIZE_INT depth = *tmp_ptr++;
-        assert(inline_depth < depth);
-        tmp_ptr += ((depth - 1) - inline_depth) * 2 + 1;
-        return (uint16)(*tmp_ptr);
-    }
-    return 0;
 }
 
 

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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/CodeSelectors.cpp Fri Jul 13 07:19:35 2007
@@ -431,9 +431,11 @@
     return args;
 }
 
-void _BlockCodeSelector::genInstCode(InstructionCallback& instructionCallback,
-                                     Inst *inst, bool genConsts)
+void _BlockCodeSelector::genInstCode(InstructionCallback& instructionCallback, Inst *inst, bool genConsts) 
 {
+    uint16 bcOffset = inst->getBCOffset();
+    instructionCallback.setCurrentHIRInstBCOffset(bcOffset);
+
     if(Log::isEnabled()) {
         Log::out() << "genInstCode ";
         inst->print(Log::out());
@@ -792,8 +794,7 @@
                     inst->getDst()->getType(),
                     methodDesc,
                     getCGInst(tauNullChecked),
-                    getCGInst(tauTypesChecked),
-                    call->getInlineInfoPtr());
+                    getCGInst(tauTypesChecked));
             }
             break;
         case Op_TauVirtualCall:
@@ -812,8 +813,7 @@
                     inst->getDst()->getType(),
                     methodDesc,
                     getCGInst(tauNullChecked),
-                    getCGInst(tauTypesChecked),
-                    call->getInlineInfoPtr());
+                    getCGInst(tauTypesChecked));
             }
             break;
         case Op_IndirectCall:
@@ -825,15 +825,13 @@
                 assert(tauNullChecked->getType()->tag == Type::Tau);
                 assert(tauTypesChecked->getType()->tag == Type::Tau);
                 assert(inst->isCall());
-                CallInst * call = inst->asCallInst();
                 cgInst = 
                     instructionCallback.tau_calli(inst->getNumSrcOperands() - 3, // omit taus and fnAddr
                     genCallArgs(inst, 3), // omit taus and fnAddr
                     inst->getDst()->getType(),
                     getCGInst(fnAddr),
                     getCGInst(tauNullChecked),
-                    getCGInst(tauTypesChecked),
-                    call->getInlineInfoPtr());
+                    getCGInst(tauTypesChecked));
             }
             break;
         case Op_IndirectMemoryCall:
@@ -845,15 +843,13 @@
                 assert(tauNullChecked->getType()->tag == Type::Tau);
                 assert(tauTypesChecked->getType()->tag == Type::Tau);
                 assert(inst->isCall());
-                CallInst * call = inst->asCallInst();
                 cgInst = 
                     instructionCallback.tau_calli(inst->getNumSrcOperands() - 3, // omit taus andfnAddr
                     genCallArgs(inst, 3), // omit taus and fnAddr
                     inst->getDst()->getType(),
                     getCGInst(fnAddr),
                     getCGInst(tauNullChecked),
-                    getCGInst(tauTypesChecked),
-                    call->getInlineInfoPtr());
+                    getCGInst(tauTypesChecked));
             }
             break;
         case Op_IntrinsicCall:
@@ -2101,10 +2097,6 @@
             inst->print(Log::out());
             Log::out() << ::std::endl;
         }
-        if (irmanager.getCompilationInterface().isBCMapInfoRequired()) {
-            uint32 instID = inst->getId();
-            instructionCallback.setCurrentHIRInstrID(instID);
-        }
         genInstCode(instructionCallback, inst, !sinkConstants);
         inst = inst->getNextInst();
     }
@@ -2116,9 +2108,11 @@
         assert(sinkConstants);
         res = localOpndToCGInstMap[opnd->getId()];
         if (!res) {
+            uint16 savedBCOffset = callback->getCurrentHIRInstBCOffset();
             genInstCode(*callback, opnd->getInst(), true); // generate code for the constant
             res = localOpndToCGInstMap[opnd->getId()];
             assert(res);
+            callback->setCurrentHIRInstBCOffset(savedBCOffset);
         }
     }
     return res;
@@ -2157,18 +2151,17 @@
     // this table maps from a node's depth-first number to the 
     // node id returned by the code selector
     //
+    StlVector<MethodDesc*> inlineEndMarkers(memManager);
     uint32*    nodeMapTable = new (memManager) uint32[numNodes];
-    ::std::vector<Node*> nodes;
-    nodes.reserve(numNodes);
-
+    
     // Compute postorder list to get only reachable nodes.
-    flowGraph->getNodesPostOrder(nodes);
+    const Nodes& nodes = flowGraph->getNodesPostOrder();
 
     assert(flowGraph->getExitNode()->getTraversalNum() == flowGraph->getTraversalNum());
     Node* unwind = flowGraph->getUnwindNode();
     Node* exit = flowGraph->getExitNode();
     // Use reverse iterator to generate nodes in reverse postorder.
-    ::std::vector<Node*>::reverse_iterator niter;
+    Nodes::const_reverse_iterator niter;
     for(niter = nodes.rbegin(); niter != nodes.rend(); ++niter) {
         Node* node = *niter;
         //
@@ -2212,7 +2205,16 @@
                 cnt);
 
         } else if (node->isDispatchNode()) {
-            nodeId = callback.genDispatchNode(numInEdges,numOutEdges,cnt);
+            if(node->getSecondInst()!=NULL) {
+                for (Inst* inst = (Inst*)node->getSecondInst(); inst!=NULL; inst = inst->getNextInst()) {
+                    assert(inst->isMethodMarker());
+                    MethodMarkerInst* marker = inst->asMethodMarkerInst();
+                    assert(marker->getOpcode() == Op_MethodEnd);
+                    inlineEndMarkers.push_back(marker->getMethodDesc());
+                }
+            }
+            nodeId = callback.genDispatchNode(numInEdges,numOutEdges,inlineEndMarkers, cnt);
+            inlineEndMarkers.clear();
         }
         assert(nodeId < numNodes);
         callback.setPersistentId(nodeId, node->getId());



Mime
View raw message