Skip to content

Commit 6b6df08

Browse files
committed
Merge tag 'jdk-25+26'
2 parents e72f6fa + 7804e62 commit 6b6df08

File tree

40 files changed

+668
-84
lines changed

40 files changed

+668
-84
lines changed

common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {
11-
"galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+26-3156", "platformspecific": true, "extrabundles": ["static-libs"]},
11+
"galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+26-3319", "platformspecific": true, "extrabundles": ["static-libs"]},
1212

1313
"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
1414
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package jdk.graal.compiler.replacements.test;
26+
27+
import org.junit.Test;
28+
29+
import jdk.graal.compiler.jtt.JTTTest;
30+
31+
public class MathCbrtTest extends JTTTest {
32+
33+
public double cbrt(double d) {
34+
return Math.cbrt(d);
35+
}
36+
37+
@Test
38+
public void testCbrt() {
39+
for (double d = -3.0d; d <= 3.0D; d += 0.01D) {
40+
test("cbrt", d);
41+
}
42+
43+
double[] inputs = {Math.PI / 2, Math.PI, -1.0D, Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
44+
Double.longBitsToDouble(0x7fffffffffffffffL), Double.longBitsToDouble(0xffffffffffffffffL)};
45+
for (double d : inputs) {
46+
test("cbrt", d);
47+
}
48+
}
49+
}

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/StandardMethodSubstitutionsTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -59,19 +59,18 @@ public void testMathSubstitutions() {
5959
testGraph("mathSin");
6060
testGraph("mathSqrt");
6161
testGraph("mathTan");
62+
testGraph("mathTanh");
63+
testGraph("mathCbrt");
6264
testGraph("mathAll");
6365

64-
if (getReplacements().hasSubstitution(getResolvedJavaMethod(Math.class, "tanh"), getInitialOptions())) {
65-
testGraph("mathTanh");
66-
}
67-
6866
test("mathCos", value);
6967
test("mathLog", value);
7068
test("mathLog10", value);
7169
test("mathSin", value);
7270
test("mathSqrt", value);
7371
test("mathTan", value);
7472
test("mathTanh", value);
73+
test("mathCbrt", value);
7574
test("mathAll", value);
7675
}
7776

@@ -141,8 +140,12 @@ public static double mathTanh(double value) {
141140
return Math.tanh(value);
142141
}
143142

143+
public static double mathCbrt(double value) {
144+
return Math.cbrt(value);
145+
}
146+
144147
public static double mathAll(double value) {
145-
return Math.sqrt(value) + Math.log(value) + Math.log10(value) + Math.sin(value) + Math.cos(value) + Math.tan(value);
148+
return Math.sqrt(value) + Math.log(value) + Math.log10(value) + Math.sin(value) + Math.cos(value) + Math.tan(value) + Math.tanh(value) + Math.cbrt(value);
146149
}
147150

148151
public void testSubstitution(String testMethodName, Class<?> holder, String methodName, boolean optional, Object[] args, Class<?>... intrinsicClasses) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/asm/amd64/AMD64Assembler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5036,6 +5036,10 @@ public final void incq(AMD64Address dst) {
50365036
AMD64MOp.INC.emit(this, OperandSize.QWORD, dst);
50375037
}
50385038

5039+
public final void movapd(Register dst, AMD64Address src) {
5040+
SSEOp.MOVAPD.emit(this, OperandSize.PD, dst, src);
5041+
}
5042+
50395043
public final void movapd(Register dst, Register src) {
50405044
SSEOp.MOVAPD.emit(this, OperandSize.PD, dst, src);
50415045
}
@@ -5299,6 +5303,10 @@ public final void orl(Register dst, int imm32) {
52995303
AMD64BinaryArithmetic.OR.getMIOpcode(OperandSize.DWORD, isByte(imm32)).emit(this, OperandSize.DWORD, dst, imm32);
53005304
}
53015305

