Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fc50896
Trace total time in HierarchicalLayoutManager
tkrodriguez Oct 27, 2025
586c603
Add stress test harness
tkrodriguez Oct 30, 2025
1dfa2e6
Complain about $ in file names passed to the launcher
tkrodriguez Oct 29, 2025
ae2c7d0
Add -g to build
tkrodriguez Oct 27, 2025
3029589
Support bulk removal of figures
tkrodriguez Oct 27, 2025
92c641d
Allowing caching of filter creation and speed up colorize filter
tkrodriguez Oct 27, 2025
3b47212
Reduce use of TreeSet
tkrodriguez Oct 27, 2025
33a595f
Track vip edges on insertion
tkrodriguez Oct 27, 2025
2eab8b4
Iterate connections instead of duplicating thems
tkrodriguez Oct 27, 2025
5bc2a52
reverse the array instead of sorting again in reverse order
tkrodriguez Oct 27, 2025
50b2bb7
Cache isRoot computation
tkrodriguez Oct 27, 2025
f002da4
Avoid wrapping inputs and outputs when computing widths
tkrodriguez Oct 27, 2025
b02ade1
Cache preference settings
tkrodriguez Oct 27, 2025
44e8664
Collection cleanups, stream removal and other minor cleanups
tkrodriguez Oct 27, 2025
6f52a8f
Use parallelSort for links
tkrodriguez Oct 27, 2025
2ccb529
Comparator cleanup
tkrodriguez Oct 27, 2025
4501ea2
add enable-native-access
tkrodriguez Oct 27, 2025
b215a73
Parser speeedups
tkrodriguez Oct 29, 2025
e4f6c13
faster check for reserved property names
tkrodriguez Oct 30, 2025
69d91a6
slightly faster Properties comparison
tkrodriguez Oct 30, 2025
86dea04
Remove unnecessary add-export
tkrodriguez Nov 3, 2025
6bac7d5
remove argument
tkrodriguez Nov 3, 2025
9f73c70
AssignLayers may not converge for some cases so bail out after excess…
tkrodriguez Nov 3, 2025
120e279
Fix licenses
tkrodriguez Nov 4, 2025
d698493
reduce output from visualizer task
tkrodriguez Nov 4, 2025
2711928
Sync jdk.graal.compiler.graphio.parsing
tkrodriguez Nov 5, 2025
7019373
[maven-release-plugin] prepare release idealgraphvisualizer-1.23
tkrodriguez Nov 5, 2025
4543ff4
[maven-release-plugin] prepare for next development iteration
tkrodriguez Nov 5, 2025
8039392
Update IDEALGRAPHVISUALIZER_DIST
tkrodriguez Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@
"digest" : "sha512:40c505dd03ca0bb102f1091b89b90672126922f290bd8370eef9a7afc5d9c1e7b5db08c448a0948ef46bf57d850e166813e2d68bf7b1c88a46256d839b6b0201",
"packedResource": True,
},

