Skip to content

Commit

Permalink
Merge master HEAD into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Aug 30, 2023
2 parents cf2025f + 00f440d commit c4185f4
Show file tree
Hide file tree
Showing 45 changed files with 4,112 additions and 905 deletions.
4 changes: 0 additions & 4 deletions make/Docs.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) )
# In order to get a specific ordering it's necessary to specify the total
# ordering of tags as the tags are otherwise ordered in order of definition.
JAVADOC_TAGS := \
-tag beaninfo:X \
-tag since.unbundled:X \
-tag Note:X \
-tag ToDo:X \
-tag 'apiNote:a:API Note:' \
-tag 'implSpec:a:Implementation Requirements:' \
-tag 'implNote:a:Implementation Note:' \
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/unix/classes/sun/nio/fs/UnixPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.nio.file.spi.FileSystemProvider;
import java.util.Arrays;
import java.util.Objects;

Expand Down Expand Up @@ -90,8 +89,9 @@ static String normalizeAndCheck(String input) {
checkNotNul(input, c);
prevChar = c;
}
if (prevChar == '/')
return normalize(input, n, n - 1);
if (prevChar == '/' && n > 1) {
return input.substring(0, n - 1);
}
return input;
}

Expand All @@ -109,7 +109,7 @@ private static String normalize(String input, int len, int off) {
return "/";
StringBuilder sb = new StringBuilder(input.length());
if (off > 0)
sb.append(input.substring(0, off));
sb.append(input, 0, off);
char prevChar = 0;
for (int i=off; i < n; i++) {
char c = input.charAt(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,19 @@ public Dimension getSize() {
return new Dimension(width, height);
}

@Override
public boolean equals(Object o) {
if (!(o instanceof Figure)) {
return false;
}
return getInputNode().equals(((Figure) o).getInputNode());
}

@Override
public int hashCode() {
return getInputNode().hashCode();
}

@Override
public String toString() {
return idString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,17 @@ public boolean hasSlots() {
return true;
}

@Override
public boolean equals(Object o) {
if (!(o instanceof FigureConnection)) {
return false;
}

return getInputSlot().getFigure().equals(((FigureConnection)o).getInputSlot().getFigure())
&& getOutputSlot().getFigure().equals(((FigureConnection)o).getOutputSlot().getFigure())
&& getInputSlot().getPosition() == ((FigureConnection)o).getInputSlot().getPosition()
&& getOutputSlot().getPosition() == ((FigureConnection) o).getOutputSlot().getPosition();
}

}

7 changes: 6 additions & 1 deletion src/utils/IdealGraphVisualizer/HierarchicalLayout/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -51,6 +51,11 @@
<artifactId>Layout</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sun.hotspot.igv</groupId>
<artifactId>Util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2023, 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
Expand Down Expand Up @@ -27,6 +27,7 @@
import com.sun.hotspot.igv.layout.LayoutManager;
import com.sun.hotspot.igv.layout.Link;
import com.sun.hotspot.igv.layout.Vertex;
import com.sun.hotspot.igv.util.Statistics;
import java.awt.Dimension;
import java.awt.Point;
import java.util.*;
Expand Down Expand Up @@ -79,49 +80,6 @@ public enum Combine {
private Set<? extends Link> importantLinks;
private final Set<Link> linksToFollow;

private class LayoutNode {

public int x;
public int y;
public int width;
public int height;
public int layer = -1;
public int xOffset;
public int yOffset;
public int bottomYOffset;
public Vertex vertex; // Only used for non-dummy nodes, otherwise null

public List<LayoutEdge> preds = new ArrayList<>();
public List<LayoutEdge> succs = new ArrayList<>();
public HashMap<Integer, Integer> outOffsets = new HashMap<>();
public HashMap<Integer, Integer> inOffsets = new HashMap<>();
public int pos = -1; // Position within layer

public int crossingNumber;

@Override
public String toString() {
return "Node " + vertex;
}
}

private class LayoutEdge {

public LayoutNode from;
public LayoutNode to;
// Horizontal distance relative to start of 'from'.
public int relativeFrom;
// Horizontal distance relative to start of 'to'.
public int relativeTo;
public Link link;
public boolean vip;

@Override
public String toString() {
return "Edge " + from + ", " + to;
}
}

private abstract static class AlgorithmPart {

public void start() {
Expand Down Expand Up @@ -190,6 +148,10 @@ public void setLayoutSelfEdges(boolean layoutSelfEdges) {
this.layoutSelfEdges = layoutSelfEdges;
}

public List<LayoutNode> getNodes() {
return nodes;
}

// Remove self-edges, possibly saving them into the selfEdges set.
private void removeSelfEdges(boolean save) {
for (LayoutNode node : nodes) {
Expand Down Expand Up @@ -305,7 +267,7 @@ protected void run() {
for (LayoutNode n : nodes) {

for (LayoutEdge e : n.preds) {
if (e.link != null) {
if (e.link != null && !linkPositions.containsKey(e.link)) {
ArrayList<Point> points = new ArrayList<>();

Point p = new Point(e.to.x + e.relativeTo, e.to.y + e.to.yOffset + e.link.getTo().getRelativePosition().y);
Expand Down Expand Up @@ -386,14 +348,11 @@ protected void run() {
linkPositions.put(e.link, points);
}
pointCount += points.size();

// No longer needed!
e.link = null;
}
}

for (LayoutEdge e : n.succs) {
if (e.link != null) {
if (e.link != null && !linkPositions.containsKey(e.link)) {
ArrayList<Point> points = new ArrayList<>();
Point p = new Point(e.from.x + e.relativeFrom, e.from.y + e.from.height - e.from.bottomYOffset + e.link.getFrom().getRelativePosition().y);
points.add(p);
Expand Down Expand Up @@ -470,7 +429,6 @@ protected void run() {
}

pointCount += points.size();
e.link = null;
}
}
}
Expand Down Expand Up @@ -526,8 +484,8 @@ protected void printStatistics() {
}
}

private static final Comparator<LayoutNode> nodePositionComparator = Comparator.comparingInt(n -> n.pos);
private static final Comparator<LayoutNode> nodeProcessingDownComparator = (n1, n2) -> {
public static final Comparator<LayoutNode> nodePositionComparator = Comparator.comparingInt(n -> n.pos);
public static final Comparator<LayoutNode> nodeProcessingDownComparator = (n1, n2) -> {
int n1VIP = 0;
for (LayoutEdge e : n1.preds) {
if (e.vip) {
Expand All @@ -554,7 +512,7 @@ protected void printStatistics() {
}
return n1.preds.size() - n2.preds.size();
};
private static final Comparator<LayoutNode> nodeProcessingUpComparator = (n1, n2) -> {
public static final Comparator<LayoutNode> nodeProcessingUpComparator = (n1, n2) -> {
int n1VIP = 0;
for (LayoutEdge e : n1.succs) {
if (e.vip) {
Expand Down Expand Up @@ -661,7 +619,7 @@ private int calculateOptimalDown(LayoutNode n) {
LayoutEdge e = n.preds.get(i);
values[i] = e.from.x + e.relativeFrom - e.relativeTo;
}
return median(values);
return Statistics.median(values);
} else {
int z = 0;
int[] values = new int[vipCount];
Expand All @@ -671,7 +629,7 @@ private int calculateOptimalDown(LayoutNode n) {
values[z++] = e.from.x + e.relativeFrom - e.relativeTo;
}
}
return median(values);
return Statistics.median(values);
}
}

Expand All @@ -693,7 +651,7 @@ private int calculateOptimalBoth(LayoutNode n) {
i++;
}

return median(values);
return Statistics.median(values);
}

private int calculateOptimalUp(LayoutNode n) {
Expand All @@ -709,16 +667,7 @@ private int calculateOptimalUp(LayoutNode n) {
return values[i];
}
}
return median(values);
}

private int median(int[] values) {
Arrays.sort(values);
if (values.length % 2 == 0) {
return (values[values.length / 2 - 1] + values[values.length / 2]) / 2;
} else {
return values[values.length / 2];
}
return Statistics.median(values);
}

private void sweepUp() {
Expand All @@ -742,7 +691,7 @@ private void sweepDown() {
}
}

private static class NodeRow {
public static class NodeRow {

private final TreeSet<LayoutNode> treeSet;
private final ArrayList<Integer> space;
Expand Down Expand Up @@ -831,6 +780,9 @@ protected void run() {
if (!visited.contains(e.to)) {
visited.add(e.to);
layers[i + 1].add(e.to);
if (!nodes.contains(e.to)) {
nodes.add(e.to);
}
}
}
}
Expand Down Expand Up @@ -1221,41 +1173,42 @@ protected void run() {
} else {
ArrayList<LayoutNode> currentNodes = new ArrayList<>(nodes);
for (LayoutNode n : currentNodes) {
for (LayoutEdge e : n.succs) {
for (LayoutEdge e : List.copyOf(n.succs)) {
processSingleEdge(e);
}
}
}
}

private void processSingleEdge(LayoutEdge e) {
LayoutNode n = e.from;
if (e.to.layer > n.layer + 1) {
LayoutNode n = e.to;
if (e.to.layer - 1 > e.from.layer) {
LayoutEdge last = e;
for (int i = n.layer + 1; i < last.to.layer; i++) {
for (int i = n.layer - 1; i > last.from.layer; i--) {
last = addBetween(last, i);
}
}
}

private LayoutEdge addBetween(LayoutEdge e, int layer) {
LayoutNode n = new LayoutNode();
n.width = dummyWidth;
n.height = dummyHeight;
n.width = DUMMY_WIDTH;
n.height = DUMMY_HEIGHT;
n.layer = layer;
n.preds.add(e);
n.succs.add(e);
nodes.add(n);
LayoutEdge result = new LayoutEdge();
result.vip = e.vip;
n.succs.add(result);
result.from = n;
result.relativeFrom = n.width / 2;
result.to = e.to;
result.relativeTo = e.relativeTo;
e.relativeTo = n.width / 2;
e.to.preds.remove(e);
e.to.preds.add(result);
e.to = n;
n.preds.add(result);
result.to = n;
result.relativeTo = n.width / 2;
result.from = e.from;
result.relativeFrom = e.relativeFrom;
result.link = e.link;
e.relativeFrom = n.width / 2;
e.from.succs.remove(e);
e.from.succs.add(result);
e.from = n;
return result;
}

Expand Down
Loading

0 comments on commit c4185f4

Please sign in to comment.