use of jdk.vm.ci.meta.JavaMethod in project graal by oracle.
the class DebugConfigImpl method checkMethodFilter.
private boolean checkMethodFilter(DebugContext.Scope scope) {
if (methodFilter == null) {
return true;
} else {
JavaMethod lastMethod = null;
Iterable<Object> context = scope.getCurrentContext();
for (Object o : context) {
if (methodFilter != null) {
JavaMethod method = DebugConfig.asJavaMethod(o);
if (method != null) {
if (!DebugOptions.MethodFilterRootOnly.getValue(options)) {
if (org.graalvm.compiler.debug.MethodFilter.matches(methodFilter, method)) {
return true;
}
} else {
/*
* The context values operate as a stack so if we want MethodFilter to
* only apply to the root method we have to check only the last method
* seen.
*/
lastMethod = method;
}
}
}
}
if (lastMethod != null && org.graalvm.compiler.debug.MethodFilter.matches(methodFilter, lastMethod)) {
return true;
}
return false;
}
}
use of jdk.vm.ci.meta.JavaMethod in project graal by oracle.
the class CFGPrinterObserver method checkMethodScope.
/**
* Looks for the outer most method and its {@link DebugDumpScope#decorator}s in the current
* debug scope and opens a new compilation scope if this pair does not match the current method
* and decorator pair.
*/
private boolean checkMethodScope(DebugContext debug) {
JavaMethod method = null;
CompilationIdentifier compilation = null;
ArrayList<String> decorators = new ArrayList<>();
for (Object o : debug.context()) {
if (o instanceof JavaMethod) {
method = (JavaMethod) o;
decorators.clear();
} else if (o instanceof StructuredGraph) {
StructuredGraph graph = (StructuredGraph) o;
if (graph.method() != null) {
method = graph.method();
decorators.clear();
compilation = graph.compilationId();
}
} else if (o instanceof DebugDumpScope) {
DebugDumpScope debugDumpScope = (DebugDumpScope) o;
if (debugDumpScope.decorator) {
decorators.add(debugDumpScope.name);
}
} else if (o instanceof CompilationResult) {
CompilationResult compilationResult = (CompilationResult) o;
compilation = compilationResult.getCompilationId();
}
}
if (method == null && compilation == null) {
return false;
}
if (compilation != null) {
if (!compilation.equals(curCompilation) || !curDecorators.equals(decorators)) {
cfgPrinter.printCompilation(compilation);
}
} else {
if (!method.equals(curMethod) || !curDecorators.equals(decorators)) {
cfgPrinter.printCompilation(method);
}
}
curCompilation = compilation;
curMethod = method;
curDecorators = decorators;
return true;
}
use of jdk.vm.ci.meta.JavaMethod in project graal by oracle.
the class GraphPrinterDumpHandler method getInlineContext.
private List<String> getInlineContext(Graph graph) {
List<String> result = inlineContextMap.get(graph);
if (result == null) {
result = new ArrayList<>();
Object lastMethodOrGraph = null;
boolean graphSeen = false;
DebugContext debug = graph.getDebug();
for (Object o : debug.context()) {
if (o == graph) {
graphSeen = true;
}
if (o instanceof DebugDumpScope) {
DebugDumpScope debugDumpScope = (DebugDumpScope) o;
if (debugDumpScope.decorator && !result.isEmpty()) {
result.set(result.size() - 1, debugDumpScope.name + ":" + result.get(result.size() - 1));
} else {
result.add(debugDumpScope.name);
}
} else {
addMethodContext(result, o, lastMethodOrGraph);
}
if (o instanceof JavaMethod || o instanceof Graph) {
lastMethodOrGraph = o;
}
}
if (result.size() == 2 && result.get(1).startsWith("TruffleGraal")) {
result.clear();
result.add("Graal Graphs");
}
if (result.isEmpty()) {
result.add(graph.toString());
graphSeen = true;
}
// Reverse list such that inner method comes after outer method.
Collections.reverse(result);
if (!graphSeen) {
/*
* The graph isn't in any context but is being processed within another graph so add
* it to the end of the scopes.
*/
if (asJavaMethod(graph) != null) {
addMethodContext(result, graph, lastMethodOrGraph);
} else {
result.add(graph.toString());
}
}
inlineContextMap.put(graph, result);
}
return result;
}
Aggregations