5306+
public final void orpd(Register dst, Register src) {
5307+
SSEOp.OR.emit(this, OperandSize.PD, dst, src);
5308+
}
5309+
53025310
public final void orq(Register dst, Register src) {
53035311
AMD64BinaryArithmetic.OR.rmOp.emit(this, OperandSize.QWORD, dst, src);
53045312
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/amd64/AMD64ArithmeticLIRGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
import jdk.graal.compiler.lir.amd64.AMD64CountTrailingZerosOp;
136136
import jdk.graal.compiler.lir.amd64.AMD64FloatToHalfFloatOp;
137137
import jdk.graal.compiler.lir.amd64.AMD64HalfFloatToFloatOp;
138+
import jdk.graal.compiler.lir.amd64.AMD64MathCbrtOp;
138139
import jdk.graal.compiler.lir.amd64.AMD64MathCopySignOp;
139140
import jdk.graal.compiler.lir.amd64.AMD64MathCosOp;
140141
import jdk.graal.compiler.lir.amd64.AMD64MathExpOp;
@@ -1311,6 +1312,11 @@ public Value emitMathExp(Value input) {
13111312
return new AMD64MathExpOp().emitLIRWrapper(getLIRGen(), input);
13121313
}
13131314

1315+
@Override
1316+
public Value emitMathCbrt(Value input) {
1317+
return new AMD64MathCbrtOp().emitLIRWrapper(getLIRGen(), input);
1318+
}
1319+
13141320
@Override
13151321
public Value emitMathPow(Value x, Value y) {
13161322
return new AMD64MathPowOp().emitLIRWrapper(getLIRGen(), x, y);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ private long getZGCAddressField(String name) {
682682
public final long arithmeticLogAddress = getFieldValue("CompilerToVM::Data::dlog", Long.class, "address");
683683
public final long arithmeticLog10Address = getFieldValue("CompilerToVM::Data::dlog10", Long.class, "address");
684684
public final long arithmeticPowAddress = getFieldValue("CompilerToVM::Data::dpow", Long.class, "address");
685+
public final long arithmeticCbrtAddress = getFieldValue("CompilerToVM::Data::dcbrt", Long.class, "address");
685686

686687
public final long fremAddress = getAddress("SharedRuntime::frem");
687688
public final long dremAddress = getAddress("SharedRuntime::drem");

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/SnippetResolvedJavaMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public boolean isDefault() {
115115
throw new UnsupportedOperationException();
116116
}
117117

118+
@Override
119+
public boolean isDeclared() {
120+
throw new UnsupportedOperationException();
121+
}
122+
118123
@Override
119124
public boolean isClassInitializer() {
120125
throw new UnsupportedOperationException();

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/SnippetResolvedJavaType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.lang.annotation.Annotation;
2828
import java.util.Arrays;
29+
import java.util.List;
2930
import java.util.Objects;
3031

3132
import jdk.graal.compiler.core.common.LibGraalSupport;
@@ -318,6 +319,11 @@ public ResolvedJavaMethod[] getDeclaredMethods(boolean forceLink) {
318319
return methods.clone();
319320
}
320321

322+
@Override
323+
public List<ResolvedJavaMethod> getAllMethods(boolean forceLink) {
324+
throw new UnsupportedOperationException();
325+
}
326+
321327
@Override
322328
public ResolvedJavaMethod getClassInitializer() {
323329
throw new UnsupportedOperationException();

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
3333
import static jdk.graal.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
3434
import static jdk.graal.compiler.hotspot.meta.HotSpotForeignCallDescriptor.Transition.LEAF;
3535
import static jdk.graal.compiler.replacements.nodes.BinaryMathIntrinsicNode.BinaryOperation.POW;
36+
import static jdk.graal.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.CBRT;
3637
import static jdk.graal.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.COS;
3738
import static jdk.graal.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.EXP;
3839
import static jdk.graal.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.LOG;
@@ -110,6 +111,7 @@ protected void registerMathStubs(GraalHotSpotVMConfig hotSpotVMConfig, HotSpotPr
110111
link(new AMD64MathStub(LOG, options, providers, registerStubCall(LOG.foreignCallSignature, LEAF, NO_SIDE_EFFECT, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
111112
link(new AMD64MathStub(LOG10, options, providers, registerStubCall(LOG10.foreignCallSignature, LEAF, NO_SIDE_EFFECT, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
112113
link(new AMD64MathStub(POW, options, providers, registerStubCall(POW.foreignCallSignature, LEAF, NO_SIDE_EFFECT, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
114+
link(new AMD64MathStub(CBRT, options, providers, registerStubCall(CBRT.foreignCallSignature, LEAF, NO_SIDE_EFFECT, COMPUTES_REGISTERS_KILLED, NO_LOCATIONS)));
113115
} else {
114116
super.registerMathStubs(hotSpotVMConfig, providers, options);
115117
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/amd64/AMD64MathStub.java

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,24 +49,16 @@ public AMD64MathStub(BinaryOperation operation, OptionValues options, HotSpotPro
4949
}
5050

5151
private static String snippetName(UnaryOperation operation) {
52-
switch (operation) {
53-
case SIN:
54-
return "sin";
55-
case COS:
56-
return "cos";
57-
case TAN:
58-
return "tan";
59-
case TANH:
60-
return "tanh";
61-
case EXP:
62-
return "exp";
63-
case LOG:
64-
return "log";
65-
case LOG10:
66-
return "log10";
67-
default:
68-
throw GraalError.shouldNotReachHere("Unknown operation " + operation); // ExcludeFromJacocoGeneratedReport
69-
}
52+
return switch (operation) {
53+
case SIN -> "sin";
54+
case COS -> "cos";
55+
case TAN -> "tan";
56+
case TANH -> "tanh";
57+
case EXP -> "exp";
58+
case LOG -> "log";
59+
case LOG10 -> "log10";
60+
case CBRT -> "cbrt";
61+
};
7062
}
7163

7264
private static String snippetName(BinaryOperation operation) {
@@ -115,4 +107,9 @@ private static double exp(double value) {
115107
private static double pow(double value1, double value2) {
116108
return BinaryMathIntrinsicNode.compute(value1, value2, BinaryOperation.POW);
117109
}
110+
111+
@Snippet
112+
private static double cbrt(double value) {
113+
return UnaryMathIntrinsicNode.compute(value, UnaryOperation.CBRT);
114+
}
118115
}

0 commit comments

Comments
 (0)