Skip to content

Commit 2f1c3f2

Browse files
authored
Merge pull request #726 from jerboaa/mandrel-23.0.4-update
Mandrel 23.0.4 update
2 parents 133cec4 + 8516fb9 commit 2f1c3f2

File tree

14 files changed

+69
-35
lines changed

14 files changed

+69
-35
lines changed

compiler/mx.compiler/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"sourceinprojectwhitelist" : [],
55

66
"groupId" : "org.graalvm.compiler",
7-
"version" : "23.0.4.0",
8-
"release" : True,
7+
"version" : "23.0.4.1",
8+
"release" : False,
99
"url" : "http://www.graalvm.org/",
1010
"developer" : {
1111
"name" : "GraalVM Development",

compiler/src/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotAddressLowering.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ private static ValueNode signExtend(ValueNode input, LoopEx loop) {
187187
if (init >= 0 && extremum >= 0) {
188188
long shortestTrip = (extremum - init) / stride + 1;
189189
if (countedLoopInfo.constantMaxTripCount().equals(shortestTrip)) {
190-
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));
190+
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, false));
191191
}
192192
}
193193
}
194194
if (countedLoopInfo.getLimitCheckedIV() == inductionVariable &&
195195
inductionVariable.direction() == InductionVariable.Direction.Up &&
196196
(countedLoopInfo.getOverFlowGuard() != null || countedLoopInfo.counterNeverOverflows())) {
197-
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));
197+
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, false));
198198
}
199199
}
200200
}

