src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java

Print this page

        

*** 35,44 **** --- 35,45 ---- import java.util.List; import org.graalvm.compiler.bytecode.BytecodeDisassembler; import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.code.DisassemblerProvider; + import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.alloc.Trace; import org.graalvm.compiler.core.common.alloc.TraceBuilderResult; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; import org.graalvm.compiler.core.gen.NodeLIRBuilder; import org.graalvm.compiler.debug.DebugContext;
*** 70,79 **** --- 71,81 ---- public class CFGPrinterObserver implements DebugDumpHandler { private CFGPrinter cfgPrinter; private File cfgFile; private JavaMethod curMethod; + private CompilationIdentifier curCompilation; private List<String> curDecorators = Collections.emptyList(); @Override public void dump(DebugContext debug, Object object, String format, Object... arguments) { String message = String.format(format, arguments);
*** 90,125 **** * 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; 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(); } } else if (o instanceof DebugDumpScope) { DebugDumpScope debugDumpScope = (DebugDumpScope) o; if (debugDumpScope.decorator) { decorators.add(debugDumpScope.name); } } } ! if (method == null) { return false; } if (!method.equals(curMethod) || !curDecorators.equals(decorators)) { cfgPrinter.printCompilation(method); } curMethod = method; curDecorators = decorators; return true; } --- 92,139 ---- * 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; }
*** 275,284 **** --- 289,299 ---- if (cfgPrinter != null) { cfgPrinter.close(); cfgPrinter = null; curDecorators = Collections.emptyList(); curMethod = null; + curCompilation = null; } } public String getDumpPath() { if (cfgFile != null) {
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File