src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java Fri Jul 7 09:31:38 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java Fri Jul 7 09:31:38 2017
*** 28,39 ****
--- 28,43 ----
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
+ import org.graalvm.compiler.debug.DebugContext;
+ import org.graalvm.compiler.debug.DebugContext.Scope;
import org.graalvm.compiler.graph.Graph;
import org.graalvm.compiler.nodes.ConstantNode;
+ import org.graalvm.compiler.nodes.StructuredGraph;
+ import org.graalvm.compiler.phases.schedule.SchedulePhase;
import org.graalvm.compiler.serviceprovider.JDK9Method;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
*** 46,67 ****
--- 50,69 ----
/**
* Starts a new group of graphs with the given name, short name and method byte code index (BCI)
* as properties.
*/
! void beginGroup(DebugContext debug, String name, String shortName, ResolvedJavaMethod method, int bci, Map<Object, Object> properties) throws IOException;
/**
* Prints an entire {@link Graph} with the specified title, optionally using short names for
* nodes.
*/
! void print(DebugContext debug, Graph graph, Map<Object, Object> properties, int id, String format, Object... args) throws IOException;
SnippetReflectionProvider getSnippetReflectionProvider();
void setSnippetReflectionProvider(SnippetReflectionProvider snippetReflection);
/**
* Ends the current group.
*/
void endGroup() throws IOException;
*** 140,163 ****
--- 142,175 ----
}
}
}
}
default String formatTitle(int id, String format, Object... args) {
/*
! * If an argument is a Class, replace it with the simple name.
! */
Object[] newArgs = new Object[args.length];
for (int i = 0; i < newArgs.length; i++) {
+ /**
+ * Replaces all {@link JavaType} elements in {@code args} with the result of
! * {@link JavaType#getUnqualifiedName()}.
+ *
+ * @return a copy of {@code args} with the above mentioned substitutions or {@code args} if no
+ * substitutions were performed
+ */
+ default Object[] simplifyClassArgs(Object... args) {
+ Object[] res = args;
+ for (int i = 0; i < args.length; i++) {
Object arg = args[i];
if (arg instanceof JavaType) {
newArgs[i] = ((JavaType) arg).getUnqualifiedName();
+ if (args == res) {
+ res = new Object[args.length];
+ for (int a = 0; a < i; a++) {
+ res[a] = args[a];
+ }
+ }
+ res[i] = ((JavaType) arg).getUnqualifiedName();
} else {
! newArgs[i] = arg;
! res[i] = arg;
}
}
! return id + ": " + String.format(format, newArgs);
! return res;
}
static String truncate(String s) {
if (s.length() > MAX_CONSTANT_TO_STRING_LENGTH) {
return s.substring(0, MAX_CONSTANT_TO_STRING_LENGTH - 3) + "...";
*** 196,201 ****
--- 208,232 ----
buf.append(", ");
}
}
return buf.append('}').toString();
}
+
+ @SuppressWarnings("try")
+ static StructuredGraph.ScheduleResult getScheduleOrNull(Graph graph) {
+ if (graph instanceof StructuredGraph) {
+ StructuredGraph sgraph = (StructuredGraph) graph;
+ StructuredGraph.ScheduleResult scheduleResult = sgraph.getLastSchedule();
+ if (scheduleResult == null) {
+ DebugContext debug = graph.getDebug();
+ try (Scope scope = debug.disable()) {
+ SchedulePhase schedule = new SchedulePhase(graph.getOptions());
+ schedule.apply(sgraph);
+ scheduleResult = sgraph.getLastSchedule();
+ } catch (Throwable t) {
+ }
+ }
+ return scheduleResult;
+ }
+ return null;
+ }
}
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File