Skip to content

Commit 6fc49ee

Browse files
authored
Merge pull request SAP#2193 from SAP/pr-jdk-27+11
Merge to tag jdk-27+11
2 parents b2ddb4e + 9f8b57c commit 6fc49ee

664 files changed

Lines changed: 17255 additions & 12023 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/autoconf/flags-cflags.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
214214
WARNINGS_ENABLE_ADDITIONAL_CXX=""
215215
WARNINGS_ENABLE_ADDITIONAL_JVM=""
216216
DISABLED_WARNINGS="4800 5105"
217+
CFLAGS_CONVERSION_WARNINGS=
217218
;;
218219
219220
gcc)
@@ -239,6 +240,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
239240
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xppc"; then
240241
DISABLED_WARNINGS="$DISABLED_WARNINGS psabi"
241242
fi
243+
CFLAGS_CONVERSION_WARNINGS="-Wconversion -Wno-float-conversion"
242244
;;
243245
244246
clang)
@@ -258,6 +260,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
258260
# These warnings will never be turned on, since they generate too many
259261
# false positives.
260262
DISABLED_WARNINGS="unknown-warning-option unused-parameter"
263+
CFLAGS_CONVERSION_WARNINGS="-Wimplicit-int-conversion"
261264
;;
262265
esac
263266
WARNINGS_ENABLE_ALL="$WARNINGS_ENABLE_ALL_NORMAL $WARNINGS_ENABLE_ADDITIONAL"
@@ -270,6 +273,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
270273
AC_SUBST(DISABLED_WARNINGS)
271274
AC_SUBST(DISABLED_WARNINGS_C)
272275
AC_SUBST(DISABLED_WARNINGS_CXX)
276+
AC_SUBST(CFLAGS_CONVERSION_WARNINGS)
273277
])
274278

275279
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],

make/autoconf/platform.m4

Lines changed: 7 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
@@ -311,6 +311,12 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
311311
else
312312
OPENJDK_BUILD_OS_ENV="$VAR_OS"
313313
fi
314+
# Special handling for MSYS2 that reports a Cygwin triplet as the default host triplet.
315+
case `uname` in
316+
MSYS*)
317+
OPENJDK_BUILD_OS_ENV=windows.msys2
318+
;;
319+
esac
314320
OPENJDK_BUILD_CPU="$VAR_CPU"
315321
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
316322
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"

make/autoconf/spec.gmk.template

Lines changed: 2 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
@@ -538,6 +538,7 @@ CFLAGS_WARNINGS_ARE_ERRORS := @CFLAGS_WARNINGS_ARE_ERRORS@
538538
DISABLED_WARNINGS := @DISABLED_WARNINGS@
539539
DISABLED_WARNINGS_C := @DISABLED_WARNINGS_C@
540540
DISABLED_WARNINGS_CXX := @DISABLED_WARNINGS_CXX@
541+
CFLAGS_CONVERSION_WARNINGS := @CFLAGS_CONVERSION_WARNINGS@
541542

542543
# A global flag (true or false) determining if native warnings are considered errors.
543544
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@

make/common/MakeBase.gmk

Lines changed: 65 additions & 2 deletions
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
@@ -141,6 +141,66 @@ endef
141141
# Make sure logging is setup for everyone that includes MakeBase.gmk.
142142
$(eval $(call SetupLogging))
143143

