org.adoptopenjdk.jitwatch.optimizedvcall.OptimizedVirtualCallVisitable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
A Maven plugin that scans the project artifact and its dependencies for methods that cannot be inlined by the JIT
compiler. It uses the JarScan utility from the JITWatch project to do that.
See https://github.com/AdoptOpenJDK/jitwatch .
The newest version!
/*
* Copyright (c) 2013-2015 Chris Newland.
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/
package org.adoptopenjdk.jitwatch.optimizedvcall;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.adoptopenjdk.jitwatch.model.IMetaMember;
import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel;
import org.adoptopenjdk.jitwatch.treevisitor.ITreeVisitable;
import org.adoptopenjdk.jitwatch.treevisitor.TreeVisitor;
public class OptimizedVirtualCallVisitable implements ITreeVisitable
{
private List optimizedVCallReport = new ArrayList<>();
private OptimizedVirtualCallFinder finder;
public List buildOptimizedCalleeReport(IReadOnlyJITDataModel model, List classLocations)
{
finder = new OptimizedVirtualCallFinder(model, classLocations);
TreeVisitor.walkTree(model, this);
Collections.sort(optimizedVCallReport, new Comparator()
{
@Override
public int compare(OptimizedVirtualCall o1, OptimizedVirtualCall o2)
{
return o1.getCallerMember().getFullyQualifiedMemberName()
.compareTo(o2.getCallerMember().getFullyQualifiedMemberName());
}
});
return optimizedVCallReport;
}
@Override
public void reset()
{
optimizedVCallReport.clear();
}
@Override
public void visit(IMetaMember member)
{
List vCallsForMember = finder.findOptimizedCalls(member);
optimizedVCallReport.addAll(vCallsForMember);
}
}