harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r573295 [2/3] - in /harmony/enhanced/drlvm/trunk/vm: include/open/ jitrino/src/jet/ jitrino/src/optimizer/ jitrino/src/shared/ jitrino/src/translator/java/ jitrino/src/vm/drl/ vmcore/src/class_support/
Date Thu, 06 Sep 2007 15:24:10 GMT
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?rev=573295&r1=573294&r2=573295&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Thu Sep  6 08:24:09 2007
@@ -70,6 +70,9 @@
 EscAnalyzer::CalleeMethodInfos* EscAnalyzer::calleeMethodInfos=NULL;
 Mutex EscAnalyzer::calleeMethodInfosLock;
 
+static void logMethod(MethodPtrType* mpt);
+static void logMethod(MethodDesc* md);
+static bool isVMHelperCall(Inst* inst, CompilationInterface::RuntimeHelperId id);
 
 void
 EscapeAnalysisPass::_run(IRManager& irm) {
@@ -101,7 +104,6 @@
     do_sync_removal_sm = argSource->getBoolArg("do_sync_removal_sm",true);
     do_scalar_repl = argSource->getBoolArg("do_scalar_repl",true);
     do_esc_scalar_repl = argSource->getBoolArg("do_esc_scalar_repl",true);
-    print_scinfo = argSource->getBoolArg("sc_info",false);
     execCountMultiplier_string = argSource->getStringArg("exec_count_mult", NULL);
     ec_mult = ( execCountMultiplier_string==NULL ? 0 : atof(execCountMultiplier_string) );
     do_scalar_repl_only_final_fields_in_use = argSource->getBoolArg("do_scalar_repl_only_final_fields_in_use",false);
@@ -112,6 +114,9 @@
     translatorAction = (TranslatorAction*)PMF::getAction(argSource->getPipeline(), translatorName);
     assert(translatorAction);
 
+    shortLog = Log::isEnabled();
+    verboseLog = shortLog && argSource->isLogEnabled("escape_verbose");
+
     init();
 }
 
@@ -124,6 +129,8 @@
     debug_method = parent->debug_method;
     translatorAction  = parent->translatorAction;
     method_ea_level = parent->method_ea_level + 1;
+    shortLog = parent->shortLog;
+    verboseLog = parent->verboseLog;
 
     init();
 }
@@ -142,50 +149,6 @@
     exam2Insts = new (eaMemManager) Insts(eaMemManager);
     methodEndInsts = new (eaMemManager) Insts(eaMemManager);
     checkInsts = new (eaMemManager) Insts(eaMemManager);
-
-    _cfgirun=0;
-    _instrInfo=0;
-    _instrInfo2=0;
-    _cngnodes=0;
-    _cngedges=0;
-    _scanMtds=0;
-    _setState=0;
-    _printstat=0;
-    _eainfo=0;
-    _seinfo=0;
-    if (Log::isEnabled())
-        _scinfo = 1;
-    else
-        if (print_scinfo)
-            _scinfo=1;
-        else 
-            _scinfo=0;
-    std::fill(prsArr, prsArr + prsNum, 0);
-
-
-    int pr = allProps;
-    int prsBound[] = {1000000000,100000000,10000000,1000000,100000,10000,1000,100,10,1};
-    if (pr-prsBound[0]-prsBound[0]<0 && pr!= 0) {
-        for (int i=0; i<prsNum; i++) {
-            if (pr >= prsBound[i] && pr-prsBound[i] >= 0) {
-                prsArr[i] = 1;
-                pr -= prsBound[i];
-            }
-        }
-
-        _eainfo     = prsArr[8];
-        _seinfo     = prsArr[9];
-        if (debug_method==NULL || strcmp(debug_method,"all")==0) {
-            _cfgirun    = prsArr[0];
-            _instrInfo  = prsArr[1];
-            _instrInfo2 = prsArr[2];
-            _cngnodes   = prsArr[3];
-            _cngedges   = prsArr[4];
-            _scanMtds   = prsArr[5];
-            _setState   = prsArr[6];
-            _printstat  = prsArr[7];
-        }
-    }
 }
 
 void 
@@ -220,31 +183,8 @@
     lastCnGNodeId = 0;    // initialization of private field
     defArgNumber = -1;   // initialization of private field
 
-    if (Log::isEnabled() && debug_method!=NULL) {
-        if (strcmp(mn,debug_method)==0) {
-            _cfgirun    = prsArr[0];
-            _instrInfo  = prsArr[1];
-            _instrInfo2 = prsArr[2];
-            _cngnodes   = prsArr[3];
-            _cngedges   = prsArr[4];
-            _scanMtds   = prsArr[5];
-            _setState   = prsArr[6];
-            _printstat  = prsArr[7];
-            Log::out() << "_cfgirun     " << _cfgirun    << std::endl;
-            Log::out() << "_instrInfo   " << _instrInfo  << std::endl;
-            Log::out() << "_instrInfo2  " << _instrInfo2 << std::endl;
-            Log::out() << "_cngnodes    " << _cngnodes   << std::endl;
-            Log::out() << "_cngedges    " << _cngedges   << std::endl;
-            Log::out() << "_scanMtds    " << _scanMtds   << std::endl;
-            Log::out() << "_setState    " << _setState   << std::endl;
-            Log::out() << "_printstat   " << _printstat  << std::endl;
-            Log::out() << "_eainfo      " << _eainfo     << std::endl;
-            Log::out() << "_seinfo      " << _seinfo     << std::endl;
-            Log::out() << "_scinfo      " << _scinfo     << std::endl;
-        }
-    }
 