144+
################################################################################
145+
# Make does not have support for VARARGS, you can send variable amount
146+
# of arguments, but you can for example not append a list at the end.
147+
# It is therefore not easy to send the elements of a list of unknown
148+
# length as argument to a function. This can somewhat be worked around
149+
# by sending a list as an argument, and then interpreting each element
150+
# of the list as an argument to the function. However, Make is
151+
# limited, and using this method you can not easily send spaces.
152+
#
153+
# We need to quote strings for two reasons when sending them as
154+
# "variable append packs":
155+
#
156+
# 1) variable appends can include spaces, and those must be preserved
157+
# 2) variable appends can include assignment strings ":=", and those
158+
# must be quoted to a form so that we can recognise the "append pack".
159+
# We recognise an "append pack" by its lack of strict assignment ":="
160+
161+
Q := $(HASH)
162+
SpaceQ := $(Q)s
163+
AppendQ := $(Q)+
164+
AssignQ := $(Q)a
165+
QQ := $(Q)$(Q)
166+
167+
# $(call Quote,echo "#trala:=") -> echo#s"##trala#a"
168+
Quote = $(subst :=,$(AssignQ),$(subst $(SPACE),$(SpaceQ),$(subst $(Q),$(QQ),$1)))
169+
170+
# $(call Unquote,echo#s"##trala#a") -> echo "#trala:="
171+
Unquote = $(subst $(QQ),$(Q),$(subst $(SpaceQ),$(SPACE),$(subst $(AssignQ),:=,$1)))
172+
173+
# $(call QuoteAppend,name,some value) -> name#+some#svalue
174+
# $(call QuoteAppend,bad+=name,some value) -> error
175+
QuoteAppend = $(if $(findstring +=,$1),$(error you can not have += in a variable name: "$1"),$(call Quote,$1)$(AppendQ)$(call Quote,$2))
176+
177+
# $(call UnquoteAppendIndex,name#+some#svalue,1) -> name
178+
# $(call UnquoteAppendIndex,name#+some#svalue,2) -> some value
179+
UnquoteAppendIndex = $(call Unquote,$(word $2,$(subst $(AppendQ),$(SPACE),$1)))
180+
181+
# $(call FilterFiles,dir,%.cpp) -> file1.cpp file2.cpp (without path)
182+
FilterFiles = $(filter $2,$(notdir $(call FindFiles,$1)))
183+
184+
# $(call Unpack module_,file1.cpp_CXXFLAGS#+-Wconversion file2.cpp_CXXFLAGS#+-Wconversion) -> module_file1.cpp_CXXFLAGS += -Wconversion
185+
# module_file2.cpp_CXXFLAGS += -Wconversion
186+
Unpack = $(foreach pair,$2,$1$(call UnquoteAppendIndex,$(pair),1) += $(call UnquoteAppendIndex,$(pair),2)$(NEWLINE))
187+
188+
# This macro takes four arguments:
189+
# $1: directory where to find files (striped), example: $(TOPDIR)/src/hotspot/share/gc/g1
190+
# $2: filter to match what to keep (striped), example: g1Concurrent%.cpp
191+
# $3: what flags to override (striped), example: _CXXFLAGS
192+
# $4: what value to append to the flag (striped), example: $(CFLAGS_CONVERSION_WARNINGS)
193+
#
194+
# The result will be a quoted string that can be unpacked to a list of
195+
# variable appendings (see macro Unpack above). You do not need to take
196+
# care of unpacking, it is done in NamedParamsMacroTemplate.
197+
#
198+
# This feature should only be used for warnings that we want to
199+
# incrementally add to the rest of the code base.
200+
#
201+
# $(call ExtendFlags,dir,%.cpp,_CXXFLAGS,-Wconversion) -> file1.cpp_CXXFLAGS#+-Wconversion file2.cpp_CXXFLAGS#+-Wconversion
202+
ExtendFlags = $(foreach file,$(call FilterFiles,$(strip $1),$(strip $2)),$(call QuoteAppend,$(file)$(strip $3),$(strip $4)))
203+
144204
################################################################################
145205

