use of com.jopdesign.jcopter.greedy.Candidate in project jop by jop-devel.
the class InlineOptimizer method findCandidates.
@Override
public Collection<Candidate> findCandidates(MethodInfo method, AnalysisManager analyses, StacksizeAnalysis stacksize, int maxLocals, InstructionHandle start, InstructionHandle end) {
List<Candidate> candidates = new LinkedList<Candidate>();
MethodCode code = method.getCode();
InstructionHandle next = end.getNext();
for (InstructionHandle ih = start; ih != next; ih = ih.getNext()) {
if (code.isInvokeSite(ih)) {
InvokeSite site = code.getInvokeSite(ih);
// since we update the appInfo callgraph, the callstring only contains the invokesite and no
// inlined methods
CallString cs = new CallString(site);
countInvokeSites++;
MethodInfo invokee = helper.devirtualize(cs);
if (invokee == null)
continue;
countDevirtualized++;
// for the initial check and the DFA lookup we need the old callstring
cs = getInlineCallString(code, ih).push(site);
Candidate candidate = checkInvoke(code, cs, site, invokee, maxLocals);
if (candidate == null) {
continue;
}
// initial check for locals and stack, calculate gain and codesize
if (!candidate.recalculate(analyses, stacksize)) {
continue;
}
candidates.add(candidate);
}
}
return candidates;
}
Aggregations