All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.adoptopenjdk.jitwatch.optimizedvcall.OptimizedVirtualCallVisitable Maven / Gradle / Ivy

Go to download

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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy