diff --git a/vm/jitrino/src/optimizer/escanalyzer.cpp b/vm/jitrino/src/optimizer/escanalyzer.cpp
index e00eb49..ef60a7b 100644
--- a/vm/jitrino/src/optimizer/escanalyzer.cpp
+++ b/vm/jitrino/src/optimizer/escanalyzer.cpp
@@ -1417,7 +1417,6 @@ EscAnalyzer::setCreatedObjectStates() {
} else {
Log::out() << " isNative: true" << std::endl;
}
-
}
if (verboseLog) {
Log::out() <<"--setSt 1: nodeId " <<(*it)->cngNodeId<<" opId "<<(*it)->opndId <<" state ";
@@ -2218,7 +2217,7 @@ EscAnalyzer::printCnGNodes(const char* t
inst->print(os);
if (inst->getOpcode()==Op_IndirectMemoryCall) {
os << std::endl; os << " ";
- printCallMethodName(inst, Log::out());
+ printCallMethodName(inst, os);
}
}
if ((*it)->nodeType & NT_ACTARG) { //node of actual method parameter
@@ -2227,7 +2226,7 @@ EscAnalyzer::printCnGNodes(const char* t
}
if ((*it)->nodeType & NT_STFLD) { //field node
Inst* inst = (Inst*)(*it)->refObj;
- inst->print(Log::out());
+ inst->print(os);
}
os << std::endl;
}
@@ -2398,8 +2397,8 @@ EscAnalyzer::printCnGNodeRefs(CnGNode* c
if (cgn->nodeType==NT_RETVAL) {
inst = cgn->nInst;
if (inst->getOpcode()==Op_IndirectMemoryCall) {
- os << text << " ";
- printCallMethodName(inst, Log::out());
+ os << text << " ";
+ printCallMethodName(inst, os);
os << std::endl;
}
}
@@ -2413,23 +2412,28 @@ EscAnalyzer::printCnGNodeRefs(CnGNode* c
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);
- }
-
+ 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 (inst->isMethod()) {
+ MethodDesc* md = inst->asMethodInst()->getMethodDesc();
+ md->printFullName(os);
+ } else if (srcInst->isMethod()) {
+ // Op_TauLdVirtFunAddrSlot
+ MethodDesc* md = srcInst->asMethodInst()->getMethodDesc();
+ md->printFullName(os);
+ } else if (srcInst->isVMHelperCallInst()) {
+ // A dst operand from VMHelperCallInst might also be srcInst for
+ // IndirectMemoryCall (for example, lazy resolution helper).
+ // There is no MethodDesc to print for such calls.
+ os << "some vmhelper";
+ } else {
+ assert(0);
+ }
+ os << std::endl;
} // printCallMethodName(Inst* inst, std::string text,::std::ostream& os)
void
@@ -2454,7 +2458,7 @@ EscAnalyzer::lObjectHistory(Inst* inst,s
}
if (inst->getOpcode()==Op_IndirectMemoryCall) {
os << text << " ";
- printCallMethodName(inst, Log::out());
+ printCallMethodName(inst, os);
os << std::endl;
}
return;
@@ -3988,7 +3992,7 @@ EscAnalyzer::doLOScalarReplacement(ObjId
if (loids == NULL)
return;
- if (loids->size() == 0)
+ if (loids->size() == 0)
return;
for (lo_it=loids->begin(); lo_it!=loids->end(); lo_it++) {
onode = findCnGNode_op(*lo_it);
@@ -4072,7 +4076,7 @@ EscAnalyzer::doLOScalarReplacement(ObjId
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();
@@ -4081,13 +4085,13 @@ EscAnalyzer::doLOScalarReplacement(ObjId
os_sc << "++++ old newobj removed: before" << std::endl;
FlowGraph::print(os_sc,no_node);
os_sc << "++++ old newobj: before end" << std::endl;
- }
+ }
removeInst(onode->nInst);
if (verboseLog) {
os_sc << "++++ old newobj removed: after" << std::endl;
FlowGraph::print(os_sc,no_node);
os_sc << "++++ old newobj: after end" << std::endl;
- }
+ }
}
}
} // doLOScalarReplacement(ObjIds* loids)
@@ -4112,7 +4116,7 @@ EscAnalyzer::doEOScalarReplacement(ObjId
if (loids == NULL)
return;
- if (loids->size() == 0)
+ if (loids->size() == 0)
return;
for (lo_it=loids->begin(); lo_it!=loids->end(); lo_it++) {
onode = findCnGNode_op(*lo_it);
@@ -4707,12 +4711,7 @@ EscAnalyzer::checkTauOpnd(Inst* tau_inst
os_sc << " "; FlowGraph::printLabel(os_sc,inst->getNode());
os_sc << " "; inst->print(os_sc); os_sc << std::endl;
if (opcode == Op_IndirectMemoryCall || opcode == Op_DirectCall) {
- MethodDesc* md = getMD(inst);
- if (md->isNative())
- os_sc << " native " << std::endl;
- if (opcode==Op_IndirectMemoryCall) {
- os_sc << " ";md->printFullName(os_sc); os_sc << std::endl;
- }
+ printCallMethodName(inst, os_sc);
}
}
if (opcode == Op_IndirectMemoryCall || opcode == Op_DirectCall) {
@@ -4781,12 +4780,7 @@ EscAnalyzer::checkOpndUsage(uint32 lobji
os_sc << " "; FlowGraph::printLabel(os_sc,inst->getNode());
os_sc << " "; inst->print(os_sc); os_sc << std::endl;
if (opcode == Op_IndirectMemoryCall || opcode == Op_DirectCall) {
- MethodDesc* md = getMD(inst);
- if (md->isNative())
- os_sc << " native " << std::endl;
- if (opcode==Op_IndirectMemoryCall) {
- os_sc << " ";md->printFullName(os_sc); os_sc << std::endl;
- }
+ printCallMethodName(inst, os_sc);
}
}
if (opcode != Op_LdFieldAddr && opcode != Op_LdArrayBaseAddr &&
@@ -4948,8 +4942,7 @@ EscAnalyzer::checkCnGtoScalarize(CnGNode
os_sc << std::endl << " ";
ii->print(os_sc); os_sc << std::endl;
if (ii->getOpcode()==Op_IndirectMemoryCall) {
- MethodDesc* md = getMD(ii);
- os_sc<<" ";md->printFullName(os_sc);os_sc << std::endl;
+ printCallMethodName(ii, os_sc);
}
}
}
@@ -5422,7 +5415,7 @@ EscAnalyzer::restoreEOCreation(Insts* vc
fg.addEdge(node_after1,node_after);
}
}
-
+
node_obj1=fg.splitNodeAtInstruction(newobj,splitAfter,false, _instFactory.makeLabel());
fg.addEdge(node_obj,dispatchNode);
@@ -5473,23 +5466,6 @@ EscAnalyzer::removeInst(Inst* reminst) {
}
} // removeInst(Inst* reminst)
-
-MethodDesc*
-EscAnalyzer::getMD(Inst* inst) {
- MethodDesc* md;
- if (inst->getOpcode()==Op_DirectCall)
- return inst->asMethodCallInst()->getMethodDesc();
- if (inst->getOpcode()!=Op_IndirectMemoryCall)
- return NULL;
- if (inst->getSrc(0)->getInst()->getOpcode()== Op_LdVar) {
- md = inst->getSrc(0)->getType()->asMethodPtrType()->getMethodDesc();
- } else {
- md = inst->getSrc(0)->getInst()->asMethodInst()->getMethodDesc();
- }
- return md;
-}
-
-
void
EscAnalyzer::fixMethodEndInsts(uint32 ob_id) {
Insts::iterator itmei;
@@ -5499,7 +5475,7 @@ EscAnalyzer::fixMethodEndInsts(uint32 ob
Inst* mei = *itmei;
uint32 i = 0;
uint32 nsrc = mei->getNumSrcOperands();
-
+
if (nsrc == 0)
continue;
Opnd* o = mei->getSrc(i);
@@ -5590,7 +5566,7 @@ EscAnalyzer::checkVVarSrcs(Inst* inst) {
break;
}
}
-
+
if (inst->getOpcode()==Op_DirectCall || inst->getOpcode()==Op_IndirectMemoryCall) {
return false;
}
@@ -5649,7 +5625,7 @@ EscAnalyzer::checkObjectType(const char*
|| (strcmp(otn,"java/lang/Long$valueOfCache") == 0)
|| (strcmp(otn,"java/lang/Character$valueOfCache") == 0) ) {
return true;
- }
+ }
return false;
}
diff --git a/vm/jitrino/src/optimizer/escanalyzer.h b/vm/jitrino/src/optimizer/escanalyzer.h
index 7af8182..c5dda18 100644
--- a/vm/jitrino/src/optimizer/escanalyzer.h
+++ b/vm/jitrino/src/optimizer/escanalyzer.h
@@ -936,14 +936,6 @@ void printCallMethodName(Inst* inst, ::s
void removeInst(Inst* reminst);
/**
- * Returns MethodDesc* for Op_IndirectMemoryCall and Op_DirectCall instructions.
- * @param inst - call instruction.
- * @return MethodDesc for Op_IndirectMemoryCall and Op_DirectCall;
- * NULL otherwise.
- */
- MethodDesc* getMD(Inst* inst);
-
-/**
* Replaces first source operand of Op_MethodEnd instruction by NULL
* for scalar replacement optimized object.
* @param ob_id - optimized object Id.