146206
MAX_PARAMS := 96
@@ -166,7 +226,10 @@ define NamedParamsMacroTemplate
166226
Too many named arguments to macro, please update MAX_PARAMS in MakeBase.gmk))
167227
# Iterate over 2 3 4... and evaluate the named parameters with $1_ as prefix
168228
$(foreach i, $(PARAM_SEQUENCE), $(if $(strip $($i)), \
169-
$(strip $1)_$(strip $(call EscapeHash, $(call DoubleDollar, $($i))))$(NEWLINE)))
229+
$(if $(findstring :=,$($i)), \
230+
$(strip $1)_$(strip $(call EscapeHash, $(call DoubleDollar, $($i))))$(NEWLINE), \
231+
$(call Unpack,$(strip $1)_,$($i)))))
232+
170233
# Debug print all named parameter names and values
171234
$(if $(findstring $(LOG_LEVEL), trace), \
172235
$(info $0 $(strip $1) $(foreach i, $(PARAM_SEQUENCE), \

make/hotspot/lib/CompileJvm.gmk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 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
@@ -105,7 +105,7 @@ DISABLED_WARNINGS_gcc := array-bounds comment delete-non-virtual-dtor \
105105
DISABLED_WARNINGS_clang := delete-non-abstract-non-virtual-dtor \
106106
invalid-offsetof missing-braces \
107107
sometimes-uninitialized unknown-pragmas unused-but-set-variable \
108-
unused-function unused-local-typedef unused-private-field unused-variable
108+
unused-local-typedef unused-private-field unused-variable
109109

110110
ifneq ($(DEBUG_LEVEL), release)
111111
# Assert macro gives warning
@@ -190,6 +190,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
190190
abstract_vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
191191
arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
192192
whitebox.cpp_CXXFLAGS := $(CFLAGS_SHIP_DEBUGINFO), \
193+
$(call ExtendFlags, $(TOPDIR)/src/hotspot/share/gc/g1, \
194+
g1Numa.cpp, _CXXFLAGS, $(CFLAGS_CONVERSION_WARNINGS)), \
193195
DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \
194196
DISABLED_WARNINGS_gcc_ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp := nonnull, \
195197
DISABLED_WARNINGS_gcc_bytecodeInterpreter.cpp := unused-label, \

make/modules/java.base/Copy.gmk

Lines changed: 5 additions & 1 deletion
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
@@ -172,6 +172,10 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
172172
LEGAL_EXCLUDES += zlib.md
173173
endif
174174

175+
ifneq ($(TOOLCHAIN_TYPE), gcc)
176+
LEGAL_EXCLUDES += gcc.md
177+
endif
178+
175179
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
176180
EXCLUDES := $(LEGAL_EXCLUDES), \
177181
))

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
#include "opto/matcher.hpp"
3131
#include "opto/output.hpp"
3232
#include "opto/subnode.hpp"
33+
#include "runtime/objectMonitorTable.hpp"
3334
#include "runtime/stubRoutines.hpp"
35+
#include "runtime/synchronizer.hpp"
3436
#include "utilities/globalDefinitions.hpp"
3537
#include "utilities/powerOfTwo.hpp"
3638

@@ -221,37 +223,52 @@ void C2_MacroAssembler::fast_lock(Register obj, Register box, Register t1,
221223
if (!UseObjectMonitorTable) {
222224
assert(t1_monitor == t1_mark, "should be the same here");
223225
} else {
226+
const Register t1_hash = t1;
224227
Label monitor_found;
225228

226-
// Load cache address
227-
lea(t3_t, Address(rthread, JavaThread::om_cache_oops_offset()));
229+
// Save the mark, we might need it to extract the hash.
230+
mov(t3, t1_mark);
228231

229-
const int num_unrolled = 2;
232+
// Look for the monitor in the om_cache.
233+
234+
ByteSize cache_offset = JavaThread::om_cache_oops_offset();
235+
ByteSize monitor_offset = OMCache::oop_to_monitor_difference();
236+
const int num_unrolled = OMCache::CAPACITY;
230237
for (int i = 0; i < num_unrolled; i++) {
231-
ldr(t1, Address(t3_t));
232-
cmp(obj, t1);
238+
ldr(t1_monitor, Address(rthread, cache_offset + monitor_offset));
239+
ldr(t2, Address(rthread, cache_offset));
240+
cmp(obj, t2);
233241
br(Assembler::EQ, monitor_found);
234-
increment(t3_t, in_bytes(OMCache::oop_to_oop_difference()));
242+
cache_offset = cache_offset + OMCache::oop_to_oop_difference();
235243
}
236244

237-
Label loop;
245+
// Look for the monitor in the table.
246+
247+
// Get the hash code.
248+
ubfx(t1_hash, t3, markWord::hash_shift, markWord::hash_bits);
238249

239-
// Search for obj in cache.
240-
bind(loop);
250+
// Get the table and calculate the bucket's address
251+
lea(t3, ExternalAddress(ObjectMonitorTable::current_table_address()));
252+
ldr(t3, Address(t3));
253+
ldr(t2, Address(t3, ObjectMonitorTable::table_capacity_mask_offset()));
254+
ands(t1_hash, t1_hash, t2);
255+
ldr(t3, Address(t3, ObjectMonitorTable::table_buckets_offset()));
241256

242-
// Check for match.
243-
ldr(t1, Address(t3_t));
244-
cmp(obj, t1);
245-
br(Assembler::EQ, monitor_found);
257+
// Read the monitor from the bucket.
258+
ldr(t1_monitor, Address(t3, t1_hash, Address::lsl(LogBytesPerWord)));
259+
260+
// Check if the monitor in the bucket is special (empty, tombstone or removed).
261+
cmp(t1_monitor, (unsigned char)ObjectMonitorTable::SpecialPointerValues::below_is_special);
262+
br(Assembler::LO, slow_path);
246263

247-
// Search until null encountered, guaranteed _null_sentinel at end.
248-
increment(t3_t, in_bytes(OMCache::oop_to_oop_difference()));
249-
cbnz(t1, loop);
250-
// Cache Miss, NE set from cmp above, cbnz does not set flags
251-
b(slow_path);
264+
// Check if object matches.
265+
ldr(t3, Address(t1_monitor, ObjectMonitor::object_offset()));
266+
BarrierSetAssembler* bs_asm = BarrierSet::barrier_set()->barrier_set_assembler();
267+
bs_asm->try_resolve_weak_handle_in_c2(this, t3, t2, slow_path);
268+
cmp(t3, obj);
269+
br(Assembler::NE, slow_path);
252270

253271
bind(monitor_found);
254-
ldr(t1_monitor, Address(t3_t, OMCache::oop_to_monitor_difference()));
255272
}
256273

257274
const Register t2_owner_addr = t2;

src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 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
@@ -441,6 +441,11 @@ OptoReg::Name BarrierSetAssembler::refine_register(const Node* node, OptoReg::Na
441441
return opto_reg;
442442
}
443443

444+
void BarrierSetAssembler::try_resolve_weak_handle_in_c2(MacroAssembler* masm, Register obj, Register tmp, Label& slow_path) {
445+
// Load the oop from the weak handle.
446+
__ ldr(obj, Address(obj));
447+
}
448+
444449
#undef __
445450
#define __ _masm->
446451

src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 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
@@ -135,6 +135,7 @@ class BarrierSetAssembler: public CHeapObj<mtGC> {
135135
OptoReg::Name opto_reg);
136136
OptoReg::Name refine_register(const Node* node,
137137
OptoReg::Name opto_reg);
138+
virtual void try_resolve_weak_handle_in_c2(MacroAssembler* masm, Register obj, Register tmp, Label& slow_path);
138139
#endif // COMPILER2
139140
};
140141

src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
23
* Copyright (c) 2018, 2022, Red Hat, Inc. All rights reserved.
34
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
45
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -442,6 +443,30 @@ void ShenandoahBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler
442443
__ bind(done);
443444
}
444445