"IDEALGRAPHVISUALIZER_DIST" : {
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/idealgraphvisualizer/idealgraphvisualizer-1.22-6cb0d3acbb1.zip"],
"digest" : "sha512:8c4795fae203bfa84c40b041fe6d0f46a89bd8b975120d28aea9483eef1c1b63ab685716c1258387c12a255560904284fd0bf9aa947f2efabc4a629148000b5d",
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/idealgraphvisualizer/idealgraphvisualizer-1.23-4543ff4a3e5.zip"],
"digest" : "sha512:2c779c8a01ab4cc7b77e1497ca97641799bb934309ac1306ae8383ab4efdd7af50bbd1bf55438c742e4159b581e69476a2dd8023af0f105433992a35454bdbf0",
"packedResource": True,
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
public class BinaryReader implements GraphParser, ModelControl {
private static final Logger LOG = Logger.getLogger(BinaryReader.class.getName());

static final boolean TRACE_PARSE_TIME = false;

private final Logger instLog;

private final DataSource dataSource;
Expand Down Expand Up @@ -472,15 +474,33 @@ public boolean equals(Object obj) {

public static final class EnumKlass extends Klass {
public final String[] values;
public final EnumValue[] enums;
private volatile int hashCode = 0;

public EnumKlass(String name, String[] values) {
super(name);
this.values = values;
this.enums = new EnumValue[values.length];
for (int i = 0; i < values.length; i++) {
this.enums[i] = new EnumValue(this, i);
}
}

EnumValue get(int ordinal) {
if (ordinal >= 0 && ordinal < enums.length) {
return enums[ordinal];
}
return new EnumValue(this, ordinal);
}

@Override
public int hashCode() {
return super.hash * 31 + Arrays.hashCode(values);
int h = hashCode;
if (h == 0) {
h = Objects.hash(super.hashCode(), Arrays.hashCode(values));
hashCode = h;
}
return h;
}

@Override
Expand Down Expand Up @@ -646,7 +666,7 @@ private Object addPoolEntry(Class<?> klass) throws IOException {
case POOL_ENUM: {
EnumKlass enumClass = readPoolObject(EnumKlass.class);
int ordinal = dataSource.readInt();
obj = new EnumValue(enumClass, ordinal);
obj = enumClass.get(ordinal);
break;
}
case POOL_NODE_CLASS: {
Expand Down Expand Up @@ -808,6 +828,7 @@ public GraphDocument parse() throws IOException {
hashStack.push(null);

boolean restart = false;
long start = System.nanoTime();
try {
while (true) { // TERMINATION ARGUMENT: finite length of data source will result in
// EOFException eventually.
Expand All @@ -831,6 +852,11 @@ public GraphDocument parse() throws IOException {
} finally {
// also terminates the builder
closeDanglingGroups();
if (TRACE_PARSE_TIME) {
long end = System.nanoTime();
System.err.println(((System.nanoTime() - timeStart) / 1_000_000) + " Parsed file in " + ((end - start) / 1_000_000) + " ms");
}

}
return builder.rootDocument();
}
Expand Down Expand Up @@ -990,7 +1016,10 @@ private InputGraph parseGraph(String title, boolean toplevel) throws IOException
}
}

private static final long timeStart = System.nanoTime();

private InputGraph parseGraph(int dumpId, String format, Object[] args, boolean toplevel) throws IOException {
long start = System.nanoTime();
InputGraph g = builder.startGraph(dumpId, format, args);
try {
parseProperties();
Expand All @@ -1014,6 +1043,10 @@ private InputGraph parseGraph(int dumpId, String format, Object[] args, boolean
// we have to finish the graph.
reporter.popContext();
g = builder.endGraph();
if (TRACE_PARSE_TIME) {
long end = System.nanoTime();
System.err.println(((System.nanoTime() - timeStart) / 1_000_000) + " Parsed " + dumpId + " " + String.format(format, args) + " in " + ((end - start) / 1000000) + " ms");
}
}
return g;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import jdk.graal.compiler.graphio.parsing.BinaryReader.EnumValue;
import jdk.graal.compiler.graphio.parsing.BinaryReader.Method;
import jdk.graal.compiler.graphio.parsing.TemplateParser.TemplatePart;
import jdk.graal.compiler.graphio.parsing.model.GraphDocument;
import jdk.graal.compiler.graphio.parsing.model.Group;
import jdk.graal.compiler.graphio.parsing.model.InputBlock;
Expand Down Expand Up @@ -219,16 +220,23 @@ public String toString() {
final class NodeClass {
public final String className;
public final String nameTemplate;
private final List<TemplatePart> templateParts;
public final List<TypedPort> inputs;
public final List<Port> sux;
private String shortString;

NodeClass(String className, String nameTemplate, List<TypedPort> inputs, List<Port> sux) {
this.className = className;
this.nameTemplate = nameTemplate;
this.templateParts = jdk.graal.compiler.graphio.parsing.TemplateParser.parseTemplate(nameTemplate);
this.inputs = inputs;
this.sux = sux;
}

public List<TemplatePart> getTemplateParts() {
return templateParts;
}

@Override
public String toString() {
return className;
Expand Down Expand Up @@ -265,13 +273,18 @@ public boolean equals(Object obj) {
}

String toShortString() {
int lastDot = className.lastIndexOf('.');
String localShortName = className.substring(lastDot + 1);
if (localShortName.endsWith("Node") && !localShortName.equals("StartNode") && !localShortName.equals(CLASS_ENDNODE)) {
return localShortName.substring(0, localShortName.length() - 4);
} else {
return localShortName;
String s = shortString;
if (s == null) {
int lastDot = className.lastIndexOf('.');
String localShortName = className.substring(lastDot + 1);
if (localShortName.endsWith("Node") && !localShortName.equals("StartNode") && !localShortName.equals(CLASS_ENDNODE)) {
s = localShortName.substring(0, localShortName.length() - 4);
} else {
s = localShortName;
}
shortString = s;
}
return shortString;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
import java.util.Objects;
import java.util.Set;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import jdk.graal.compiler.graphio.parsing.BinaryReader.EnumValue;
import jdk.graal.compiler.graphio.parsing.BinaryReader.Method;
Expand Down Expand Up @@ -662,6 +660,14 @@ public void endNode(int nodeId) {
PROPNAME_ID,
PROPNAME_IDX, PROPNAME_BLOCK)));

private static boolean isSystemProperty(String key) {
return switch (key) {
case PROPNAME_HAS_PREDECESSOR, PROPNAME_NAME, PROPNAME_CLASS, PROPNAME_ID, PROPNAME_IDX, PROPNAME_BLOCK ->
true;
default -> false;
};
}

@Override
public void setGroupName(String name, String shortName) {
assert folder instanceof Group;
Expand All @@ -684,7 +690,7 @@ protected final void reportProgress() {
@Override
public void setNodeName(NodeClass nodeClass) {
assert currentNode != null;
getProperties().setProperty(PROPNAME_NAME, createName(nodeClass, nodeEdges, nodeClass.nameTemplate));
getProperties().setProperty(PROPNAME_NAME, createName(nodeClass, nodeEdges));
getProperties().setProperty(PROPNAME_CLASS, nodeClass.className);
switch (nodeClass.className) {
case "BeginNode":
Expand All @@ -696,35 +702,38 @@ public void setNodeName(NodeClass nodeClass) {
}
}

static final Pattern TEMPLATE_PATTERN = Pattern.compile("\\{([pi])#([a-zA-Z0-9$_]+)(/([lms]))?}");

private String createName(NodeClass nodeClass, List<EdgeInfo> edges, String template) {
if (template.isEmpty()) {
private String createName(NodeClass nodeClass, List<EdgeInfo> edges) {
if (nodeClass.nameTemplate.isEmpty()) {
return nodeClass.toShortString();
}
Matcher m = TEMPLATE_PATTERN.matcher(template);
StringBuilder sb = new StringBuilder();

StringBuilder sb = new StringBuilder(nodeClass.nameTemplate.length());
Properties p = getProperties();
while (m.find()) {
String name = m.group(2);
String type = m.group(1);
String result;
List<TemplateParser.TemplatePart> templateParts = nodeClass.getTemplateParts();
for (TemplateParser.TemplatePart template : templateParts) {
if (!template.isReplacement) {
sb.append(template.value);
continue;
}
String name = template.name;
String type = template.type;
switch (type) {
case "i":
StringBuilder inputString = new StringBuilder();
boolean first = true;
for (EdgeInfo edge : edges) {
if (edge.label.startsWith(name) && (name.length() == edge.label.length() || edge.label.charAt(name.length()) == '[')) {
if (inputString.length() > 0) {
inputString.append(", ");
if (!first) {
sb.append(", ");
}
inputString.append(edge.from);
first = false;
sb.append(edge.from);
}
}
result = inputString.toString();
break;
case "p":
Object prop = p.get(name);
String length = m.group(4);
String length = template.length;
String result;
if (prop == null) {
result = "?";
} else if (length != null && prop instanceof LengthToString lengthProp) {
Expand All @@ -735,36 +744,21 @@ private String createName(NodeClass nodeClass, List<EdgeInfo> edges, String temp
case "m":
result = lengthProp.toString(Length.M);
break;
default:
case "l":
default:
result = lengthProp.toString(Length.L);
break;
}
} else {
result = prop.toString();
}
sb.append(result);
break;
default:
result = "#?#";
sb.append("#?#");
break;
}

// Escape '\' and '$' to not interfere with the regular expression.
StringBuilder newResult = new StringBuilder();
for (int i = 0; i < result.length(); ++i) {
char c = result.charAt(i);
if (c == '\\') {
newResult.append("\\\\");
} else if (c == '$') {
newResult.append("\\$");
} else {
newResult.append(c);
}
}
result = newResult.toString();
m.appendReplacement(sb, result);
}
m.appendTail(sb);
return sb.toString();
}

Expand All @@ -775,7 +769,7 @@ public void setNodeProperty(String key, Object value) {
assert currentNode != null;
String k = key;
if (!(value instanceof InputGraph)) {
if (SYSTEM_PROPERTIES.contains(key)) {
if (isSystemProperty(key)) {
k = NOT_DATA + k;
}
setProperty(k, value);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.graal.compiler.graphio.parsing;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TemplateParser {
private static final Pattern TEMPLATE_PATTERN = Pattern.compile("\\{([pi])#([a-zA-Z0-9$_]+)(/([lms]))?}");

public static List<TemplatePart> parseTemplate(String template) {
List<TemplatePart> parts = new ArrayList<>();
Matcher m = TEMPLATE_PATTERN.matcher(template);
int lastEnd = 0;
while (m.find()) {
if (m.start() > lastEnd) {
parts.add(new TemplatePart(template.substring(lastEnd, m.start())));
}
String name = m.group(2);
String type = m.group(1);
switch (type) {
case "i":
parts.add(new TemplatePart(name, type, null));
break;
case "p":
String length = m.group(4);
parts.add(new TemplatePart(name, type, length));
break;
default:
parts.add(new TemplatePart("#?#"));
break;
}
lastEnd = m.end();
}
if (lastEnd < template.length()) {
parts.add(new TemplatePart(template.substring(lastEnd)));
}
return parts;
}

public static class TemplatePart {
public final String value;
public final boolean isReplacement;
public final String name;
public final String type;
public final String length;

public TemplatePart(String name, String type, String length) {
this.name = name;
this.type = type;
this.length = length;
this.value = null;
this.isReplacement = true;
}

public TemplatePart(String value) {
this.value = value;
this.isReplacement = false;
name = null;
type = null;
length = null;
}
}
}
Loading