-    if (_eainfo || _seinfo) {
+    if (verboseLog) {
         Log::out()<<"======  doAnalysis  ====== "<<mn<<"   level: ";
         Log::out()<<method_ea_level<<"   "; 
         if (mh.isSynchronized())
@@ -266,32 +206,29 @@
 
 //  exam instructions
 
-#ifdef _DEBUG
-        if (_cfgirun) {
+        if (verboseLog) {
             Log::out() <<std::endl;
             Log::out() <<"Scan "<< cur <<"  Node ";
             FlowGraph::printLabel(Log::out(),node);
             Log::out() <<"  Id. "<<node->getId() <<std::endl;
         }
-#endif
+
 
         instrExam(node);
 
     };
 
-#ifdef _DEBUG
-    if (_cngnodes) {
+    if (verboseLog) {
         Log::out() <<"printCnGNodes: "; 
         mh.printFullName(Log::out()); 
         Log::out() << std::endl;
         printCnGNodes("First run result: nodes",Log::out());
     }
-#endif
 
     cngEdges=new (eaMemManager) CnGEdges(eaMemManager);   // Common part of connection graph (edges)
     instrExam2();
     
-    if (_cngedges) {
+    if (verboseLog) {
         Log::out() <<"printCnGEdges: "; 
         mh.printFullName(Log::out()); 
         Log::out() << std::endl;
@@ -300,14 +237,13 @@
 
     setCreatedObjectStates();
 
-    if (_eainfo) {
+    if (verboseLog) {
         printCreatedObjectsInfo(Log::out());
     }
 
     saveScannedMethodInfo();    // to save states of contained obj, if needed
 
-#ifdef _DEBUG
-    if (_cngedges) {
+    if (verboseLog) {
         Log::out() << "++++++++++++++ printRefInfo()    ";
         mh.printFullName(Log::out());
         Log::out() << std::endl;
@@ -316,9 +252,8 @@
         mh.printFullName(Log::out());
         Log::out() << std::endl;
     }
-#endif
 
-    if (_cngnodes) {
+    if (verboseLog) {
         Log::out() <<"printCnGNodes: "; 
         mh.printFullName(Log::out()); 
         Log::out() << std::endl;
@@ -326,7 +261,7 @@
     }
 
     if (method_ea_level == 0) {  
-        createdObjectInfo();     // prints if _printstat==1
+        createdObjectInfo();     // prints if verboseLog
     }
 
     if (method_ea_level == 0) {
@@ -341,14 +276,12 @@
                 eaFixupVars(irManager);
             }
         }
-#ifdef _DEBUG
-        if (_seinfo && Log::isEnabled()) {
+        if (verboseLog && Log::isEnabled()) {
             printCreatedObjectsInfo(Log::out());
         }
-#endif
     }
 
-    if (_eainfo || _seinfo) {
+    if (verboseLog) {
         Log::out()<<"======  doAnalysis  ====== "<<mn<<"   level: ";
         Log::out()<<method_ea_level<<"   end   "; 
         if (mh.isSynchronized())
@@ -359,45 +292,31 @@
         Log::out()<< std::endl;
     }
 
-    if (Log::isEnabled() && debug_method!=NULL) {
-        if (strcmp(mn,debug_method)==0) {
-            _cfgirun    = 0;
-            _instrInfo  = 0;
-            _instrInfo2 = 0;
-            _cngnodes   = 0;
-            _cngedges   = 0;
-            _scanMtds   = 0;
-            _setState   = 0;
-            _printstat  = 0;
-        }
-    }
-
     return;
 }  // doAnalysis() 
 
-
 void 
 EscAnalyzer::instrExam(Node* node) {
-    Inst *headInst = (Inst*)node->getFirstInst();
-    int insnum=0;
-    Type* type;
-    CnGNode* cgnode;
-    uint32 ntype=0;
-    MethodDesc* md;
-    uint32 n;
-    bool addinst;
-    Inst* method_inst;
+    TypeManager& typeManager = irManager.getTypeManager();
+    int insnum = 0;
 
-    for (Inst* inst=headInst->getNextInst();inst!=NULL;inst=inst->getNextInst()) {
+    if (shortLog) {
+        Log::out() <<"instrExam: Checking node: "; FlowGraph::printLabel(Log::out(), node); 
+        Log::out()<<" dfNum="<<node->getDfNum()<<std::endl;
+    }
+
+    for (Inst* inst=(Inst*)node->getSecondInst();inst!=NULL;inst=inst->getNextInst()) {
         insnum++;
-        ntype=0;
-        if (_instrInfo) {
-            Log::out() <<"instrExam:" << std::endl;
-            Log::out() <<"++Node Id."<<node->getId()<<"  "<<node->getDfNum()<<std::endl;
-            Log::out() <<"instrExam++Node Id."<<node->getId()<<"  "<<node->getDfNum()<<std::endl;
-            Log::out() << "==";
-            inst->print(Log::out()); 
-            Log::out() << std::endl;
+        
+        Type* type = NULL;
+        CnGNode* cgnode = NULL;
+        uint32 ntype=0;
+        MethodPtrType* methType = NULL;
+        uint32 n = 0;
+        bool addinst = false;
+        Inst* method_inst = NULL;
+        if (shortLog) {
+            Log::out() <<"Checking inst:";  debug_inst_info(inst,Log::out());
         }
 
         switch (inst->getOpcode()) {
@@ -414,12 +333,6 @@
                     ntype=NT_DEFARG;    // for Op_DefArg
                     defArgNumber++;
                 }
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 if (inst->getDst()->getType()->isObject()) {
                     type=inst->getDst()->getType();
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -428,12 +341,6 @@
                 break;
 
             case Op_Conv:     // conv
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif                
                 if (inst->getDst()->getType()->isObject()) {
                     type=inst->getDst()->getType();
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -441,74 +348,31 @@
                 }
                 break;                
 
+            case Op_AddOffset: // used to get non-static field addr in lazy resolution mode.
             case Op_LdFieldAddr:     // ldflda
-                ntype=NT_INSTFLD;
             case Op_LdStaticAddr:    // ldsflda
-                if (ntype==0)
-                    ntype=NT_STFLD;    // for LdStaticAddr
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-                FieldAccessInst* fainst;
-                if ((fainst=inst->asFieldAccessInst())!=NULL) {
-                    type=fainst->getFieldDesc()->getFieldType();  //field type
-                    if (type->isReference()) {
+                instrExam_processLdFieldAddr(inst);
+                break;
+            case Op_TauLdInd:        // ldind
+                {
+                    type = inst->getDst()->getType();
+                    if (type->isReference()) {   //isObject()) {
                         assert(findCnGNode_op(inst->getDst()->getId())==NULL);
-                        cgnode = addCnGNode_op(inst,type,NT_REF);
-                        CnGNode* n = findCnGNode_fl(inst,ntype);
-                        if (n==NULL) {
-                            n = addCnGNode_fl(inst,ntype);
-                        }
-                        cgnode->lNode=n;   // stick nodes 
+                        cgnode = addCnGNode_op(inst,type,NT_LDOBJ);
+                        exam2Insts->push_back(inst);
+                    }
+                    if (inst->getSrc(0)->getInst()->getOpcode()==Op_LdStaticAddr)
+                        break;
+                    if (type->isValue()) {
+                        assert(findCnGNode_op(inst->getDst()->getId())==NULL);
+                        cgnode = addCnGNode_op(inst,type,NT_LDVAL);
                         exam2Insts->push_back(inst);
-                    } else {
-                        if (ntype==NT_INSTFLD) {
-                            assert(findCnGNode_op(inst->getDst()->getId())==NULL);
-                            cgnode = addCnGNode_op(inst,type,NT_REF);
-                            CnGNode* n = findCnGNode_fl(inst,ntype);
-                            if (n==NULL) {
-                                n = addCnGNode_fl(inst,ntype);
-                            }
-                            exam2Insts->push_back(inst);
-                            cgnode->lNode=n;   // stick nodes 
-                        }
                     }
-                }
-                break;
-
-            case Op_TauLdInd:        // ldind
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-                type = inst->getDst()->getType();
-                if (type->isReference()) {   //isObject()) {
-                    assert(findCnGNode_op(inst->getDst()->getId())==NULL);
-                    cgnode = addCnGNode_op(inst,type,NT_LDOBJ);
-                    exam2Insts->push_back(inst);
-                }
-                if (inst->getSrc(0)->getInst()->getOpcode()==Op_LdStaticAddr)
-                    break;
-                if (type->isValue()) {
-                    assert(findCnGNode_op(inst->getDst()->getId())==NULL);
-                    cgnode = addCnGNode_op(inst,type,NT_LDVAL);
-                    exam2Insts->push_back(inst);
                 }
                 break;
 
             case Op_LdArrayBaseAddr: // ldbase
             case Op_AddScaledIndex:  // addindex
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 if (inst->getDst()->getType()->isReference()) {
                     type=inst->getDst()->getType();
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -518,52 +382,30 @@
                 break;
 
             case Op_VMHelperCall:      // callvmhelper
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-                if (!inst->getDst()->isNull()) {
-                    if (inst->getDst()->getType()->isObject()) {
-                        CompilationInterface::RuntimeHelperId  callId = 
-                            inst->asVMHelperCallInst()->getVMHelperId();
-                        switch(callId) {
-                            case CompilationInterface::Helper_GetTLSBase:
-                                ntype = NT_ARRELEM;
-                                break;
-                            case CompilationInterface::Helper_NewObj_UsingVtable:
-                            case CompilationInterface::Helper_NewVector_UsingVtable:
-                                ntype = NT_OBJECT;
-                                break;
-                            default:
-                                ntype = 0;
-                                assert(0);
-                        }
-                        type=inst->getDst()->getType();
-                        assert(findCnGNode_op(inst->getDst()->getId())==NULL);
-                        cgnode = addCnGNode_op(inst,type,ntype);
-                    }
-                }
-#ifdef _DEBUG 
-                if (_seinfo) {
-                    CompilationInterface::RuntimeHelperId  callId = 
-                        inst->asVMHelperCallInst()->getVMHelperId();
-                    if (method_ea_level == 0 && callId != CompilationInterface::Helper_Throw_Lazy) {
-
-                        Log::out() <<"iE:        callvmhelper    ";
-                        inst->print(Log::out()); 
-                        Log::out()<<std::endl;
+                {
+                    CompilationInterface::RuntimeHelperId  callId = inst->asVMHelperCallInst()->getVMHelperId();
+                    switch(callId) {
+                        case CompilationInterface::Helper_GetStaticFieldAddrWithResolve: 
+                            instrExam_processLdFieldAddr(inst);
+                            break;
+                        case CompilationInterface::Helper_CheckCastWithResolve:
+                            assert(findCnGNode_op(inst->getDst()->getId())==NULL);
+                            addCnGNode_op(inst,inst->getDst()->getType(), NT_REF);
+                            exam2Insts->push_back(inst);
+                            break;
+                        case CompilationInterface::Helper_NewObjWithResolve: 
+                        case CompilationInterface::Helper_NewArrayWithResolve:
+                        case CompilationInterface::Helper_NewMultiArray:
+                            assert(findCnGNode_op(inst->getDst()->getId())==NULL);
+                            addCnGNode_op(inst,inst->getDst()->getType(), NT_OBJECT);
+                            break;
+                        default:
+                            break;
                     }
                 }
-#endif
                 break;
-
             case Op_JitHelperCall:      // calljithelper
                 if (method_ea_level == 0) {
-                    Log::out() <<"iE:        calljithelper    ";
-                    inst->print(Log::out()); 
-                    Log::out()<<std::endl;
                     switch(inst->asJitHelperCallInst()->getJitHelperId()) {
                         case InitializeArray:
                         case FillArrayWithConst:
@@ -579,24 +421,15 @@
                 break;
 
             case Op_TauStInd:        // stind    
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-                if ((type=inst->getSrc(0)->getType())->isObject() || type->isValue()) {
-                    exam2Insts->push_back(inst);
+                {
+                    type=inst->getSrc(0)->getType();
+                    if (type->isObject() || type->isValue()) {
+                        exam2Insts->push_back(inst);
+                    }
                 }
                 break;
 
             case Op_DirectCall:      // call
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 if (!inst->getDst()->isNull()) {
                     if (inst->getDst()->getType()->isObject()) {
                         type=inst->getDst()->getType();
@@ -604,48 +437,31 @@
                         cgnode = addCnGNode_op(inst,type,NT_RETVAL);
                     }
                 }
-                md=inst->asMethodInst()->getMethodDesc();
-                n=md->getNumParams();
+                methType = typeManager.getMethodPtrType(inst->asMethodInst()->getMethodDesc());
+                assert(methType!=NULL);
+                n=methType->getNumParams();
                 addinst=false;
                 for (uint32 i = 0; i < n; i++) {
-                    Type* tt = md->getParamType(i);
+                    Type* tt = methType->getParamType(i);
                     if (!tt->isReference()) {
                         continue;
                     }
                     addinst=true;
                     assert(findCnGNode_mp(inst->getId(),i)==NULL);
-                    cgnode = addCnGNode_mp(inst,md,NT_ACTARG, i);
+                    cgnode = addCnGNode_mp(inst, methType, NT_ACTARG, i);
                 }
                 if (addinst) {
                     exam2Insts->push_back(inst);
                 }
-#ifdef _DEBUG  
-                if (_seinfo) {
+                if (verboseLog) {
                     if (method_ea_level == 0) {
                         Log::out() <<"iE:        call        ";
-                        if (md->isSynchronized())
-                            Log::out() << "sync   "; 
-                        if (md->isStatic())
-                            Log::out() << "stat   ";
-                        if (md->isNative())
-                            Log::out() << "native   ";
-                        inst->print(Log::out()); 
-                        Log::out()<<std::endl;
-                        Log::out() << "           ";
-                        md->printFullName(Log::out()); 
-                        Log::out() << std::endl;
+                        logMethod(methType);
                     }
                 }
-#endif
                 break;
 
             case Op_IndirectMemoryCall:  //callimem
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 if (!inst->getDst()->isNull()) {
                     if (inst->getDst()->getType()->isObject()) {
                         type=inst->getDst()->getType();
@@ -655,55 +471,38 @@
                 }
                 method_inst=inst->getSrc(0)->getInst();
                 if (method_inst->getOpcode() == Op_LdVar) {
-                    Opnd* funptr = inst->getSrc(0);
-                    Type* optype = funptr->getType();
-                    MethodPtrType* opmtype = optype->asMethodPtrType();
-                    md = opmtype->getMethodDesc();
+                    methType = inst->getSrc(0)->getType()->asMethodPtrType();
+                } else if (method_inst->asMethodInst()!=NULL) {
+                    methType = typeManager.getMethodPtrType(method_inst->asMethodInst()->getMethodDesc());
                 } else {
-                    md=method_inst->asMethodInst()->getMethodDesc();
+                    assert(method_inst->isVMHelperCallInst()); //lazy resolution helper
+                    methType = inst->getSrc(0)->getType()->asMethodPtrType();
                 }
-                n=md->getNumParams();
+                assert(methType!=NULL);
+                
+                n=methType->getNumParams();
                 addinst=false;
                 for (uint32 i = 0; i < n; i++) {
-                    Type* tt = md->getParamType(i);
+                    Type* tt = methType->getParamType(i);
                     if (!tt->isReference()) {
                         continue;
                     }
                     addinst=true;
                     assert(findCnGNode_mp(inst->getId(),i)==NULL);
-                    cgnode = addCnGNode_mp(inst,md,NT_ACTARG,i);
+                    cgnode = addCnGNode_mp(inst, methType, NT_ACTARG, i);
                 }
                 if (addinst) {
                     exam2Insts->push_back(inst);
                 }
-#ifdef _DEBUG 
-                if (_seinfo) {
+
+                if (verboseLog) {
                     if (method_ea_level == 0) {
-                        Log::out() <<"iE:        callimem    ";
-                        if (md->isSynchronized())
-                            Log::out() << "sync   "; 
-                        if (md->isStatic())
-                            Log::out() << "stat   ";
-                        if (md->isNative())
-                            Log::out() << "native   ";
-                        inst->print(Log::out()); 
-                        Log::out()<<std::endl;
-                        Log::out() << "           ";
-                        md->printFullName(Log::out()); 
-                        Log::out() << std::endl;
+                        logMethod(methType);
                     }
                 }
-#endif
                 break;
 
             case Op_IntrinsicCall:   // callintr
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-
                 if (!inst->getDst()->isNull()) {
                     assert(0);
                 }
@@ -720,39 +519,18 @@
                 if (addinst) {
                     exam2Insts->push_back(inst);
                 }
-
-#ifdef _DEBUG 
-                if (_seinfo) {
-                    if (method_ea_level == 0) {
-                        Log::out() <<"iE:        callintr    ";
-                        inst->print(Log::out()); 
-                        Log::out()<<std::endl;
-                    }
-                }
-#endif
                 break;
 
             case Op_Catch:           // catch
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
-                if (inst->getDst()->getType()->isObject()) {
-                    type=inst->getDst()->getType();
+                type = inst->getDst()->getType();
+                if (type->isObject()) {
+                    assert(!type->isUnresolvedType());
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
                     cgnode = addCnGNode_op(inst,type,NT_CATCHVAL);
                 }
                 break;
 
             case Op_StVar:           // stvar
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 type = inst->getDst()->getType();
                 if (type->isObject()) {
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -762,12 +540,6 @@
                 break;
 
             case Op_Phi:             // phi
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 type = inst->getDst()->getType();
                 if (type->isReference()) {
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -777,12 +549,6 @@
                 break;
 
             case Op_LdVar:             // ldvar
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 type = inst->getDst()->getType();
                 if (type->isReference()) {
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -794,16 +560,11 @@
             case Op_Return:          // return     
                 ntype=NT_EXITVAL;
             case Op_Throw:           // throw
-                if (ntype==0)
+                if (ntype==0) 
                     ntype=NT_THRVAL;
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 if (inst->getNumSrcOperands()>0) {
-                    if (inst->getSrc(0)->getType()->isObject()) {
+                    type = inst->getSrc(0)->getType();
+                    if (type->isObject()) {
                         assert(findCnGNode_in(inst->getId())==NULL);
                         cgnode = addCnGNode_ex(inst,ntype);
                         exam2Insts->push_back(inst);
@@ -813,12 +574,6 @@
 
             case Op_TauStaticCast:   // staticcast
             case Op_TauCast:         // cast
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 type = inst->getDst()->getType();
                 if (type->isObject()) {
                     assert(findCnGNode_op(inst->getDst()->getId())==NULL);
@@ -828,12 +583,6 @@
                 break;
 
             case Op_SaveRet:           // saveret
-#ifdef _DEBUG
-                if (_instrInfo) {
-                    Log::out() <<"Node Id."<<node->getId()<<std::endl;
-                    debug_inst_info(inst,Log::out()); 
-                }
-#endif
                 type = inst->getDst()->getType();
                 if (type->isIntPtr()) {
                     cgnode = findCnGNode_op(inst->getDst()->getId());
@@ -846,14 +595,6 @@
             case Op_TauMonitorExit:  // monexit
                 if (do_sync_removal && method_ea_level == 0) {
                     addMonInst(inst);
-#ifdef _DEBUG
-                    if (_seinfo) {
-                        Log::out() << "iE: monX  Node Id."
-                            << node->getId() << "  ";
-                        inst->print(Log::out()); 
-                        Log::out()<<std::endl;
-                    }
-#endif
                 }
                 break;
 
@@ -871,123 +612,181 @@
             case Op_Copy:       
 
             case Op_Box:
-
-                if (_instrInfo) {
-                    Log::out() <<"--Node Id."<<node->getId()<<std::endl;
-                    Log::out() << "    =="; 
-                    inst->print(Log::out()); 
-                    Log::out() << std::endl;
-                }
                 break;
 
             default:
-
-                if (_instrInfo) {
-                    Log::out() <<"~~Node Id."<<node->getId()<<std::endl;
-                    Log::out() << "    =="; 
-                    inst->print(Log::out()); 
-                    Log::out() << std::endl;
-                }
+                break;
         }
     }
     return;
 }  // instrExam(Node* node) 
 
 
+void EscAnalyzer::getLdFieldAddrInfo(Inst* inst, Type*& type, uint32& nType) {
+    type = NULL;
+    nType = 0;
+    if (inst->getOpcode() == Op_LdFieldAddr || inst->getOpcode() == Op_LdStaticAddr) {
+        FieldAccessInst* fainst = inst->asFieldAccessInst();
+        type = fainst->getFieldDesc()->getFieldType();
+        nType = inst->getOpcode() == Op_LdFieldAddr ?  NT_INSTFLD : NT_STFLD;
+    } else {
+        if (inst->getOpcode() == Op_AddOffset) {
+            nType = NT_INSTFLD;
+        } else {
+            assert(isVMHelperCall(inst, CompilationInterface::Helper_GetStaticFieldAddrWithResolve));
+            nType = NT_STFLD;
+        }
+        assert(inst->getDst()->getType()->isManagedPtr());
+        type = inst->getDst()->getType()->asPtrType()->getPointedToType();
+    }
+    assert(type!=NULL && nType!=0);
+}
+
+void  EscAnalyzer::instrExam_processLdFieldAddr(Inst* inst) {
+    Type* type = NULL;
+    uint32 nType = 0;
+    getLdFieldAddrInfo(inst, type, nType);
+    if (type->isReference() || nType==NT_INSTFLD) {
+        assert(findCnGNode_op(inst->getDst()->getId())==NULL);
+        CnGNode* cgnode = addCnGNode_op(inst,type,NT_REF);
+        CnGNode* n = findCnGNode_fl(inst,nType);
+        if (n==NULL) {
+            n = addCnGNode_fl(inst,nType);
+        }
+        cgnode->lNode=n;   // stick nodes 
+        exam2Insts->push_back(inst);
+    } 
+}
+
+void 
+EscAnalyzer::instrExam2_processLdFieldAddr(Inst* inst) {
+    Type* type = NULL;
+    uint32 nType = 0;
+    getLdFieldAddrInfo(inst, type, nType);
+
+    bool isref = type->isReference();
+    if (isref || nType==NT_INSTFLD) {
+        assert(!isref || findCnGNode_op(inst->getDst()->getId()));
+        if (nType == NT_INSTFLD) {
+            CnGNode* cgnode=findCnGNode_fl(inst,nType);    //  field node
+            assert(cgnode!=NULL);
+            CnGNode* cgn_src=findCnGNode_op(inst->getSrc(0)->getId());  // instance node
+            assert(cgn_src!=NULL);
+            //  adding fld edge for ldflda
+            addEdge(cgn_src,cgnode,ET_FIELD,inst);
+
+            // special for java/lang/String::value
+            if (inst->asFieldAccessInst()!=NULL) {
+                FieldDesc* fd=inst->asFieldAccessInst()->getFieldDesc();
+                if (fd->getParentType()->isSystemString()&&strcmp(fd->getName(),"value")==0) {
+                    addEdge(cgnode,cgn_src,ET_DEFER,inst);
+                }
+                if (method_ea_level == 0 && cgn_src->nInst->getOpcode()==Op_NewObj) {
+                    //fail if instance type is not compatible with 
+                    //store/load type. Incompatibility can be the result of not cleaned dead code.
+                    //see HARMONY-4115 for details.
+                    Inst* instantceInst = cgn_src->nInst;
+                    ObjectType* instanceType = instantceInst->asTypeInst()->getTypeInfo()->asObjectType();
+                    assert(instanceType!=NULL);
+                    ObjectType* fieldObjectType = fd->getParentType()->asObjectType();
+                    assert(fieldObjectType!=NULL);
+                    if (!instanceType->isSubClassOf(fieldObjectType)) {
+                        if (shortLog) {
+                            Log::out()<<"FAILURE: instance type: "<<instanceType->getName();
+                            Log::out()<<" is not compatible with field object type: "<<fieldObjectType->getName()<<std::endl;
+                            Log::out()<<"Instance inst: ";instantceInst->print(Log::out());
+                            Log::out()<<" field inst: ";inst->print(Log::out()); Log::out()<<std::endl;
+                        }
+                        assert(0);
+                        Jitrino::crash("Jitrino failure:escape: illegal HIR sequence");
+                    }
+                }
+            }
+        }
+    }
+}
+
 void 
 EscAnalyzer::instrExam2() {
+    TypeManager& typeManager = irManager.getTypeManager();
     Insts *instrs = exam2Insts;
     int insnum=0;
-    Insts::iterator it;
     Inst* inst;
-    Type* type;
-    CnGNode* cgnode;
-    CnGNode* cgn_src;
-    uint32 ntype=0;
-    MethodDesc* md;
-    uint32 n;
-    Inst* method_inst;
-    bool not_exam = false;
+    Insts::iterator it;
 
     for (it = instrs->begin( ); it != instrs->end( ); it++ ) {
         inst=*it;
         insnum++;
-        ntype=0;
 
-#ifdef _DEBUG
-        if (_instrInfo2) {
-            Log::out() <<"instrExam2:  Node Id."<<inst->getNode()->getId()<< " ";
-            FlowGraph::printLabel(Log::out(),inst->getNode()); Log::out() << std::endl;
-            inst->print(Log::out()); Log::out() << std::endl;
+        Type* type = NULL;
+        CnGNode* cgnode = NULL;
+        CnGNode* cgn_src = NULL;
+        uint32 ntype=0;
+        MethodPtrType* methType = NULL;
+        uint32 n = 0;
+        Inst* method_inst = NULL;
+        bool not_exam = false;
+
+
+        if (shortLog) {
+            Node * node = inst->getNode();
+            Log::out() <<"instrExam2: node: "; FlowGraph::printLabel(Log::out(), node); 
+            Log::out()<<" dfNum="<<node->getDfNum()<<std::endl;
+            Log::out() <<"inst :";  inst->print(Log::out());  Log::out() << std::endl;
         }
-#endif
 
         switch (inst->getOpcode()) {
-            case Op_LdFieldAddr:     // ldflda
-                ntype=NT_INSTFLD;
-            case Op_LdStaticAddr:    // ldsflda
-                if (ntype==0)
-                    ntype=NT_STFLD;    // for LdStaticAddr
-                FieldAccessInst* fainst;
-                if ((fainst=inst->asFieldAccessInst())!=NULL) {
-                    bool isref = fainst->getFieldDesc()->getFieldType()->isReference();
-                    if (isref || ntype==NT_INSTFLD) {
-                        cgn_src=findCnGNode_op(inst->getDst()->getId());  //  field address node
-                        if (isref)
-                            assert(cgn_src!=NULL);
-                        cgnode=findCnGNode_fl(inst,ntype);    //  field node
-                        assert(cgnode!=NULL);
-                        if (ntype == NT_INSTFLD) {
-                            cgn_src=findCnGNode_op(inst->getSrc(0)->getId());  // instance node
-                            //  adding fld edge for ldflda
-                            addEdge(cgn_src,cgnode,ET_FIELD,inst);
-                            // special for java/lang/String::value
-                            FieldDesc* fd=inst->asFieldAccessInst()->getFieldDesc();
-                            if (fd->getParentType()->isSystemString()&&strcmp(fd->getName(),"value")==0) {
-                                addEdge(cgnode,cgn_src,ET_DEFER,inst);
-                            }
-                            if (method_ea_level == 0 && cgn_src->nInst->getOpcode()==Op_NewObj) {
-                                //fail if instance type is not compatible with 
-                                //store/load type. Incompatibility can be the result of not cleaned dead code.
-                                //see HARMONY-4115 for details.
-                                Inst* instantceInst = cgn_src->nInst;
-                                ObjectType* instanceType = instantceInst->asTypeInst()->getTypeInfo()->asObjectType();
-                                assert(instanceType!=NULL);
-                                ObjectType* fieldObjectType = fd->getParentType()->asObjectType();
-                                assert(fieldObjectType!=NULL);
-                                if (!instanceType->isSubClassOf(fieldObjectType)) {
-                                    if (Log::isEnabled()) {
-                                        Log::out()<<"FAILURE: instance type: "<<instanceType->getName();
-                                        Log::out()<<" is not compatible with field object type: "<<fieldObjectType->getName()<<std::endl;
-                                        Log::out()<<"Instance inst: ";instantceInst->print(Log::out());
-                                        Log::out()<<" field inst: ";inst->print(Log::out()); Log::out()<<std::endl;
+                case Op_AddOffset:
+                case Op_LdFieldAddr:
+                case Op_LdStaticAddr:
+                    instrExam2_processLdFieldAddr(inst);
+                    break;
+                case Op_VMHelperCall:
+                    {
+                        CompilationInterface::RuntimeHelperId helperId = inst->asVMHelperCallInst()->getVMHelperId();
+                        switch(helperId) {
+                            case CompilationInterface::Helper_GetStaticFieldAddrWithResolve:
+                                instrExam2_processLdFieldAddr(inst);
+                                break;
+                            case CompilationInterface::Helper_CheckCastWithResolve:
+                                {   //handling is equal to taucheckcast
+                                    cgnode = findCnGNode_op(inst->getDst()->getId());
+                                    assert(cgnode!=NULL);
+                                    if (cgnode->lNode == NULL) {
+                                        cgn_src=findCnGNode_op(inst->getSrc(2)->getId());
+                                        assert(cgn_src!=NULL);
+                                        cgnode->lNode = cgn_src;
                                     }
-                                    assert(0);
-                                    Jitrino::crash("Jitrino failure:escape: illegal HIR sequence");
                                 }
-                            }
+                            default: break;
                         }
                     }
-                }
-                break;
+                    break;
+                case Op_TauLdInd:        // ldind
+                {
+                    type=inst->getDst()->getType();
+                    if (type->isObject()) {
+                        cgnode=findCnGNode_op(inst->getDst()->getId());
+                        assert(cgnode!=NULL);
+                        // ref to loaded object
+                        cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
+                        assert(cgn_src!=NULL);
+                        addEdge(cgn_src,cgnode,ET_POINT,inst);  
+                    }
+                    if (type->isValue()) {
+                        Inst* srcInst = inst->getSrc(0)->getInst();
+                        uint32 src_opcode = srcInst->getOpcode();
+                        if (src_opcode==Op_LdStaticAddr || isVMHelperCall(srcInst, CompilationInterface::Helper_GetStaticFieldAddrWithResolve)) {
+                            break;
+                        }
 
-            case Op_TauLdInd:        // ldind
-                type=inst->getDst()->getType();
-                if (type->isObject()) {
-                    cgnode=findCnGNode_op(inst->getDst()->getId());
-                    assert(cgnode!=NULL);
-                    // ref to loaded object
-                    cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
-                    assert(cgn_src!=NULL);
-                    addEdge(cgn_src,cgnode,ET_POINT,inst);  
-                }
-                if (type->isValue()) {
-                    cgnode=findCnGNode_op(inst->getDst()->getId());
-                    assert(cgnode!=NULL);
-                    // ref to loaded object
-                    cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
-                    assert(cgn_src!=NULL);
-                    addEdge(cgn_src,cgnode,ET_POINT,inst);  
+                        cgnode=findCnGNode_op(inst->getDst()->getId());
+                        assert(cgnode!=NULL);
+                        // ref to loaded object
+                        cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
+                        assert(cgn_src!=NULL);
+                        addEdge(cgn_src,cgnode,ET_POINT,inst);  
+                    }
                 }
                 break;
 
@@ -1013,40 +812,47 @@
                 }
                 break;
 
-            case Op_TauStInd:        // stind    
-                if (inst->getSrc(0)->getType()->isObject()) {
-                    // ref to loaded address
-                    cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
-                    assert(cgn_src!=NULL);
-                    cgnode=findCnGNode_op(inst->getSrc(1)->getId());
-                    assert(cgnode!=NULL);
-                    addEdge(cgnode,cgn_src,ET_DEFER,inst); 
-                    break;
-                }
-                if ((type=inst->getSrc(0)->getType())->isValue()) {
-                    uint32 src_opcode = inst->getSrc(1)->getInst()->getOpcode();
-                    if (src_opcode==Op_LdStaticAddr)
+            case Op_TauStInd:        // stind 
+                {
+                    type = inst->getSrc(0)->getType();
+                    if (type->isObject()) {
+                        // ref to loaded address
+                        cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
+                        assert(cgn_src!=NULL);
+                        cgnode=findCnGNode_op(inst->getSrc(1)->getId());
+                        assert(cgnode!=NULL);
+                        addEdge(cgnode,cgn_src,ET_DEFER,inst); 
                         break;
-                    cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
-                    if (cgn_src==NULL) {
-                        cgn_src = addCnGNode_op(inst->getSrc(0)->getInst(),type,NT_LDVAL);
                     }
-                    cgnode=findCnGNode_op(inst->getSrc(1)->getId());
-                    assert(cgnode!=NULL);
-                    addEdge(cgnode,cgn_src,ET_DEFER,inst); 
+                    if (type->isValue()) {
+                        Inst* srcInst = inst->getSrc(1)->getInst();
+                        uint32 src_opcode = srcInst->getOpcode();
+                        if (src_opcode==Op_LdStaticAddr  || isVMHelperCall(srcInst, CompilationInterface::Helper_GetStaticFieldAddrWithResolve)) {
+                            break;
+                        }
+                        cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
+                        if (cgn_src==NULL) {
+                            cgn_src = addCnGNode_op(inst->getSrc(0)->getInst(),type,NT_LDVAL);
+                        }
+                        cgnode=findCnGNode_op(inst->getSrc(1)->getId());
+                        assert(cgnode!=NULL);
+                        addEdge(cgnode,cgn_src,ET_DEFER,inst); 
+                    }
                 }
                 break;
 
             case Op_DirectCall:      // call
-                md=inst->asMethodInst()->getMethodDesc();
-                n=md->getNumParams();
+                methType = typeManager.getMethodPtrType(inst->asMethodInst()->getMethodDesc());
+                n = methType->getNumParams();
                 for (uint32 i = 0; i < n; i++) {
-                    Type* tt = md->getParamType(i);
-                    if (!tt->isReference()) 
+                    Type* tt = methType->getParamType(i);
+                    if (!tt->isReference())  {
                         continue;
+                    }
                     cgnode=findCnGNode_mp(inst->getId(),i);
                     assert(cgnode!=NULL);
-                    cgn_src=findCnGNode_op(inst->getSrc(2+i)->getId());
+                    Opnd* param = inst->getSrc(2+i);
+                    cgn_src=findCnGNode_op(param->getId());
                     assert(cgn_src!=NULL);
                     addEdge(cgnode,cgn_src,ET_DEFER,inst); 
                 }
@@ -1055,19 +861,24 @@
             case Op_IndirectMemoryCall:  //callimem
                 method_inst=inst->getSrc(0)->getInst();
                 if (method_inst->getOpcode() == Op_LdVar) {
-                    MethodPtrType* mpt = inst->getSrc(0)->getType()->asMethodPtrType();
-                    md = mpt->getMethodDesc();
+                    methType = inst->getSrc(0)->getType()->asMethodPtrType();
+                } else if (method_inst->asMethodInst()!=NULL) {
+                    methType = typeManager.getMethodPtrType(method_inst->asMethodInst()->getMethodDesc());
                 } else {
-                    md=method_inst->asMethodInst()->getMethodDesc();
+                    assert(method_inst->isVMHelperCallInst()); //lazy resolution helper
+                    methType = inst->getSrc(0)->getType()->asMethodPtrType();
                 }
-                n=md->getNumParams();
+                assert(methType!=NULL);
+                n = methType->getNumParams();
                 for (uint32 i = 0; i < n; i++) {
-                    Type* tt = md->getParamType(i);
-                    if (!tt->isReference()) 
+                    Type* tt = methType->getParamType(i);
+                    if (!tt->isReference()) {
                         continue;
+                    }
                     cgnode = findCnGNode_mp(inst->getId(),i);
                     assert(cgnode!=NULL);
-                    cgn_src=findCnGNode_op(inst->getSrc(3+i)->getId());
+                    Opnd* param = inst->getSrc(3+i);
+                    cgn_src=findCnGNode_op(param->getId());
                     assert(cgn_src!=NULL);
                     addEdge(cgnode,cgn_src,ET_DEFER,inst); 
                 }
@@ -1083,8 +894,10 @@
                          cgn_src = findCnGNode_op(inst->getSrc(2)->getId());
                          assert(cgn_src!=NULL);
                          addEdge(cgnode,cgn_src,ET_DEFER,inst);
-                    Log::out() << "need to add edge from "<< cgnode->cngNodeId << " - " << cgnode->opndId << " to "
-                        << cgn_src->cngNodeId << " - " << cgn_src->opndId << std::endl;
+                         if (verboseLog) {
+                             Log::out() << "need to add edge from "<< cgnode->cngNodeId << " - " << cgnode->opndId << " to "
+                                 << cgn_src->cngNodeId << " - " << cgn_src->opndId << std::endl;
+                         }
                          break;
                     default:
                          assert(0);
@@ -1092,7 +905,8 @@
                 break;
 
             case Op_StVar:           // stvar
-                if (inst->getDst()->getType()->isObject()) {
+                type = inst->getDst()->getType();
+                if (type->isObject()) {
                     cgnode = findCnGNode_op(inst->getDst()->getId());
                     assert(cgnode!=NULL);
                     cgn_src=findCnGNode_op(inst->getSrc(0)->getId());
@@ -1102,12 +916,14 @@
                 break;
 
             case Op_Phi:             // phi
-                if (inst->getDst()->getType()->isObject()) {
+                type = inst->getDst()->getType();
+                if (type->isObject()) {
                     uint32 nsrc=inst->getNumSrcOperands();
                     cgnode = findCnGNode_op(inst->getDst()->getId());
                     assert(cgnode!=NULL);
                     for (uint32 i=0; i<nsrc; i++) {
-                        cgn_src=findCnGNode_op(inst->getSrc(i)->getId());
+                        Opnd* srcOpnd = inst->getSrc(i);
+                        cgn_src=findCnGNode_op(srcOpnd->getId());
                         assert(cgn_src!=NULL);
                         addEdge(cgn_src,cgnode,ET_DEFER,inst);
                     }
@@ -1141,7 +957,6 @@
 
             case Op_TauStaticCast:   // staticcast
             case Op_TauCast:         // cast
-                type = inst->getDst()->getType();
                 cgnode = findCnGNode_op(inst->getDst()->getId());
                 assert(cgnode!=NULL);
                 if (cgnode->lNode == NULL) {
@@ -1158,11 +973,11 @@
                 break;
 
             default:
-                if (_instrInfo2) {
+                if (verboseLog) {
                     not_exam = true;
                 }
         }
-        if (_instrInfo2) {
+        if (verboseLog) {
             if (not_exam) {
                 Log::out() <<"!!! Not examined. ";
                 inst->print(Log::out()); Log::out() << std::endl;
@@ -1217,7 +1032,9 @@
     }
     if (cgnode->nodeType==NT_OBJECT && cgnode->nodeRefType == NR_REF) {
         NamedType* nt = (NamedType*)(inst->getDst())->getType();
-        if (nt->isFinalizable()) {  // finalized objects cannot be removed
+        if (nt->isUnresolvedType() || nt->isFinalizable()) {  
+            // finalized objects cannot be removed
+            // unresolved objects too (not tested)
             setOutEscaped(cgnode);
         }
     }
@@ -1233,30 +1050,26 @@
 
     cgnode->opndId = opnd->getId();
     cgnode->refObj = opnd;
-#ifdef _DEBUG
-    if (_cngnodes) {
+    if (shortLog) {
         Log::out() <<"++++ addNode  "; printCnGNode(cgnode,Log::out());
         Log::out() << std::endl;
     }
-#endif
     return cgnode;
 }  // addCnGNode_op(Inst* inst, Type* type, uint32 ntype) 
 
 
 EscAnalyzer::CnGNode*
-EscAnalyzer::addCnGNode_mp(Inst* inst, MethodDesc* md, uint32 ntype, uint32 narg) {
-    Type* type = md->getParamType(narg);
+EscAnalyzer::addCnGNode_mp(Inst* inst, MethodPtrType* mpt, uint32 ntype, uint32 narg) {
+    Type* type = mpt->getParamType(narg);
     CnGNode* cgnode = addCnGNode(inst, type, ntype); // new CG node
 
     cgnode->opndId = 0;
     cgnode->argNumber = narg;
-    cgnode->refObj = md;
-#ifdef _DEBUG
-    if (_cngnodes) {
+    cgnode->refObj = mpt;
+    if (shortLog) {
         Log::out() <<"++++ addNode  "; printCnGNode(cgnode,Log::out());
         Log::out() << std::endl;
     }
-#endif
     return cgnode;
 }  // addCnGNode_mp(Inst* inst, MethodDesc* md, uint32 ntype, uint32 narg) 
 
@@ -1268,12 +1081,10 @@
 
     cgnode->opndId = 0;
     cgnode->refObj = inst->getSrc(0);   // returned or thrown operand
-#ifdef _DEBUG
-    if (_cngnodes) {
+    if (shortLog) {
         Log::out() <<"++++ addNode  "; printCnGNode(cgnode,Log::out());
         Log::out() << std::endl;
     }
-#endif
     return cgnode;
 }  // addCnGNode_ex(Inst* inst, uint32 ntype) 
 
@@ -1285,12 +1096,10 @@
 
     cgnode->opndId = 0;
     cgnode->refObj = inst;   // returned or thrown operand
-#ifdef _DEBUG
-    if (_cngnodes) {
+    if (shortLog) {
         Log::out() <<"++++ addNode  "; printCnGNode(cgnode,Log::out());
         Log::out() << std::endl;
     }
-#endif
     return cgnode;
 }  // addCnGNode_fl(Inst* inst, uint32 ntype) 
 
@@ -1342,39 +1151,36 @@
 
 EscAnalyzer::CnGNode*
 EscAnalyzer::findCnGNode_fl(Inst* inst, uint32 ntype) {
-    CnGNodes::iterator it;
-    FieldDesc* fd1;
-    FieldDesc* fd2;
-    uint32 idr = 0;
-    if (ntype==NT_INSTFLD)
+    FieldDesc* fd1 = NULL;
+    if (inst->asFieldAccessInst()==NULL) {// unresolved field access
+        assert(inst->getOpcode() == Op_AddOffset || isVMHelperCall(inst, CompilationInterface::Helper_GetStaticFieldAddrWithResolve));
+    } else {
+        fd1 = inst->asFieldAccessInst()->getFieldDesc();
+    }
+
+    uint32 idr = 0; //object field used to reference this field
+    if (ntype==NT_INSTFLD) {
         idr=inst->getSrc(0)->getId();
-    assert(inst->asFieldAccessInst()!=NULL);
-    fd1 = inst->asFieldAccessInst()->getFieldDesc();
-    for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
-        if ((*it)->nodeType==ntype) {
-            assert(((Inst*)((*it)->refObj))->asFieldAccessInst()!=NULL);
-            fd2 = ((Inst*)((*it)->refObj))->asFieldAccessInst()->getFieldDesc();
-            if ( fd1->getParentType()==fd2->getParentType() && 
-                    strcmp(fd1->getName(),fd2->getName())==0) {
+    }
+    for (CnGNodes::iterator it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
+        CnGNode* cgNode = *it;
+        if (cgNode->nodeType==ntype) {
+            Inst* inst2 = (Inst*)cgNode->refObj;
+            FieldDesc* fd2 = NULL;
+            if (inst2->asFieldAccessInst()==NULL) {
+                assert(inst2->getOpcode() == Op_AddOffset || isVMHelperCall(inst2, CompilationInterface::Helper_GetStaticFieldAddrWithResolve));
+            } else {
+                fd2 = inst2->asFieldAccessInst()->getFieldDesc();
+            }
+            if ((fd1==NULL) != (fd2==NULL)) {
+                continue; // nodes for resolved & unresolved fields
+            }
+            if ( (fd1!=NULL && fd1->getFieldHandle() == fd2->getFieldHandle()) || inst == inst2/*don't optimize*/ ) {
                 if (ntype==NT_INSTFLD) {
-                    uint32 idf=((Inst*)((*it)->refObj))->getSrc(0)->getId();
+                    uint32 idf = inst2->getSrc(0)->getId();
                     if (idr!=idf) {
-#ifdef _DEBUG
-                        if (_cngedges) {
-                            Log::out()
-                                << "++++ findCnGNode_fl: required " << idr 
-                                << " - found  " << idf << " not found" << std::endl;
-                        }
-#endif
                         continue;
                     }
-#ifdef _DEBUG
-                    if (_cngedges) {
-                        Log::out()
-                            << "++++ findCnGNode_fl: required " << idr
-                            << " - found  " << idf << std::endl;
-                    }
-#endif
                 }
                 return (*it);
             }
@@ -1398,31 +1204,28 @@
         assert(cgn1!=NULL);
     }
     if (cgnfrom->nodeType == NT_REF && cgnfrom->lNode == NULL) {
-        assert(cgnfrom->nInst->getOpcode()==Op_TauCast || cgnfrom->nInst->getOpcode()==Op_TauStaticCast);
-        cgn1 = findCnGNode_op(cgnfrom->nInst->getSrc(0)->getId());
+        bool helperCall = isVMHelperCall(cgnfrom->nInst, CompilationInterface::Helper_CheckCastWithResolve);
+        assert(cgnfrom->nInst->getOpcode()==Op_TauCast  || cgnfrom->nInst->getOpcode()==Op_TauStaticCast || helperCall);
+        cgn1 = findCnGNode_op(cgnfrom->nInst->getSrc(helperCall ? 2 : 0)->getId());
         assert(cgn1!=NULL);
         cgnfrom->lNode = cgn1;
     }
 
-#ifdef _DEBUG
-    if (_cngedges) {
+    if (verboseLog) {
         Log::out() 
             << "++++ addEdge: " << cgnfrom->cngNodeId << "-" << cgnfrom->opndId
             << " ( "<<cgn1->cngNodeId << "-" << cgn1->opndId << " ) to "
             << cgnto->cngNodeId << "-" << cgnto->opndId << " ( "
             << cgn2->cngNodeId << "-" << cgn2->opndId << " )" << std::endl;
     }
-#endif
     if (cgn1==cgn2) {
-#ifdef _DEBUG
-       if (_cngedges) {
+       if (verboseLog) {
             Log::out() << "+++++++ equal " 
                 << cgnfrom->cngNodeId<< "-" << cgnfrom->opndId
                 << " ( "<<cgn1->cngNodeId << "-" << cgn1->opndId << " ) to "
                 << cgnto->cngNodeId << "-" << cgnto->opndId << " ( "
                 << cgn2->cngNodeId << "-" << cgn2->opndId << " )" << std::endl;
         }
-#endif
         return;
     }
     for ( it = cngEdges->begin( ); it != cngEdges->end( ); it++ ) {
@@ -1431,11 +1234,9 @@
             for ( itr = (*it)->refList->begin( ); itr != (*it)->refList->end( ); itr++ ) {
                 if ((*itr)->cngNodeTo == cgn2 && (*itr)->edgeType == etype && cgn1->nodeType != NT_INSTFLD) {
                     if (etype==ET_FIELD || cgn1->nodeType==NT_ACTARG) {
-#ifdef _DEBUG
-                        if (_cngedges) {
+                        if (verboseLog) {
                             Log::out() << "++++ addEdge: ET_FIELD || cgn1==NT_ACTARG && *->cngNodeTo == cgn2" <<  std::endl;
                         }
-#endif
                         return;
                     }
                     if (inst->getOpcode() == Op_IntrinsicCall) { //callintr
@@ -1443,11 +1244,9 @@
                         switch(iid) {
                             case ArrayCopyDirect:
                             case ArrayCopyReverse:
-#ifdef _DEBUG
-                                if (_cngedges) {
+                                if (verboseLog) {
                                     Log::out() << "++++ addEdge: callintr" <<  std::endl;
                                 }
-#endif
                                 return;
                             default:
                                assert(0);
@@ -1456,19 +1255,15 @@
                     if (inst->getOpcode() == Op_LdFieldAddr) {
                         FieldDesc* fd=inst->asFieldAccessInst()->getFieldDesc();
                         if (fd->getParentType()->isSystemString()&&strcmp(fd->getName(),"value")==0) {
-#ifdef _DEBUG
-                            if (_cngedges) {
+                            if (verboseLog) {
                                 Log::out() << "++++ addEdge: ldflda String.value" <<  std::endl;
                             }
-#endif
                             return;
                         }
                     }
-#ifdef _DEBUG
-                    if (_cngedges) {
+                    if (verboseLog) {
                         Log::out() << "++++ addEdge: edge already exists and new is added" <<  std::endl;
                     }
-#endif
                 }
             }
             ref = new (eaMemManager) CnGRef;
@@ -1476,11 +1271,9 @@
             ref->edgeType=etype;
             ref->edgeInst=inst;
             (*it)->refList->push_back(ref);
-#ifdef _DEBUG
-            if (_cngedges) {
+            if (verboseLog) {
                 Log::out() << "++++ addEdge: added CnGRef" <<  std::endl;
             }
-#endif
             return;
         } 
     }
@@ -1495,11 +1288,9 @@
     cgedge->refList=el;
     cngEdges->push_back(cgedge);
     cgn1->outEdges=el;
-#ifdef _DEBUG
-    if (_cngedges) {
+    if (verboseLog) {
         Log::out() << "++++ addEdge: added edge" <<  std::endl;
     }
-#endif
 
 }  // addEdge(CnGNode* cgnfrom, CnGNode* cgnto, uint32 etype, Inst* inst) 
 
@@ -1515,13 +1306,11 @@
             || (nt==NT_RETVAL && (*it)->nInst->getOpcode()==Op_IndirectMemoryCall)
             || (nt==NT_RETVAL && (*it)->nInst->asMethodInst()->getMethodDesc()->isNative())) {
             initNodeType = NT_STFLD;
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"-- before scanGE:  nodeId "
                     <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId<<" state ";
                 printState(*it); Log::out() << std::endl;
             }
-#endif
             scanCnGNodeRefsGE(*it,false);
         }
     }
@@ -1529,13 +1318,10 @@
     scannedObjsRev->clear();
     for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
         if ((*it)->nodeType&NT_EXITVAL || (*it)->nodeType==NT_DEFARG) {  // returned, thrown , defarg
-#ifdef _DEBUG
-            if (_setState) {
-                Log::out() <<"-- before scanEVDA:  nodeId "
-                    <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId<<" state ";
+            if (verboseLog) {
+                Log::out() <<"-- before scanEVDA:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId<<" state ";
                 printState(*it); Log::out() << std::endl;
             }
-#endif
             initNodeType = (*it)->nodeType;
             scanCnGNodeRefsGE(*it,false);
             scannedObjs->clear();
@@ -1547,13 +1333,10 @@
     for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
         if ((*it)->nodeType==NT_ACTARG) {
             curMDNode=(*it)->cngNodeId;
-#ifdef _DEBUG
-            if (_setState) {
-                Log::out() <<"-- before scanAE:  nodeId "
-                    <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId<<" state ";
+            if (verboseLog) {
+                Log::out() <<"-- before scanAE:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId<<" state ";
                 printState(*it);  Log::out() << std::endl;
             }
-#endif
             initNodeType = NT_ACTARG;
             scanCnGNodeRefsAE(*it,false);
             scannedObjs->clear();
@@ -1575,8 +1358,7 @@
                 for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
                     if ( (*it)->nodeType==NT_OBJECT) {
                         if (ltree->getLoopHeader((*it)->nInst->getNode(),false)) {
-#ifdef _DEBUG
-                            if (_setState) {
+                            if (verboseLog) {
                                 Log::out() 
                                     <<"--setSt loop:  nodeId "
                                     <<(*it)->cngNodeId<<"  opId "
@@ -1584,17 +1366,16 @@
                                 printState(*it);
                                 Log::out() <<" to set loop" << std::endl;
                             }
-#endif
                             setLoopCreated(*it);
                             comObjStat._n_lo++;
                         }
                     }
                 }
         } else {
-#ifdef _DEBUG
-            mh.printFullName(Log::out()); Log::out() << std::endl;
-            Log::out() << "DominatorTree isn't valid  " << std::endl;
-#endif
+            if (verboseLog) {
+                mh.printFullName(Log::out()); Log::out() << std::endl;
+                Log::out() << "DominatorTree isn't valid  " << std::endl;
+            }
         }
     }
     for (it = cngNodes->begin( ); it != cngNodes->end( ); it++ ) {
@@ -1604,34 +1385,32 @@
                     it1++) {
                 CnGNode* n=findCnGNode_id(*it1);   // method argument node
                 assert(n!=NULL);
-                MethodDesc* mdesc = (MethodDesc*)n->refObj;
+                MethodPtrType* mpt = (MethodPtrType*)n->refObj;
                 Inst* callInst = n->nInst;
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out()<<"--setSt chk arg_esc:  nodeId " <<(*it)->cngNodeId
                         <<"  opId " <<(*it)->opndId<<" state "; 
                     printState(*it); Log::out() << std::endl; 
                     Log::out() << "       "; callInst->print(Log::out());
                     Log::out() << std::endl;
                 }
-#endif
-                if (mdesc->isNative()) {  // not scanned native methods 
+                if (mpt->isUnresolvedMethodPtrType() || mpt->getMethodDesc()->isNative()) {  // not scanned native methods 
                     setEscState(*it,GLOBAL_ESCAPE);
-#ifdef _DEBUG
-                    if (_scanMtds==1) {
-                        mdesc->printFullName(Log::out());
+                    if (verboseLog) {
+                        mpt->print(Log::out());
                         Log::out() << std::endl;
-                        Log::out() << "    isNative: " 
-                            << mdesc->isNative() << std::endl;
+                        if (mpt->isUnresolvedMethodPtrType()) {
+                            Log::out() << "    isUnresolved: true" << std::endl;
+                        } else {
+                            Log::out() << "    isNative: true" << std::endl;
+                        }
+                        
                     }
-                    if (_setState) {
-                        Log::out() <<"--setSt 1:  nodeId "
-                            <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId
-                            <<" state ";
+                    if (verboseLog) {
+                        Log::out() <<"--setSt 1:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state ";
                         printState(*it); 
                         Log::out()<<" to gl.esc."<< std::endl;
                     }
-#endif
                     break;
                 }
                 if (callInst->getOpcode()!=Op_DirectCall) {   // not direct call
@@ -1642,8 +1421,7 @@
                             mu = findMonUnit((*it)->opndId);
                         if (mu != NULL) {
                             addMonUnitVCall(mu,callInst);
-#ifdef _DEBUG
-                            if (_seinfo) {
+                            if (verboseLog) {
                                 Log::out() << "=-=-=-=- callimem for this ";
                                 Log::out() << std::endl;
                                 Log::out() << "=-=- ";
@@ -1653,94 +1431,54 @@
                                 Log::out() << std::endl;
                                 callInst->print(Log::out());
                                 Log::out() << std::endl;
-                                mdesc->printFullName(Log::out());
+                                mpt->print(Log::out());
                                 Log::out() << std::endl;
                                 Log::out() << "=-=-=-=- end " << std::endl;
                             }
-#endif
                             continue;
                         }
                     }
-#ifdef _DEBUG
-                    if (_scanMtds==1) {
-                        callInst->print(Log::out());
-                        Log::out() << std::endl;
-                        mdesc->printFullName(Log::out());
-                        Log::out() << std::endl;
-                        Log::out() << "    isStatic: " 
-                            << mdesc->isStatic() << std::endl;
-                        Log::out() << "    isFinal: " 
-                            << mdesc->isFinal() << std::endl;
-                        Log::out() << "---------------" << std::endl;
-                        Log::out() << "    NumParams: " 
-                            << mdesc->getNumParams()<< std::endl;
-                        Log::out() << "    isInstance: " 
-                            << mdesc->isInstance() << std::endl;
-                        Log::out() << "    isVirtual: " 
-                            << mdesc->isVirtual() << std::endl;
-                        Log::out() << "    isAbstract: " 
-                            << mdesc->isAbstract() << std::endl;
-                        Log::out() << "    isInstanceInitializer: " 
-                            << mdesc->isInstanceInitializer() << std::endl;
-                        Log::out() << "    isOverridden: " 
-                            << mdesc->isOverridden() << std::endl;
-                    }
-                    if (_setState) {
-                        Log::out() <<"--setSt 2:  nodeId "
-                            <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId
-                            <<" state ";
+                    if (verboseLog) {
+                        callInst->print(Log::out()); Log::out() << std::endl;
+                        logMethod(mpt);
+
+                        Log::out() <<"--setSt 2:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state ";
                         printState(*it);
                         Log::out() <<" to v.call." << std::endl;
                     }
-#endif
                     continue; //break;
                 }
-                CalleeMethodInfo* mtdInfo = findMethodInfo(mdesc,callInst);
+                CalleeMethodInfo* mtdInfo = mpt->isUnresolvedMethodPtrType() ? NULL : findMethodInfo(mpt->getMethodDesc(), callInst);
                 if (mtdInfo == NULL) {    // no info about called method
                     setEscState(*it,GLOBAL_ESCAPE);
-#ifdef _DEBUG
-                    if (_setState) {
-                        Log::out() <<"--setSt 3:  nodeId "
-                            <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId
-                            <<" state ";
-                        printState(*it);
-                        Log::out() <<" to gl.esc." << std::endl;
+                    if (verboseLog) {
+                        Log::out() <<"--setSt 3:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state ";
+                        printState(*it);Log::out() <<" to gl.esc." << std::endl;
                     }
-#endif
                     break;
                 } else {  // to use info about scanned method
                     uint32 narg = n->argNumber;
                     ParamInfos::iterator it2;
                     uint32 state = 0;
-#ifdef _DEBUG
-                    if (_setState) {
+                    if (verboseLog) {
                         Log::out() << "--setSt cmi: method " 
                             << mtdInfo->methodIdent->parentName << "::"
                             << mtdInfo->methodIdent->name << " "
                             << mtdInfo->methodIdent->signature << std::endl;
                     }
-#endif
-                    for (it2 = mtdInfo->paramInfos->begin( ); 
-                            it2 != mtdInfo->paramInfos->end( ); it2++) {
-#ifdef _DEBUG
-                        if (_setState) {
+                    for (it2 = mtdInfo->paramInfos->begin( );  it2 != mtdInfo->paramInfos->end( ); it2++) {
+                        if (verboseLog) {
                             Log::out() 
                                 <<(*it2)->paramNumber<<" == "<<narg<<" state "
                                 <<(*it2)->state <<" < "<< getEscState(*it)<<"  ";
                             printState(*it);  Log::out() << std::endl;
                         }
-#endif
                         if ((*it2)->paramNumber == narg) { //???to add scanning of contained obj
                             if ((state=(*it2)->state&ESC_MASK) < getEscState(*it)) {
-#ifdef _DEBUG
-                                if (_setState) {
-                                    Log::out()<<"--setSt cmi1:  nodeId " 
-                                        <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId
-                                        <<" state "; 
-                                    printState(*it);
-                                    Log::out() <<" to state " <<state<< std::endl;
+                                if (verboseLog) {
+                                    Log::out()<<"--setSt cmi1:  nodeId " <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state "; 
+                                    printState(*it); Log::out() <<" to state " <<state<< std::endl;
                                 }
-#endif
                                 setEscState(*it,state);
                             }
                         }
@@ -1780,25 +1518,21 @@
             }
             CalleeMethodInfo* mthInfo = findMethodInfo(mdesc,(*it)->nInst);
             if (mthInfo == NULL) {
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out() <<"--setCOS 4:  nodeId "
                         <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state ";
                     printState(*it); Log::out() <<" to gl.esc."<< std::endl;
                 }
-#endif
                 initNodeType = NT_STFLD;
                 scanCnGNodeRefsGE(*it,false);
             } else {
                 if (getEscState(*it)>((mthInfo->retValueState)&ESC_MASK) || getOutEscaped(*it)==0) {
-#ifdef _DEBUG
-                    if (_setState) {
+                    if (verboseLog) {
                         Log::out() <<"--setCOS 5:  nodeId "
                             <<(*it)->cngNodeId<<"  opId "<<(*it)->opndId <<" state ";
                         printState(*it);
                         Log::out() <<" to "<< mthInfo->retValueState<< std::endl;
                     }
-#endif
                     if (((mthInfo->retValueState)&ESC_MASK) == GLOBAL_ESCAPE) {
                         initNodeType = NT_STFLD;   // global_escape propagate
                     } else {
@@ -1818,12 +1552,10 @@
         if ((nt&(NT_OBJECT|NT_RETVAL) || nt==NT_LDOBJ) && (getEscState(*it)!=GLOBAL_ESCAPE)) {
             if ((*it)->outEdges == NULL)
                 continue;
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--setCOS 6: to check subobj nodes ";
                 printCnGNode(*it,Log::out()); Log::out() << std::endl;
             }
-#endif
             checkSubobjectStates(*it);
         }
         scannedObjs->clear();
@@ -1846,38 +1578,29 @@
     if (cgn->nodeType != NT_STFLD && cgn->nodeType != NT_THRVAL && cgn->nodeType != NT_EXITVAL 
         && cgn->nodeType != NT_DEFARG && cgn->nodeType != NT_RETVAL && cgn->nodeType != NT_LDOBJ)
         assert(needFix);
-#ifdef _DEBUG
-    if (_setState) {
-        Log::out() <<"--scanGE 1:  nodeId "<<cgn->cngNodeId
-            <<"  opId "<<cgn->opndId<<" state ";
+    if (verboseLog) {
+        Log::out() <<"--scanGE 1:  nodeId "<<cgn->cngNodeId <<"  opId "<<cgn->opndId<<" state ";
         printState(cgn); 
-        Log::out() <<" " << nodeTypeToString(cgn) <<cgn->nodeType
-            <<"  check_var_src " << check_var_src << std::endl;
+        Log::out() <<" " << nodeTypeToString(cgn) <<cgn->nodeType <<"  check_var_src " << check_var_src << std::endl;
     }
-#endif
     if (cgn->nodeType == NT_LDVAL) {
-#ifdef _DEBUG
-        if (_setState) {
+        if (verboseLog) {
             Log::out() <<"--scanGE > 1: primitive type " << std::endl;
         }
-#endif
         return;
     }
     if (scObjs->size()!=0) {
         if (checkScanned(scObjs,cgn->cngNodeId)) {
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanGE > 1: was scanned earlier " << std::endl;
             }
-#endif
             return;
         }
     }
 
     if (initNodeType!=NT_EXITVAL && initNodeType!=NT_DEFARG) { // 
         if (getEscState(cgn) > GLOBAL_ESCAPE) {
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanGE 2:  nodeId "
                     <<cgn->cngNodeId<<"  opId "<<cgn->opndId <<" state ";
                 printState(cgn);
@@ -1885,14 +1608,12 @@
                 Log::out() <<"--scanGE 2: "<< nodeTypeToString(cgn) 
                     << cgn->nodeType <<" initNode "<<initNodeType<< std::endl;
             }
-#endif
             setEscState(cgn,GLOBAL_ESCAPE);
         }
     } 
     if (initNodeType==NT_EXITVAL) {
         if (getOutEscaped(cgn) == 0) {
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanGE 3:  nodeId "
                     <<cgn->cngNodeId<<"  opId "<<cgn->opndId <<" state ";
                 printState(cgn);
@@ -1900,17 +1621,14 @@
                 Log::out() <<"--scanGE 3: "<< nodeTypeToString(cgn) 
                     << cgn->nodeType <<" initNode "<<initNodeType<< std::endl;
             }
-#endif
             setOutEscaped(cgn);
         }
         // The objects created in the method are not global escaped through return
     }
     if (initNodeType==NT_DEFARG) {
         if (needFix) {
-#ifdef _DEBUG
-            if (_setState) {
-                Log::out() <<"--scanGE 4:  nodeId "
-                    <<cgn->cngNodeId<<"  opId "<<cgn->opndId <<" state ";
+            if (verboseLog) {
+                Log::out() <<"--scanGE 4:  nodeId " <<cgn->cngNodeId<<"  opId "<<cgn->opndId <<" state ";
                 printState(cgn);
                 if (cgn->nodeType == NT_OBJECT || cgn->nodeType == NT_LDOBJ || cgn->nodeType == NT_RETVAL) {
                     Log::out() <<" to gl.esc."<< std::endl;
@@ -1920,7 +1638,6 @@
                 Log::out() <<"--scanGE 4: "<< nodeTypeToString(cgn) 
                     << cgn->nodeType <<" initNode "<<initNodeType<< std::endl;
             }
-#endif
             if (cgn->nodeType == NT_OBJECT || cgn->nodeType == NT_LDOBJ || cgn->nodeType == NT_RETVAL) {
                 setEscState(cgn,GLOBAL_ESCAPE); //objects escaped through defarg - global escape
             } else {
@@ -1936,32 +1653,26 @@
             next_node = (*it1)->cngNodeTo;
             needFix = isStateNeedGEFix(getFullState(next_node),next_node->nodeType);
             if (!needFix) {
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out() <<"--scanGE 5.0 next:  already set  ";
                     printState(next_node); Log::out() << std::endl;
                 }
-#endif
                 continue;
             }
             if (next_node->nodeType == NT_LDOBJ && next_node->nInst->getOpcode()==Op_LdVar 
                 && cgn->nodeType!=NT_VARVAL) {
                 to_check_var_src = true;
             }
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanGE 5 next:  nodeId "
                     <<next_node->cngNodeId<<"  opId "<<next_node->opndId <<" state ";
                 printState(next_node); Log::out() << std::endl;
             }
-#endif
             scanCnGNodeRefsGE(next_node,to_check_var_src);
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanGE ret 1 for node:  " << next_node->cngNodeId
                     <<"  opId " << next_node->opndId << std::endl;
             }
-#endif
         }
     }
     if (check_var_src) {
@@ -1971,28 +1682,22 @@
                 next_node = findCnGNode_op(cgn->nInst->getSrc(i)->getId());
                 needFix = isStateNeedGEFix(getFullState(next_node),next_node->nodeType);
                 if (!needFix) {
-#ifdef _DEBUG
-                    if (_setState) {
+                    if (verboseLog) {
                         Log::out() <<"--scanGE 6.0 next:  already set  ";
                         printState(next_node); Log::out() << std::endl;
                     }
-#endif
                     continue;
                 }
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out() <<"--scanGE 6 next:  nodeId "
                         <<next_node->cngNodeId<<"  opId "<<next_node->opndId <<" state ";
                     printState(next_node); Log::out() << std::endl;
                 }
-#endif
                 scanCnGNodeRefsGE(next_node,check_var_src);
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out() <<"--scanGE ret 2 for node:  " << next_node->cngNodeId
                         <<"  opId " << next_node->opndId << std::endl;
                 }
-#endif
             }
         }
     }
@@ -2013,30 +1718,24 @@
         assert(getEscState(cgn)!=ARG_ESCAPE);
     }
     assert(getEscState(cgn)!=GLOBAL_ESCAPE);
-#ifdef _DEBUG
-    if (_setState) {
+    if (verboseLog) {
         Log::out() <<"--scanAE < 1:  nodeId "<<cgn->cngNodeId
             <<"  opId "<<cgn->opndId<<" state ";
         printState(cgn);
         Log::out() <<" " << nodeTypeToString(cgn) <<cgn->nodeType
             <<"  check_var_src " << check_var_src << std::endl;
     }
-#endif
     if (cgn->nodeType == NT_LDVAL) {   // primitive type value
-#ifdef _DEBUG
-        if (_setState) {
+        if (verboseLog) {
             Log::out() <<"--scanAE > 1: primitive type " << std::endl;
         }
-#endif
         return;
     }
     if (scObjs->size()!=0) {
         if (checkScanned(scObjs,cgn->cngNodeId)) {
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--scanAE > 2: was scanned earlier " << std::endl;
             }
-#endif
             return;
         }
     }
@@ -2047,22 +1746,17 @@
 
     if (cgn->nodeMDs!=NULL && curMDNode!=0) {
          cgn->nodeMDs->push_back(curMDNode);
-#ifdef _DEBUG
-        if (_setState) {
+        if (verboseLog) {
             Log::out() <<"--scanAE 1_1:  nodeId "<<cgn->cngNodeId
                 <<"  opId "<<cgn->opndId <<" curMDNode "<<curMDNode<< std::endl;
         }
-#endif
     }
     if (getEscState(cgn) > ARG_ESCAPE) {
-#ifdef _DEBUG
-        if (_setState) {
-            Log::out() <<"--scanAE 2:  nodeId "<<cgn->cngNodeId
-                <<"  opId "<<cgn->opndId<<" state ";
+        if (verboseLog) {
+            Log::out() <<"--scanAE 2:  nodeId "<<cgn->cngNodeId <<"  opId "<<cgn->opndId<<" state ";
             printState(cgn);
             Log::out() <<" to arg.esc."<< std::endl;
         }
-#endif
         setEscState(cgn,ARG_ESCAPE);
     }
 
@@ -2075,15 +1769,11 @@
                 continue;
             if (getEscState(next_node) == ARG_ESCAPE && cgn->nodeType != NT_ACTARG)
                 continue;
-#ifdef _DEBUG
-            if (_setState) {
-                Log::out() <<"--scanAE 3 next:  nodeId "
-                    <<next_node->cngNodeId<<"  opId "<<next_node->opndId <<" state ";
+            if (verboseLog) {
+                Log::out() <<"--scanAE 3 next:  nodeId " <<next_node->cngNodeId<<"  opId "<<next_node->opndId <<" state ";
                 printState(next_node); 
-                Log::out() << " " << nodeTypeToString(next_node) 
-                    << " ref.type " << next_node->nodeRefType << std::endl;
+                Log::out() << " " << nodeTypeToString(next_node) << " ref.type " << next_node->nodeRefType << std::endl;
             }
-#endif
             if (next_node->nodeType == NT_LDVAL)
                 continue;
             if (next_node->nodeType == NT_LDOBJ)
@@ -2100,27 +1790,23 @@
                 next_node = findCnGNode_op(cgn->nInst->getSrc(i)->getId());
                 if (getEscState(next_node) <= ARG_ESCAPE)
                     continue;
-#ifdef _DEBUG
-                if (_setState) {
+                if (verboseLog) {
                     Log::out() <<"--scanAE 4 next:  nodeId "
                         <<next_node->cngNodeId<<"  opId "<<next_node->opndId <<" state ";
                     printState(next_node); Log::out() << std::endl;
                 }
-#endif
                 scanCnGNodeRefsAE(next_node,check_var_src);
                 curMDNode = curMDNode_saved;
             }
         }
     }
 
-#ifdef _DEBUG
-    if (_setState) {
+    if (verboseLog) {
         Log::out() <<"--scanAE > 4: exit:  nodeId "<<cgn->cngNodeId
             <<"  opId "<<cgn->opndId<<" state "; printState(cgn);
         Log::out() <<" " << nodeTypeToString(cgn) <<cgn->nodeType
             <<"  check_var_src " << check_var_src << std::endl;
     }
-#endif
 }  // scanCnGNodeRefsAE(CnGNode* cgn, bool check_var_src)
 
 
@@ -2138,18 +1824,14 @@
     Inst* n_inst = node->nInst;
     CnGNode* nt = NULL;
 
-#ifdef _DEBUG
-    if (_setState) {
+    if (verboseLog) {
         Log::out() <<"--checkSOS 0: ";
         printCnGNode(node,Log::out());Log::out() << std::endl;
     }
-#endif
     if (node->outEdges==NULL) {
-#ifdef _DEBUG
-        if (_setState) {
+        if (verboseLog) {
             Log::out() <<"--checkSOS 1: return "  << std::endl;
         }
-#endif
         return;
     }
 
@@ -2169,12 +1851,10 @@
         n_inst = node_fld->nInst;
         for (it = node_fld->outEdges->begin( ); it != node_fld->outEdges->end( ); it++ ) {
             cgn = (*it)->cngNodeTo;
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--checkSOS 2: ";
                 printCnGNode(cgn,Log::out());Log::out() << std::endl;
             }
-#endif
             if (getEscState(cgn) < getEscState(node_fld)) {
                 if (getEscState(cgn)==GLOBAL_ESCAPE) {
                     gle = true;
@@ -2191,33 +1871,27 @@
             }
             no_mod = true;
         }
-#ifdef _DEBUG
-        if (_setState) {
+        if (verboseLog) {
             Log::out() <<"--checkSOS 2:  " << no_mod << " " << gle  << " " << calle << " " << arge
                 << std::endl;
         }
-#endif
         if (gle || calle || arge) {
             if (node_fld->nodeType==NT_ARRELEM) {
                 if (n_inst->getOpcode() == Op_AddScaledIndex) {
                     n_inst = n_inst->getSrc(0)->getInst();
                     nt = findCnGNode_op(n_inst->getSrc(0)->getId());
-#ifdef _DEBUG
-                    if (_setState) {
+                    if (verboseLog) {
                         Log::out() <<"--checkSOS 3:  "; printCnGNode(nt,Log::out()); Log::out() << std::endl;
                     }
-#endif
                     if (nt->lNode != NULL) {
                         nt = nt->lNode;
                     }
                 }
             }
-#ifdef _DEBUG
-            if (_setState) {
+            if (verboseLog) {
                 Log::out() <<"--checkSOS 4: found  ";
                 printCnGNode(nt,Log::out());Log::out() << std::endl;
             }
-#endif
             if (gle) {
                 initNodeType = NT_STFLD; 
             } else {
@@ -2261,15 +1935,13 @@
     const char* ch3 = mdesc->getSignatureString();
     CalleeMethodInfo* mtdInfo = getMethodInfo(ch1,ch2,ch3);
     if (mtdInfo == NULL) {
-#ifdef _DEBUG
-        if (_scanMtds==1) {
+        if (verboseLog) {
             Log::out() << "      = = = = = = = =  To scan method " << std::endl;
             mdesc->printFullName(Log::out());
             Log::out() << std::endl;
             callInst->print(Log::out());
             Log::out() << std::endl;
         }
-#endif
         if (method_ea_level < maxMethodExamLevel) {
             scanCalleeMethod(callInst);
             mtdInfo=getMethodInfo(ch1,ch2,ch3);
@@ -2297,40 +1969,21 @@
 
 void
 EscAnalyzer::scanCalleeMethod(Inst* call) {
-    MethodDesc* methodDesc = 0;
-    
-#ifdef _DEBUG
-    if (_scanMtds==1) {
+    if (verboseLog) {
         Log::out() << "=="; 
         call->print(Log::out()); 
         Log::out() << std::endl;
     }
-#endif
     if (call == NULL) {  // scanned Op_DirectCall, not scanned Op_IndirectMemoryCall
         Log::out() << "scanMethod: NULL" << std::endl;
         return;
     }
-    methodDesc = call->asMethodCallInst()->getMethodDesc();
+    
+    MethodDesc* methodDesc = call->asMethodCallInst()->getMethodDesc();
 
-#ifdef _DEBUG
-    if (_scanMtds==1) {
-        Log::out() << std::endl; 
-        Log::out() << "scanMethod: " << methodDesc->getParentType()->getName() 
-            << "." << methodDesc->getName() << methodDesc->getSignatureString() 
-            << "  " << methodDesc << std::endl;
-        Log::out() << "    NumParams: " 
-            << methodDesc->getNumParams()<< std::endl;
-        Log::out() << "    isNative: " << methodDesc->isNative() << std::endl;
-        Log::out() << "    isStatic: " << methodDesc->isStatic() << std::endl;
-        Log::out() << "    isInstance: " << methodDesc->isInstance() << std::endl;
-        Log::out() << "    isFinal: " << methodDesc->isFinal() << std::endl;
-        Log::out() << "    isVirtual: " << methodDesc->isVirtual() << std::endl;
-        Log::out() << "    isAbstract: " << methodDesc->isAbstract() << std::endl;
-        Log::out() << "    isInstanceInitializer: " 
-            << methodDesc->isInstanceInitializer() << std::endl;
-        Log::out() << "    isOverridden: " << methodDesc->isOverridden() << std::endl;
-   }
-#endif
+    if (verboseLog) {
+        Log::out() << std::endl; Log::out() << "scanMethod: "; logMethod(methodDesc);
+    }
 
     OpndManager& _opndManager(irManager.getOpndManager());
     Opnd *returnOpnd = 0;
@@ -2466,8 +2119,7 @@
     calleeMethodInfos->push_back(minfo);
     calleeMethodInfosLock.unlock();  // Unlock 
 
-#ifdef _DEBUG
-    if (_scanMtds==1) {
+    if (verboseLog) {
         ParamInfos::iterator it2;
         Log::out() << "====     ===== calleeMethodInfo  " << std::endl;
         Log::out() << minfo->methodIdent->parentName << "  ";
@@ -2480,7 +2132,6 @@
         }
         Log::out() << "==== end ===== calleeMethodInfo  " << std::endl;
     }
-#endif
 }  // saveScannedMethodInfo(MemoryManager& mm)
 
 
@@ -2567,10 +2218,8 @@
             }
         }
         if ((*it)->nodeType & NT_ACTARG) {    //node of actual method parameter
-            os << ((MethodDesc*)(*it)->refObj)->getParentType()->getName() << "::";
-            os << ((MethodDesc*)(*it)->refObj)->getName() << std::endl;
-            os << "                                ";
-            os << ((MethodDesc*)(*it)->refObj)->getParamType((*it)->opndId)->getName();
+            ((MethodPtrType*)(*it)->refObj)->print(os);
+            os << std::endl;
         }
         if ((*it)->nodeType & NT_STFLD) {    //field node 
             fd = ((Inst*)(*it)->refObj)->asFieldAccessInst()->getFieldDesc();
@@ -2592,7 +2241,8 @@
     } else {

[... 1880 lines stripped ...]


Mime
View raw message