compiler/src/org.graalvm.compiler.loop.phases/src/org/graalvm/compiler/loop/phases/LoopPredicationPhase.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ protected void run(StructuredGraph graph, MidTierContext context) {
112112
final InductionVariable counter = counted.getLimitCheckedIV();
113113
final Condition condition = ((CompareNode) counted.getLimitTest().condition()).condition().asCondition();
114114
final boolean inverted = loop.counted().isInverted();
115-
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) &&
116-
!counted.isUnsignedCheck() &&
117-
((condition != NE && condition != EQ) || (counter.isConstantStride() && Math.abs(counter.constantStride()) == 1)) &&
115+
if ((((IntegerStamp) counter.valueNode().stamp(NodeView.DEFAULT)).getBits() == 32) && !counted.isUnsignedCheck() &&
116+
((condition != NE && condition != EQ) || (counter.isConstantStride() && LoopEx.absStrideIsOne(counter))) &&
118117
(loop.loopBegin().isMainLoop() || loop.loopBegin().isSimpleLoop())) {
119118
NodeIterable<GuardNode> guards = loop.whole().nodes().filter(GuardNode.class);
120119
if (LoopPredicationMainPath.getValue(graph.getOptions())) {

compiler/src/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/SignExtendNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private static ValueNode canonical(SignExtendNode self, ValueNode forValue, int
124124
if ((inputStamp.mayBeSet() & (1L << (inputBits - 1))) == 0L) {
125125
// 0xxx -(sign-extend)-> 0000 0xxx
126126
// ==> 0xxx -(zero-extend)-> 0000 0xxx
127-
return ZeroExtendNode.create(forValue, inputBits, resultBits, view, true);
127+
return ZeroExtendNode.create(forValue, inputBits, resultBits, view, false);
128128
}
129129
}
130130
if (forValue instanceof NarrowNode) {

compiler/src/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/ZeroExtendNode.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.graalvm.compiler.core.common.type.IntegerStamp;
3636
import org.graalvm.compiler.core.common.type.PrimitiveStamp;
3737
import org.graalvm.compiler.core.common.type.Stamp;
38+
import org.graalvm.compiler.debug.GraalError;
3839
import org.graalvm.compiler.graph.NodeClass;
3940
import org.graalvm.compiler.lir.gen.ArithmeticLIRGeneratorTool;
4041
import org.graalvm.compiler.nodeinfo.NodeInfo;
@@ -67,14 +68,15 @@ public ZeroExtendNode(ValueNode input, int resultBits) {
6768
public ZeroExtendNode(ValueNode input, int inputBits, int resultBits, boolean inputAlwaysPositive) {
6869
super(TYPE, getArithmeticOpTable(input).getZeroExtend(), inputBits, resultBits, input);
6970
this.inputAlwaysPositive = inputAlwaysPositive;
71+
GraalError.guarantee(!inputAlwaysPositive, "ZeroExtendNode.inputAlwaysPositive is deprecated.");
7072
}
7173

7274
public static ValueNode create(ValueNode input, int resultBits, NodeView view) {
73-
return create(input, PrimitiveStamp.getBits(input.stamp(view)), resultBits, view, inputAlwaysPositive(input));
75+
return create(input, PrimitiveStamp.getBits(input.stamp(view)), resultBits, view, false);
7476
}
7577

7678
public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view) {
77-
return create(input, inputBits, resultBits, view, inputAlwaysPositive(input));
79+
return create(input, inputBits, resultBits, view, false);
7880
}
7981

8082
public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view, boolean alwaysPositive) {
@@ -86,15 +88,6 @@ public static ValueNode create(ValueNode input, int inputBits, int resultBits, N
8688
return canonical(null, input, inputBits, resultBits, view, alwaysPositive);
8789
}
8890

89-
private static boolean inputAlwaysPositive(ValueNode v) {
90-
Stamp s = v.stamp(NodeView.DEFAULT);
91-
if (s instanceof IntegerStamp) {
92-
return ((IntegerStamp) s).isPositive();
93-
} else {
94-
return false;
95-
}
96-
}
97-
9891
@Override
9992
protected IntegerConvertOp<ZeroExtend> getOp(ArithmeticOpTable table) {
10093
return table.getZeroExtend();

compiler/src/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/loop/LoopEx.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,15 @@ public boolean detectCounted() {
332332
// signed: i < MAX_INT
333333
} else if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.unsignedUpperBound()) {
334334
unsigned = true;
335-
} else if (!iv.isConstantStride() || Math.abs(iv.constantStride()) != 1 || initStamp.upperBound() > limitStamp.lowerBound()) {
335+
} else if (!iv.isConstantStride() || !absStrideIsOne(iv) || initStamp.upperBound() > limitStamp.lowerBound()) {
336336
return false;
337337
}
338338
} else if (iv.direction() == Direction.Down) {
339339
if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.lowerBound()) {
340340
// signed: MIN_INT > i
341341
} else if (limitStamp.asConstant() != null && limitStamp.asConstant().asLong() == counterStamp.unsignedLowerBound()) {
342342
unsigned = true;
343-
} else if (!iv.isConstantStride() || Math.abs(iv.constantStride()) != 1 || initStamp.lowerBound() < limitStamp.upperBound()) {
343+
} else if (!iv.isConstantStride() || !absStrideIsOne(iv) || initStamp.lowerBound() < limitStamp.upperBound()) {
344344
return false;
345345
}
346346
} else {
@@ -387,6 +387,15 @@ public boolean detectCounted() {
387387
return false;
388388
}
389389

390+
public static boolean absStrideIsOne(InductionVariable limitCheckedIV) {
391+
/*
392+
* While Math.abs can overflow for MIN_VALUE it is fine here. In case of overflow we still
393+
* get a value != 1 (namely MIN_VALUE again). Overflow handling for the limit checked IV is
394+
* done in CountedLoopInfo and is an orthogonal issue.
395+
*/
396+
return Math.abs(limitCheckedIV.constantStride()) == 1;
397+
}
398+
390399
public boolean isCfgLoopExit(AbstractBeginNode begin) {
391400
HIRBlock block = data.getCFG().blockFor(begin);
392401
return loop.getDepth() > block.getLoopDepth() || loop.isNaturalExit(block);

compiler/src/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/util/LoopUtility.java

+33
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import org.graalvm.compiler.core.common.type.IntegerStamp;
3030
import org.graalvm.compiler.core.common.type.Stamp;
31+
import org.graalvm.compiler.debug.GraalError;
3132
import org.graalvm.compiler.graph.Graph.NodeEvent;
3233
import org.graalvm.compiler.graph.Graph.NodeEventScope;
3334
import org.graalvm.compiler.nodes.LoopExitNode;
@@ -48,6 +49,38 @@
4849

4950
public class LoopUtility {
5051

52+
public static boolean canTakeAbs(long l, int bits) {
53+
try {
54+
abs(l, bits);
55+
return true;
56+
} catch (ArithmeticException e) {
57+
return false;
58+
}
59+
}
60+
61+
/**
62+
* Compute {@link Math#abs(long)} for the given arguments and the given bit size. Throw a
63+
* {@link ArithmeticException} if the abs operation would overflow.
64+
*/
65+
public static long abs(long l, int bits) throws ArithmeticException {
66+
if (bits == 32) {
67+
if (l == Integer.MIN_VALUE) {
68+
throw new ArithmeticException("Abs on Integer.MIN_VALUE would cause an overflow because abs(Integer.MIN_VALUE) = Integer.MAX_VALUE + 1 which does not fit in int (32 bits)");
69+
} else {
70+
final int i = (int) l;
71+
return Math.abs(i);
72+
}
73+
} else if (bits == 64) {
74+
if (l == Long.MIN_VALUE) {
75+
throw new ArithmeticException("Abs on Long.MIN_VALUE would cause an overflow because abs(Long.MIN_VALUE) = Long.MAX_VALUE + 1 which does not fit in long (64 bits)");
76+
} else {
77+
return Math.abs(l);
78+
}
79+
} else {
80+
throw GraalError.shouldNotReachHere("Must be one of java's core datatypes int/long but is " + bits);
81+
}
82+
}
83+
5184
public static boolean isNumericInteger(ValueNode v) {
5285
Stamp s = v.stamp(NodeView.DEFAULT);
5386
return s instanceof IntegerStamp;

espresso/mx.espresso/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
suite = {
2424
"mxversion": "6.17.0",
2525
"name": "espresso",
26-
"version" : "23.0.4.0",
27-
"release" : True,
26+
"version" : "23.0.4.1",
27+
"release" : False,
2828
"groupId" : "org.graalvm.espresso",
2929
"url" : "https://www.graalvm.org/reference-manual/java-on-truffle/",
3030
"developer" : {

regex/mx.regex/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
"name" : "regex",
4545

46-
"version" : "23.0.4.0",
47-
"release" : True,
46+
"version" : "23.0.4.1",
47+
"release" : False,
4848
"groupId" : "org.graalvm.regex",
4949
"url" : "http://www.graalvm.org/",
5050
"developer" : {

sdk/mx.sdk/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
suite = {
4242
"mxversion": "6.17.0",
4343
"name" : "sdk",
44-
"version" : "23.0.4.0",
45-
"release" : True,
44+
"version" : "23.0.4.1",
45+
"release" : False,
4646
"sourceinprojectwhitelist" : [],
4747
"url" : "https://github.com/oracle/graal",
4848
"groupId" : "org.graalvm.sdk",

substratevm/mx.substratevm/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
suite = {
33
"mxversion": "6.17.0",
44
"name": "substratevm",
5-
"version" : "23.0.4.0",
6-
"release" : True,
5+
"version" : "23.0.4.1",
6+
"release" : False,
77
"url" : "https://github.com/oracle/graal/tree/master/substratevm",
88

99
"groupId" : "org.graalvm.nativeimage",

tools/mx.tools/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"defaultLicense" : "GPLv2-CPE",
2727

2828
"groupId" : "org.graalvm.tools",
29-
"version" : "23.0.4.0",
30-
"release" : True,
29+
"version" : "23.0.4.1",
30+
"release" : False,
3131
"url" : "http://openjdk.java.net/projects/graal",
3232
"developer" : {
3333
"name" : "GraalVM Development",

truffle/mx.truffle/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
suite = {
4242
"mxversion": "6.17.0",
4343
"name" : "truffle",
44-
"version" : "23.0.4.0",
45-
"release" : True,
44+
"version" : "23.0.4.1",
45+
"release" : False,
4646
"groupId" : "org.graalvm.truffle",
4747
"sourceinprojectwhitelist" : [],
4848
"url" : "http://openjdk.java.net/projects/graal",

vm/mx.vm/suite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
suite = {
22
"name": "vm",
3-
"version" : "23.0.4.0",
3+
"version" : "23.0.4.1",
44
"mxversion": "6.17.0",
5-
"release" : True,
5+
"release" : False,
66
"groupId" : "org.graalvm",
77

88
"url" : "http://www.graalvm.org/",

0 commit comments

Comments
 (0)