I try to get CFG of the callee of current method with the following code
just like the escape analysis pass does. But I found the methodDesc of some
callees was abnormal, the ByteCode size is 0 and the ByteCode Address is
invalid. Why does this happen?
//call is a method invoke instruction
MethodDesc* methodDesc = 0;
if (call == NULL) { // scanned Op_DirectCall, not scanned
Op_IndirectMemoryCall
return true;
}
methodDesc = call->asMethodCallInst()->getMethodDesc();
OpndManager& _opndManager(irManager.getOpndManager());
Opnd *returnOpnd = 0;
if(call->getDst()->isNull())
returnOpnd = _opndManager.getNullOpnd();
else
returnOpnd = _opndManager.createSsaTmpOpnd(call->getDst()->getType());
IRManager* inlinedIRM = new (mm) IRManager(irManager.getMemoryManager(),
irManager, *methodDesc, returnOpnd);
CompilationInterface& ci= inlinedIRM->getCompilationInterface();
bool cibcmap = ci.isBCMapInfoRequired();
if (cibcmap) {
ci.setBCMapInfoRequired(false);
}
CompilationContext inlineCC(irManager.getMemoryManager(), &ci,
irManager.getCurrentJITContext());
inlineCC.setPipeline(irManager.getCompilationContext()->getPipeline());
inlineCC.setHIRManager(inlinedIRM);
TranslatorSession* traSession =
(TranslatorSession*)translatorAction->createSession(
inlineCC.getCompilationLevelMemoryManager());
traSession->setCompilationContext(&inlineCC);
inlineCC.setCurrentSessionAction(traSession);
traSession->run();
inlineCC.setCurrentSessionAction(NULL);