Skip to content

Commit 9555fc2

Browse files
authored
Merge pull request #2201 from SAP/pr-jdk-27+13
Merge to tag jdk-27+13
2 parents 9323b86 + 619fe63 commit 9555fc2

662 files changed

Lines changed: 19681 additions & 12852 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

make/CompileInterimLangtools.gmk

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2014, 2026, 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
@@ -68,17 +68,19 @@ java.compiler.interim_EXTRA_FILES := \
6868
TARGETS += $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.compiler.interim/javax/tools/ToolProvider.java
6969

7070
################################################################################
71-
# Use the up-to-date PreviewFeature.java and NoPreview.java from the current
72-
# sources, instead of the versions from the boot JDK, as javac may be referring
73-
# to constants from the up-to-date versions.
74-
75-
$(eval $(call SetupCopyFiles, COPY_PREVIEW_FEATURES, \
76-
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java \
77-
$(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/NoPreview.java, \
78-
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/, \
79-
))
71+
# Create a hybrid PreviewFeature.java that combines constants
72+
# from the current sources, as those can be used in javac APIs, and from the
73+
# bootstrap JDK, as those can be used from bootstrap JDK classfiles.
74+
75+
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java: \
76+
$(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java
77+
$(call LogInfo, Generating $@)
78+
$(JAVA) $(TOPDIR)/make/langtools/tools/previewfeature/SetupPreviewFeature.java \
79+
$(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java \
80+
$@
81+
8082

81-
TARGETS += $(COPY_PREVIEW_FEATURES)
83+
TARGETS += $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java
8284

8385
################################################################################
8486
# Setup the rules to build interim langtools, which is compiled by the boot
@@ -123,7 +125,8 @@ define SetupInterimModule
123125
$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
124126
$$(INTERIM_LANGTOOLS_BASE_MODULES), $$(call FindTransitiveDepsForModule, $1)))
125127

126-
$$(BUILD_$1.interim): $$(foreach d, $$($1_DEPS_INTERIM), $$(BUILD_$$d)) $(COPY_PREVIEW_FEATURES)
128+
$$(BUILD_$1.interim): $$(foreach d, $$($1_DEPS_INTERIM), $$(BUILD_$$d)) \
129+
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java
127130

128131
TARGETS += $$(BUILD_$1.interim)
129132
endef

make/GenerateLinkOptData.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,15 @@ CLASSLIST_FILE_VM_OPTS = \
7070

7171
# Save the stderr output of the command and print it along with stdout in case
7272
# something goes wrong.
73+
# The classlists must be generated with -Xint to avoid non-determinism
74+
# introduced by JIT compiled code
7375
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
7476
$(call MakeDir, $(LINK_OPT_DIR))
7577
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
7678
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
7779
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:[email protected] \
7880
$(CLASSLIST_FILE_VM_OPTS) \
81+
-Xint \
7982
-Xlog:aot=off \
8083
-Xlog:cds=off \
8184
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
@@ -90,6 +93,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
9093
9194
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
9295
$(CLASSLIST_FILE_VM_OPTS) \
96+
-Xint \
9397
--module-path $(SUPPORT_OUTPUTDIR)/classlist.jar \
9498
-Xlog:aot=off \
9599
-Xlog:cds=off \

make/autoconf/flags-cflags.m4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
578578
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
579579
fi
580580
581+
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
582+
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections"
583+
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections"
584+
fi
585+
581586
if test "x$OPENJDK_TARGET_OS" = xaix; then
582587
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno"
583588
TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char"

make/autoconf/flags-ldflags.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
8080
if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test "x$CC_IS_USER_SUPPLIED" = xfalse; then
8181
UTIL_REQUIRE_TOOLCHAIN_PROGS(LLD, lld)
8282
fi
83+
84+
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
85+
BASIC_LDFLAGS_JDK_ONLY="$BASIC_LDFLAGS_JDK_ONLY -Wl,--gc-sections"
86+
fi
8387
fi
8488
if test "x$OPENJDK_TARGET_OS" = xaix; then
8589
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-blibpath:/usr/lib:lib -Wl,-bnoexpall \

make/autoconf/jdk-options.m4

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,12 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
103103
AC_SUBST(ENABLE_HEADLESS_ONLY)
104104
105105
# should we linktime gc unused code sections in the JDK build ?
106-
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then
107-
LINKTIME_GC_DEFAULT=true
106+
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
107+
if test "x$OPENJDK_TARGET_CPU" = "xs390x" || test "x$OPENJDK_TARGET_CPU" = "xppc64le"; then
108+
LINKTIME_GC_DEFAULT=true
109+
else
110+
LINKTIME_GC_DEFAULT=false
111+
fi
108112
else
109113
LINKTIME_GC_DEFAULT=false
110114
fi
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (c) 2026, 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 previewfeature;
26+
27+
import com.sun.source.util.JavacTask;
28+
import com.sun.source.util.Trees;
29+
import java.io.StringWriter;
30+
import java.lang.reflect.Field;
31+
import java.nio.file.Files;
32+
import java.nio.file.Path;
33+
import java.util.HashSet;
34+
import java.util.Set;
35+
import java.util.stream.Collectors;
36+
import javax.lang.model.element.ElementKind;
37+
import javax.tools.ToolProvider;
38+
39+
/* Construct a hybrid PreviewFeature.Feature enum that includes constants both
40+
* from the current JDK sources (so that they can be used in the javac API sources),
41+
* and from the bootstrap JDK (so that they can be used in the bootstrap classfiles).
42+
*
43+
* This hybrid enum is only used for the interim javac.
44+
*/
45+
public class SetupPreviewFeature {
46+
public static void main(String... args) throws Exception {
47+
Class<?> runtimeFeature = Class.forName("jdk.internal.javac.PreviewFeature$Feature");
48+
Set<String> constantsToAdd = new HashSet<>();
49+
for (Field runtimeField : runtimeFeature.getDeclaredFields()) {
50+
if (runtimeField.isEnumConstant()) {
51+
constantsToAdd.add(runtimeField.getName());
52+
}
53+
}
54+
var dummy = new StringWriter();
55+
var compiler = ToolProvider.getSystemJavaCompiler();
56+
var source = Path.of(args[0]);
57+
try (var fm = compiler.getStandardFileManager(null, null, null)) {
58+
JavacTask task =
59+
(JavacTask) compiler.getTask(dummy, null, null, null, null, fm.getJavaFileObjects(source));
60+
task.analyze();
61+
var sourceFeature = task.getElements()
62+
.getTypeElement("jdk.internal.javac.PreviewFeature.Feature");
63+
int insertPosition = -1;
64+
for (var el : sourceFeature.getEnclosedElements()) {
65+
if (el.getKind() == ElementKind.ENUM_CONSTANT) {
66+
constantsToAdd.remove(el.getSimpleName().toString());
67+
if (insertPosition == (-1)) {
68+
var trees = Trees.instance(task);
69+
var elPath = trees.getPath(el);
70+
insertPosition = (int) trees.getSourcePositions()
71+
.getStartPosition(elPath.getCompilationUnit(),
72+
elPath.getLeaf());
73+
}
74+
}
75+
}
76+
var target = Path.of(args[1]);
77+
Files.createDirectories(target.getParent());
78+
if (constantsToAdd.isEmpty()) {
79+
Files.copy(source, target);
80+
} else {
81+
String sourceCode = Files.readString(source);
82+
try (var out = Files.newBufferedWriter(target)) {
83+
out.write(sourceCode, 0, insertPosition);
84+
out.write(constantsToAdd.stream()
85+
.collect(Collectors.joining(", ",
86+
"/*compatibility constants:*/ ",
87+
",\n")));
88+
out.write(sourceCode, insertPosition, sourceCode.length() - insertPosition);
89+
}
90+
}
91+
}
92+
}
93+
}

make/modules/java.desktop/lib/AwtLibraries.gmk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2026, 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
@@ -423,6 +423,9 @@ endif
423423
ifeq ($(call isTargetOs, linux)+$(ENABLE_HEADLESS_ONLY), true+true)
424424
LIBJAWT_CFLAGS += -DHEADLESS
425425
endif
426+
ifeq ($(call isTargetOs, aix)+$(ENABLE_HEADLESS_ONLY), true+true)
427+
LIBJAWT_CFLAGS += -DHEADLESS
428+
endif
426429

427430
ifeq ($(call isTargetOs, windows)+$(call isTargetCpu, x86), true+true)
428431
LIBJAWT_LIBS_windows := kernel32.lib

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
2+
// Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
33
// Copyright (c) 2014, 2024, Red Hat, Inc. All rights reserved.
44
// Copyright 2025 Arm Limited and/or its affiliates.
55
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2467,11 +2467,8 @@ bool Matcher::is_generic_vector(MachOper* opnd) {
24672467
return opnd->opcode() == VREG;
24682468
}
24692469

2470+
#ifdef ASSERT
24702471
// Return whether or not this register is ever used as an argument.
2471-
// This function is used on startup to build the trampoline stubs in
2472-
// generateOptoStub. Registers not mentioned will be killed by the VM
2473-
// call in the trampoline, and arguments in those registers not be
2474-
// available to the callee.
24752472
bool Matcher::can_be_java_arg(int reg)
24762473
{
24772474
return
@@ -2492,11 +2489,7 @@ bool Matcher::can_be_java_arg(int reg)
24922489
reg == V6_num || reg == V6_H_num ||
24932490
reg == V7_num || reg == V7_H_num;
24942491
}
2495-
2496-
bool Matcher::is_spillable_arg(int reg)
2497-
{
2498-
return can_be_java_arg(reg);
2499-
}
2492+
#endif
25002493

25012494
uint Matcher::int_pressure_limit()
25022495
{
@@ -3814,11 +3807,6 @@ frame %{
38143807
// Compiled code's Frame Pointer
38153808
frame_pointer(R31);
38163809

3817-
// Interpreter stores its frame pointer in a register which is
3818-
// stored to the stack by I2CAdaptors.
3819-
// I2CAdaptors convert from interpreted java to compiled java.
3820-
interpreter_frame_pointer(R29);
3821-
38223810
// Stack alignment requirement
38233811
stack_alignment(StackAlignmentInBytes); // Alignment size in bytes (128-bit -> 16 bytes)
38243812

src/hotspot/cpu/aarch64/assembler_aarch64.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,8 +3814,8 @@ template<typename R, typename... Rx>
38143814
}
38153815

38163816
private:
3817-
void sve_cpy(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, int imm8,
3818-
bool isMerge, bool isFloat) {
3817+
void _sve_cpy(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, int imm8,
3818+
bool isMerge, bool isFloat) {
38193819
starti;
38203820
assert(T != Q, "invalid size");
38213821
int sh = 0;
@@ -3839,11 +3839,11 @@ template<typename R, typename... Rx>
38393839
public:
38403840
// SVE copy signed integer immediate to vector elements (predicated)
38413841
void sve_cpy(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, int imm8, bool isMerge) {
3842-
sve_cpy(Zd, T, Pg, imm8, isMerge, /*isFloat*/false);
3842+
_sve_cpy(Zd, T, Pg, imm8, isMerge, /*isFloat*/false);
38433843
}
38443844
// SVE copy floating-point immediate to vector elements (predicated)
38453845
void sve_cpy(FloatRegister Zd, SIMD_RegVariant T, PRegister Pg, double d) {
3846-
sve_cpy(Zd, T, Pg, checked_cast<uint8_t>(pack(d)), /*isMerge*/true, /*isFloat*/true);
3846+
_sve_cpy(Zd, T, Pg, checked_cast<uint8_t>(pack(d)), /*isMerge*/true, /*isFloat*/true);
38473847
}
38483848

38493849
// SVE conditionally select elements from two vectors

src/hotspot/cpu/aarch64/c1_globals_aarch64.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ define_pd_global(bool, TieredCompilation, false);
4242
define_pd_global(intx, CompileThreshold, 1500 );
4343

4444
define_pd_global(intx, OnStackReplacePercentage, 933 );
45-
define_pd_global(intx, NewSizeThreadIncrease, 4*K );
4645
define_pd_global(size_t, InitialCodeCacheSize, 160*K);
4746
define_pd_global(size_t, ReservedCodeCacheSize, 32*M );
4847
define_pd_global(size_t, NonProfiledCodeHeapSize, 13*M );

0 commit comments

Comments
 (0)