446+
#ifdef COMPILER2
447+
void ShenandoahBarrierSetAssembler::try_resolve_weak_handle_in_c2(MacroAssembler* masm, Register obj,
448+
Register tmp, Label& slow_path) {
449+
assert_different_registers(obj, tmp);
450+
451+
Label done;
452+
453+
// Resolve weak handle using the standard implementation.
454+
BarrierSetAssembler::try_resolve_weak_handle_in_c2(masm, obj, tmp, slow_path);
455+
456+
// Check if the reference is null, and if it is, take the fast path.
457+
__ cbz(obj, done);
458+
459+
Address gc_state(rthread, ShenandoahThreadLocalData::gc_state_offset());
460+
__ lea(tmp, gc_state);
461+
__ ldrb(tmp, __ legitimize_address(gc_state, 1, tmp));
462+
463+
// Check if the heap is under weak-reference/roots processing, in
464+
// which case we need to take the slow path.
465+
__ tbnz(tmp, ShenandoahHeap::WEAK_ROOTS_BITPOS, slow_path);
466+
__ bind(done);
467+
}
468+
#endif
469+
445470
// Special Shenandoah CAS implementation that handles false negatives due
446471
// to concurrent evacuation. The service is more complex than a
447472
// traditional CAS operation because the CAS operation is intended to

0 commit comments

Comments
 (0)