Skip to content

Commit

Permalink
Merge jdk
Browse files Browse the repository at this point in the history
Merge tag jdk-23+13
  • Loading branch information
David Simms committed Aug 5, 2024
2 parents 663aff2 + f54e598 commit e45febc
Show file tree
Hide file tree
Showing 802 changed files with 5,179 additions and 70,723 deletions.
6 changes: 3 additions & 3 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler
</tr>
<tr class="odd">
<td>AIX</td>
<td>IBM XL C/C++</td>
<td>IBM Open XL C/C++</td>
</tr>
<tr class="even">
<td>Windows</td>
Expand Down Expand Up @@ -601,13 +601,13 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler
<p>All compilers are expected to be able to handle the C11 language
standard for C, and C++14 for C++.</p>
<h3 id="gcc">gcc</h3>
<p>The minimum accepted version of gcc is 6.0. Older versions will not
<p>The minimum accepted version of gcc is 10.0. Older versions will not
be accepted by <code>configure</code>.</p>
<p>The JDK is currently known to compile successfully with gcc version
13.2 or newer.</p>
<p>In general, any version between these two should be usable.</p>
<h3 id="clang">clang</h3>
<p>The minimum accepted version of clang is 3.5. Older versions will not
<p>The minimum accepted version of clang is 13. Older versions will not
be accepted by <code>configure</code>.</p>
<p>To use clang instead of gcc on Linux, use
<code>--with-toolchain-type=clang</code>.</p>
Expand Down
6 changes: 3 additions & 3 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ one-to-one correlation between target operating system and toolchain.
| ------------------ | ------------------------- |
| Linux | gcc, clang |
| macOS | Apple Xcode (using clang) |
| AIX | IBM XL C/C++ |
| AIX | IBM Open XL C/C++ |
| Windows | Microsoft Visual Studio |

Please see the individual sections on the toolchains for version
Expand All @@ -403,7 +403,7 @@ C, and C++14 for C++.

### gcc

The minimum accepted version of gcc is 6.0. Older versions will not be accepted
The minimum accepted version of gcc is 10.0. Older versions will not be accepted
by `configure`.

The JDK is currently known to compile successfully with gcc version 13.2 or
Expand All @@ -413,7 +413,7 @@ In general, any version between these two should be usable.

### clang

The minimum accepted version of clang is 3.5. Older versions will not be
The minimum accepted version of clang is 13. Older versions will not be
accepted by `configure`.

