Index: vm/jitrino/src/optimizer/escanalyzer.cpp =================================================================== --- vm/jitrino/src/optimizer/escanalyzer.cpp (revision 604113) +++ vm/jitrino/src/optimizer/escanalyzer.cpp (working copy) @@ -2216,14 +2216,8 @@ Inst* inst = ((Opnd*)(*it)->refObj)->getInst(); inst->print(os); if (inst->getOpcode()==Op_IndirectMemoryCall) { - MethodDesc* md; - if (inst->getSrc(0)->getInst()->getOpcode()== Op_LdVar) { - md = inst->getSrc(0)->getType()->asMethodPtrType()->getMethodDesc(); - } else { - md = inst->getSrc(0)->getInst()->asMethodInst()->getMethodDesc(); - } - os << std::endl; os << " "; - md->printFullName(os); + os << std::endl; os << " "; + printCallMethodName(inst, Log::out()); } } if ((*it)->nodeType & NT_ACTARG) { //node of actual method parameter @@ -2403,14 +2397,9 @@ if (cgn->nodeType==NT_RETVAL) { inst = cgn->nInst; if (inst->getOpcode()==Op_IndirectMemoryCall) { - MethodDesc* md; - if (inst->getSrc(0)->getInst()->getOpcode()== Op_LdVar) { - md = inst->getSrc(0)->getType()->asMethodPtrType()->getMethodDesc(); - } else { - md = inst->getSrc(0)->getInst()->asMethodInst()->getMethodDesc(); - } os << text << " "; - md->printFullName(os); os << std::endl; + printCallMethodName(inst, Log::out()); + os << std::endl; } } if (cgn->nodeType==NT_LDOBJ && getEscState(cgn)!=GLOBAL_ESCAPE) { @@ -2422,6 +2411,27 @@ void +EscAnalyzer::printCallMethodName(Inst* inst, ::std::ostream& os) { + assert(inst); + Opnd* zeroOpnd = inst->getSrc(0); + Inst* srcInst = zeroOpnd->getInst(); + if (srcInst->getOpcode()== Op_LdVar) { + MethodDesc* md = zeroOpnd->getType()->asMethodPtrType()->getMethodDesc(); + md->printFullName(os); + } else if (srcInst->isMethod()) { + MethodDesc* md = srcInst->asMethodInst()->getMethodDesc(); + md->printFullName(os); + } else if (srcInst->isVMHelperCallInst()) { + //CompilationContext* cc = CompilationContext::getCurrentContext(); + //const char* name = cc->getVMCompilationInterface()->getRuntimeHelperName(srcInst->asVMHelperCallInst()->getVMHelperId()); + //os << name; + } else { + assert(0); + } + +} // printCallMethodName(Inst* inst, std::string text,::std::ostream& os) + +void EscAnalyzer::lObjectHistory(Inst* inst,std::string text,::std::ostream& os) { Inst* inst1; uint32 nsrc=inst->getNumSrcOperands(); @@ -2442,13 +2452,9 @@ } } if (inst->getOpcode()==Op_IndirectMemoryCall) { - MethodDesc* md; - if (inst->getSrc(0)->getInst()->getOpcode()== Op_LdVar) { - md = inst->getSrc(0)->getType()->asMethodPtrType()->getMethodDesc(); - } else { - md = inst->getSrc(0)->getInst()->asMethodInst()->getMethodDesc(); - } - os << text << " "; md->printFullName(os); os << std::endl; + os << text << " "; + printCallMethodName(inst, Log::out()); + os << std::endl; } return; } @@ -2576,15 +2582,9 @@ } } if (inst->getOpcode()==Op_IndirectMemoryCall) { - MethodDesc* md; - if (inst->getSrc(0)->getInst()->getOpcode()== Op_LdVar) { - md = inst->getSrc(0)->getType()->asMethodPtrType()->getMethodDesc(); - } else { - md = inst->getSrc(0)->getInst()->asMethodInst()->getMethodDesc(); - } if (verboseLog) { Log::out() << text << " "; - md->printFullName(Log::out() ); + printCallMethodName(inst, Log::out()); Log::out() << std::endl; } } @@ -3978,8 +3978,6 @@ EscAnalyzer::doLOScalarReplacement(ObjIds* loids) { ObjIds::iterator lo_it; CnGNode* onode; - Inst* inst; - Inst* st_inst; Insts::iterator it3; OpndManager& _opndManager = irManager.getOpndManager(); InstFactory& _instFactory = irManager.getInstFactory(); @@ -4036,63 +4034,44 @@ if (sco->ls_insts->size()==0) { continue; } - bool do_fld_sc = false; - for (it3 = sco->ls_insts->begin(); it3 != sco->ls_insts->end( ); it3++ ) { - if ((*it3)->getOpcode() == Op_TauLdInd) { - do_fld_sc = true; - break; - } + Type* fl_type = NULL; + Type* fl_type1 = NULL; + Inst* ii = sco->ls_insts->front(); + if (ii->getOpcode()==Op_TauStInd) { + fl_type1 = ii->getSrc(1)->getType()->asPtrType()->getPointedToType(); + fl_type = ii->getSrc(0)->getType(); + } else { + fl_type1 = ii->getSrc(0)->getType()->asPtrType()->getPointedToType(); + fl_type = ii->getDst()->getType(); } - if (do_fld_sc) { - Type* fl_type = NULL; - Type* fl_type1 = NULL; - Inst* ii = sco->ls_insts->front(); - if (ii->getOpcode()==Op_TauStInd) { - fl_type1 = ii->getSrc(1)->getType()->asPtrType()->getPointedToType(); - fl_type = ii->getSrc(0)->getType(); - } else { - fl_type1 = ii->getSrc(0)->getType()->asPtrType()->getPointedToType(); - fl_type = ii->getDst()->getType(); - } - VarOpnd* fl_var_opnd = _opndManager.createVarOpnd(fl_type, false); - SsaTmpOpnd* fl_init_opnd = _opndManager.createSsaTmpOpnd(fl_type); - Inst* ld_init_val_inst = NULL; - sco->fldVarOpnd = fl_var_opnd; + VarOpnd* fl_var_opnd = _opndManager.createVarOpnd(fl_type, false); + SsaTmpOpnd* fl_init_opnd = _opndManager.createSsaTmpOpnd(fl_type); + Inst* ld_init_val_inst = NULL; + sco->fldVarOpnd = fl_var_opnd; - if (verboseLog) { - os_sc<<" PointedType "; fl_type1->print(os_sc); os_sc <print(os_sc); os_sc <isReference()) { - ld_init_val_inst = _instFactory.makeLdNull(fl_init_opnd); - } else { - ld_init_val_inst = _instFactory.makeLdConst(fl_init_opnd, 0); - } + if (verboseLog) { + os_sc<<" PointedType "; fl_type1->print(os_sc); os_sc <print(os_sc); os_sc <isReference()) { + ld_init_val_inst = _instFactory.makeLdNull(fl_init_opnd); + } else { + ld_init_val_inst = _instFactory.makeLdConst(fl_init_opnd, 0); + } - scalarizeOFldUsage(sco); - if (verboseLog) { - os_sc << "++++ old newobj added fld_var: before" << std::endl; - FlowGraph::print(os_sc,onode->nInst->getNode()); - os_sc << "++++ old newobj: before end" << std::endl; - } - ld_init_val_inst->insertBefore(onode->nInst); - _instFactory.makeStVar(fl_var_opnd,fl_init_opnd)->insertBefore(onode->nInst); - if (verboseLog) { - os_sc << "++++ old newobj added fld_var: after" << std::endl; - FlowGraph::print(os_sc,onode->nInst->getNode()); - os_sc << "++++ old newobj: after end" << std::endl; - } - } else { // there was no ldind instructions - for (it3 = sco->ls_insts->begin(); it3 != sco->ls_insts->end( ); it3++ ) { - st_inst = *it3; - removeInst(st_inst); - removeInst(inst=st_inst->getSrc(1)->getInst()); - removeInst(inst=inst->getSrc(0)->getInst()); - if (inst->getOpcode() == Op_LdArrayBaseAddr) { - removeInst(inst->getSrc(0)->getInst()); - } - } + scalarizeOFldUsage(sco); + if (verboseLog) { + os_sc << "++++ old newobj added fld_var: before" << std::endl; + FlowGraph::print(os_sc,onode->nInst->getNode()); + os_sc << "++++ old newobj: before end" << std::endl; } + ld_init_val_inst->insertBefore(onode->nInst); + _instFactory.makeStVar(fl_var_opnd,fl_init_opnd)->insertBefore(onode->nInst); + if (verboseLog) { + os_sc << "++++ old newobj added fld_var: after" << std::endl; + FlowGraph::print(os_sc,onode->nInst->getNode()); + os_sc << "++++ old newobj: after end" << std::endl; + } } } Node* no_node = onode->nInst->getNode(); @@ -4100,7 +4079,7 @@ if (verboseLog) { os_sc << "++++ old newobj removed: before" << std::endl; FlowGraph::print(os_sc,no_node); - os_sc << "++++ old newobj: after end" << std::endl; + os_sc << "++++ old newobj: before end" << std::endl; } removeInst(onode->nInst); if (verboseLog) { Index: vm/jitrino/src/optimizer/escanalyzer.h =================================================================== --- vm/jitrino/src/optimizer/escanalyzer.h (revision 604113) +++ vm/jitrino/src/optimizer/escanalyzer.h (working copy) @@ -461,6 +461,13 @@ void printCnGNode(CnGNode* cgn,::std::ostream& os); /** +* Outputs method name information into the specified log. +* @param inst - call instruction, +* @param os - log stream +*/ +void printCallMethodName(Inst* inst, ::std::ostream& os); + +/** * Creates string representing CnG node type. * @param cgn - connection graph node. * @return srting representing CnG node type. Index: vm/jitrino/src/main/PMF.cpp =================================================================== --- vm/jitrino/src/main/PMF.cpp (revision 604113) +++ vm/jitrino/src/main/PMF.cpp (working copy) @@ -706,8 +706,6 @@ LogStreams::~LogStreams () { - assert(depth == 0); - LogStream* lsp; for (size_t sx = 0; sx != nbos; ++sx) if ((lsp = streams[sx])->enabled)