To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
Expand Down
13 changes: 8 additions & 5 deletions doc/hotspot-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,15 @@ <h3 id="thread_local">thread_local</h3>
href="https://bugs.openjdk.org/browse/JDK-8282469">JDK-8282469</a> for
further discussion.</p>
<h3 id="nullptr">nullptr</h3>
<p>Prefer <code>nullptr</code> (<a
<p>Use <code>nullptr</code> (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf">n2431</a>)
to <code>NULL</code>. Don't use (constexpr or literal) 0 for
pointers.</p>
<p>For historical reasons there are widespread uses of both
<code>NULL</code> and of integer 0 as a pointer value.</p>
rather than <code>NULL</code>. See the paper for reasons to avoid
<code>NULL</code>.</p>
<p>Don't use (constant expression or literal) 0 for pointers. Note that
C++14 removed non-literal 0 constants from <em>null pointer
constants</em>, though some compilers continue to treat them as such.
For historical reasons there may be lingering uses of 0 as a
pointer.</p>
<h3 id="atomic">&lt;atomic&gt;</h3>
<p>Do not use facilities provided by the <code>&lt;atomic&gt;</code>
header (<a
Expand Down
10 changes: 6 additions & 4 deletions doc/hotspot-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,14 @@ for further discussion.

### nullptr

Prefer `nullptr`
Use `nullptr`
([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf))
to `NULL`. Don't use (constexpr or literal) 0 for pointers.
rather than `NULL`. See the paper for reasons to avoid `NULL`.

For historical reasons there are widespread uses of both `NULL` and of
integer 0 as a pointer value.
Don't use (constant expression or literal) 0 for pointers. Note that C++14
removed non-literal 0 constants from _null pointer constants_, though some
compilers continue to treat them as such. For historical reasons there may be
lingering uses of 0 as a pointer.

### &lt;atomic&gt;

Expand Down
6 changes: 3 additions & 3 deletions make/Global.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ help:
$(info $(_) # method is 'auto', 'ignore' or 'fail' (default))
$(info $(_) TEST="test1 ..." # Use the given test descriptor(s) for testing, e.g.)
$(info $(_) # make test TEST="jdk_lang gtest:all")
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'help' to list)
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'help' to list)
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'help' to list)
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'make test-only JTREG=help' to list)
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'make test-only GTEST=help' to list)
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'make test-only MICRO=help' to list)
$(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses)
$(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...")
$(info )
Expand Down
10 changes: 8 additions & 2 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Setup flags for C/C++ compiler
#

###############################################################################
################################################################################
#
# How to compile shared libraries.
#
Expand All @@ -37,7 +37,10 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
# --disable-new-dtags forces use of RPATH instead of RUNPATH for rpaths.
# This protects internal library dependencies within the JDK from being
# overridden using LD_LIBRARY_PATH. See JDK-8326891 for more information.
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1 -Wl,--disable-new-dtags'
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
Expand All @@ -60,6 +63,9 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
if test "x$OPENJDK_TARGET_OS" = xlinux; then
SET_EXECUTABLE_ORIGIN="$SET_EXECUTABLE_ORIGIN -Wl,--disable-new-dtags"
fi
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
# arm specific settings
Expand Down
6 changes: 3 additions & 3 deletions make/autoconf/toolchain.m4
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio"
TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"

# Minimum supported versions, empty means unspecified
TOOLCHAIN_MINIMUM_VERSION_clang="3.5"
TOOLCHAIN_MINIMUM_VERSION_gcc="6.0"
TOOLCHAIN_MINIMUM_VERSION_clang="13.0"
TOOLCHAIN_MINIMUM_VERSION_gcc="10.0"
TOOLCHAIN_MINIMUM_VERSION_microsoft="19.28.0.0" # VS2019 16.8, aka MSVC 14.28
TOOLCHAIN_MINIMUM_VERSION_xlc="16.1.0.0011"
TOOLCHAIN_MINIMUM_VERSION_xlc="17.1.1.4"

# Minimum supported linker versions, empty means unspecified
TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.18"
Expand Down
114 changes: 84 additions & 30 deletions make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ public class CLDRConverter {
static Map<String, String> pluralRules;
static Map<String, String> dayPeriodRules;

// TZDB Short Names Map
// TZDB maps
private static final Map<String, String> tzdbShortNamesMap = HashMap.newHashMap(512);
private static final Map<String, String> tzdbSubstLetters = HashMap.newHashMap(512);
private static final Map<String, String> tzdbLinks = HashMap.newHashMap(512);

static enum DraftType {
UNCONFIRMED,
Expand Down Expand Up @@ -762,12 +763,32 @@ private static Map<String, Object> extractCurrencyNames(Map<String, Object> map,

private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
Map<String, Object> names = new TreeMap<>(KeyComparator.INSTANCE);
var availableIds = getAvailableZoneIds();

getAvailableZoneIds().stream().forEach(tzid -> {
availableIds.forEach(tzid -> {
// If the tzid is deprecated, get the data for the replacement id
String tzKey = Optional.ofNullable((String)handlerSupplMeta.get(tzid))
.orElse(tzid);
// Follow link, if needed
var tzLink = tzdbLinks.get(tzKey);
if (tzLink == null && tzdbLinks.containsValue(tzKey)) {
// reverse link search
// this is needed as in tzdb, "America/Buenos_Aires" links to
// "America/Argentina/Buenos_Aires", but CLDR contains metaZone
// "Argentina" only for "America/Buenos_Aires" (as of CLDR 44)
// Both tzids should have "Argentina" meta zone names
tzLink = tzdbLinks.entrySet().stream()
.filter(e -> e.getValue().equals(tzKey))
.map(Map.Entry::getKey)
.findAny()
.orElse(null);

}
Object data = map.get(TIMEZONE_ID_PREFIX + tzKey);
if (data == null && tzLink != null) {
// data for tzLink
data = map.get(TIMEZONE_ID_PREFIX + tzLink);
}

if (data instanceof String[] tznames) {
// Hack for UTC. UTC is an alias to Etc/UTC in CLDR
Expand All @@ -777,20 +798,36 @@ private static Map<String, Object> extractZoneNames(Map<String, Object> map, Str
names.put("UTC", META_ETCUTC_ZONE_NAME);
} else {
// TZDB short names
tznames = Arrays.copyOf(tznames, tznames.length);
fillTZDBShortNames(tzid, tznames);
names.put(tzid, tznames);
}
} else {
String meta = handlerMetaZones.get(tzKey);
if (meta == null && tzLink != null) {
// Check for tzLink
meta = handlerMetaZones.get(tzLink);
}
if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey);
if (data instanceof String[] tznames) {
// TZDB short names
tznames = Arrays.copyOf((String[])names.getOrDefault(metaKey, tznames), 6);
fillTZDBShortNames(tzid, tznames);
// Keep the metazone prefix here.
names.put(metaKey, data);
names.putIfAbsent(metaKey, tznames);
names.put(tzid, meta);
if (tzLink != null && availableIds.contains(tzLink)) {
names.put(tzLink, meta);
}
}
} else if (id.equals("root")) {
// supply TZDB short names if available
if (tzdbShortNamesMap.containsKey(tzid)) {
var tznames = new String[6];
fillTZDBShortNames(tzid, tznames);
names.put(tzid, tznames);
}
}
}
Expand Down Expand Up @@ -1263,7 +1300,7 @@ private static Map<Locale, String> coverageLevelsMap() throws Exception {
}

/*
* Generates two maps from TZ database files, where they have usual abbreviation
* Generates three maps from TZ database files, where they have usual abbreviation
* of the time zone names as "FORMAT".
*
* `tzdbShortNamesMap` maps the time zone id, such as "America/Los_Angeles" to
Expand All @@ -1273,53 +1310,46 @@ private static Map<Locale, String> coverageLevelsMap() throws Exception {
*
* "America/Los_Angeles" -> "P%sT<NBSP>US"
*
* The other map, `tzdbSubstLetters` maps the Rule to its substitution letters.
* The map, `tzdbSubstLetters` maps the Rule to its substitution letters.
* The key of the map is the Rule name, appended with "<NBSP>std" or "<NBSP>dst"
* depending on the savings, e.g.,
*
* "US<NBSP>std" -> "S"
* "US<NBSP>dst" -> "D"
*
* These two mappings resolve the short names for time zones in each type,
* These mappings resolve the short names for time zones in each type,
* such as:
*
* Standard short name for "America/Los_Angeles" -> "PST"
* DST short name for "America/Los_Angeles" -> "PDT"
* Generic short name for "America/Los_Angeles" -> "PT"
*
* The map, `tzdbLinks` retains `Link`s of time zones. For example,
* the mapping:
*
* "US/Hawaii" -> "Pacific/Honolulu"
*
* resolves names for "US/Hawaii" correctly with "Pacific/Honolulu"
* names.
*/
private static void generateTZDBShortNamesMap() throws IOException {
Files.walk(Path.of(tzDataDir), 1, FileVisitOption.FOLLOW_LINKS)
.filter(p -> p.toFile().isFile() && !p.endsWith("jdk11_backward"))
.filter(p -> p.toFile().isFile())
.forEach(p -> {
try {
String zone = null;
String rule = null;
String format = null;
boolean inVanguard = false;
boolean inRearguard = false;
for (var line : Files.readAllLines(p)) {
// Interpret the line in rearguard mode so that STD/DST
// correctly handles negative DST cases, such as "GMT/IST"
// vs. "IST/GMT" case for Europe/Dublin
if (inVanguard) {
if (line.startsWith("# Rearguard")) {
inVanguard = false;
inRearguard = true;
}
continue;
} else if (line.startsWith("# Vanguard")) {
// check for Vanguard lines
if (line.startsWith("# Vanguard section")) {
inVanguard = true;
continue;
}
if (inRearguard) {
if (line.startsWith("# End of rearguard")) {
inRearguard = false;
continue;
} else {
if (line.startsWith("#\t")) {
line = line.substring(1); // omit #
}
}
if (inVanguard && line.startsWith("# Rearguard section")) {
inVanguard = false;
continue;
}
if (line.isBlank() || line.matches("^[ \t]*#.*")) {
// ignore blank/comment lines
Expand All @@ -1336,7 +1366,7 @@ private static void generateTZDBShortNamesMap() throws IOException {
var zl = line.split("[ \t]+", -1);
zone = zl[1];
rule = zl[3];
format = zl[4];
format = flipIfNeeded(inVanguard, zl[4]);
} else {
if (zone != null) {
if (line.startsWith("Rule") ||
Expand All @@ -1348,7 +1378,7 @@ private static void generateTZDBShortNamesMap() throws IOException {
} else {
var s = line.split("[ \t]+", -1);
rule = s[2];
format = s[3];
format = flipIfNeeded(inVanguard, s[3]);
}
}
}
Expand All @@ -1359,18 +1389,42 @@ private static void generateTZDBShortNamesMap() throws IOException {
tzdbSubstLetters.put(rl[1] + NBSP + (rl[8].equals("0") ? STD : DST),
rl[9].replace(NO_SUBST, ""));
}

// Link line
if (line.startsWith("Link")) {
var ll = line.split("[ \t]+", -1);
tzdbLinks.put(ll[2], ll[1]);
}
}

// Last entry
if (zone != null) {
tzdbShortNamesMap.put(zone, format + NBSP + rule);
}
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
});
}

// Reverse the std/dst FORMAT in Vanguard so that it
// correctly handles negative DST cases, such as "GMT/IST"
// vs. "IST/GMT" case for Europe/Dublin
private static String flipIfNeeded(boolean inVanguard, String format) {
if (inVanguard) {
var stddst = format.split("/");
if (stddst.length == 2) {
return stddst[1] + "/" + stddst[0];
}
}
return format;
}

/*
* Fill the TZDB short names if there is no name provided by the CLDR
*/
private static void fillTZDBShortNames(String tzid, String[] names) {
var val = tzdbShortNamesMap.get(tzid);
var val = tzdbShortNamesMap.get(tzdbLinks.getOrDefault(tzid, tzid));
if (val != null) {
var format = val.split(NBSP)[0];
var rule = val.split(NBSP)[1];
Expand Down
Loading

0 comments on commit e45febc

Please sign in to comment.