Skip to content

Commit 4c329b9

Browse files
[GR-54127] Merge in tag jdk-23+23
PullRequest: labsjdk-ce/76
2 parents 1c85924 + 2232ab8 commit 4c329b9

File tree

358 files changed

+12872
-9053
lines changed

Some content is hidden

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

358 files changed

+12872
-9053
lines changed

.jcheck/conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ version=23
55

66
[checks]
77
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
8+
warning=issuestitle
89

910
[repository]
1011
tags=(?:jdk-(?:[1-9]([0-9]*)(?:\.(?:0|[1-9][0-9]*)){0,4})(?:\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\d{1,3})?-(?:(?:b\d{2,3})|(?:ga)))|(?:hs\d\d(?:\.\d{1,2})?-b\d\d)

make/autoconf/jdk-options.m4

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
190190
fi
191191
AC_SUBST(INCLUDE_SA)
192192
193+
# Setup default CDS alignment. On platforms where one build may run on machines with different
194+
# page sizes, the JVM choses a compatible alignment to fit all possible page sizes. This slightly
195+
# increases archive size.
196+
# The only platform having this problem at the moment is Linux on aarch64, which may encounter
197+
# three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K.
198+
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false
199+
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
200+
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=true
201+
fi
202+
AC_SUBST(COMPATIBLE_CDS_ALIGNMENT_DEFAULT)
203+
193204
# Compress jars
194205
COMPRESS_JARS=false
195206
@@ -673,7 +684,7 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
673684
#
674685
AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT],
675686
[
676-
UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: false,
687+
UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT,
677688
RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT,
678689
DESC: [enable use alternative compatible cds core region alignment],
679690
DEFAULT_DESC: [disabled],

make/conf/module-loader-map.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ NATIVE_ACCESS_MODULES= \
120120
jdk.dynalink \
121121
jdk.httpserver \
122122
jdk.incubator.vector \
123+
jdk.internal.le \
123124
jdk.internal.vm.ci \
124125
jdk.jfr \
125126
jdk.jsobject \

make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public class CLDRConverter {
8787
static final String ZONE_NAME_PREFIX = "timezone.displayname.";
8888
static final String METAZONE_ID_PREFIX = "metazone.id.";
8989
static final String PARENT_LOCALE_PREFIX = "parentLocale.";
90+
static final String LIKELY_SCRIPT_PREFIX = "likelyScript.";
9091
static final String META_EMPTY_ZONE_NAME = "EMPTY_ZONE";
9192
static final String[] EMPTY_ZONE = {"", "", "", "", "", ""};
9293
static final String META_ETCUTC_ZONE_NAME = "ETC_UTC";
@@ -114,9 +115,13 @@ public class CLDRConverter {
114115

115116
// "parentLocales" map
116117
private static final Map<String, SortedSet<String>> parentLocalesMap = new HashMap<>();
118+
static boolean nonlikelyScript;
117119
private static final ResourceBundle.Control defCon =
118120
ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
119121

122+
// "likelyScript" map
123+
private static final Map<String, SortedSet<String>> likelyScriptMap = new HashMap<>();
124+
120125
private static Set<String> AVAILABLE_TZIDS;
121126
static int copyrightYear;
122127
static String jdkHeaderTemplate;
@@ -175,7 +180,7 @@ String getKeyword() {
175180
private static boolean verbose;
176181

177182
private CLDRConverter() {
178-
// no instantiation
183+
// no instantiation
179184
}
180185

181186
@SuppressWarnings("AssignmentToForLoopParameter")
@@ -475,8 +480,8 @@ private static void parseSupplemental() throws Exception {
475480
parseLDMLFile(new File(SPPL_SOURCE_FILE), handlerSuppl);
476481
Map<String, Object> parentData = handlerSuppl.getData("root");
477482
parentData.keySet().stream()
478-
.filter(key -> key.startsWith(PARENT_LOCALE_PREFIX))
479-
.forEach(key -> {
483+
.filter(key -> key.startsWith(PARENT_LOCALE_PREFIX))
484+
.forEach(key -> {
480485
parentLocalesMap.put(key, new TreeSet<String>(
481486
Arrays.asList(((String)parentData.get(key)).split(" "))));
482487
});
@@ -492,6 +497,16 @@ private static void parseSupplemental() throws Exception {
492497
// Parse likelySubtags
493498
handlerLikelySubtags = new LikelySubtagsParseHandler();
494499
parseLDMLFile(new File(LIKELYSUBTAGS_SOURCE_FILE), handlerLikelySubtags);
500+
handlerLikelySubtags.getData().forEach((from, to) -> {
501+
if (!from.contains("-")) { // look for language-only tag
502+
var script = to.split("-")[1];
503+
var key = LIKELY_SCRIPT_PREFIX + script;
504+
var prev = likelyScriptMap.putIfAbsent(key, new TreeSet<String>(Set.of(from)));
505+
if (prev != null) {
506+
prev.add(from);
507+
}
508+
}
509+
});
495510

496511
// Parse supplementalMetadata
497512
// Currently interested in deprecated time zone ids and language aliases.
@@ -561,6 +576,7 @@ private static void convertBundles(List<Bundle> bundles) throws Exception {
561576
// for now.
562577
if (isBaseModule) {
563578
metaInfo.putAll(parentLocalesMap);
579+
metaInfo.putAll(likelyScriptMap);
564580
}
565581

566582
for (Bundle bundle : bundles) {
@@ -1135,7 +1151,7 @@ private static List<Locale> applyParentLocales(String baseName, List<Locale> can
11351151
// check irregular parents
11361152
for (int i = 0; i < candidates.size(); i++) {
11371153
Locale l = candidates.get(i);
1138-
Locale p = childToParentLocaleMap.get(l);
1154+
Locale p = getParentLocale(l);
11391155
if (!l.equals(Locale.ROOT) &&
11401156
Objects.nonNull(p) &&
11411157
!candidates.get(i+1).equals(p)) {
@@ -1152,6 +1168,27 @@ private static List<Locale> applyParentLocales(String baseName, List<Locale> can
11521168
return candidates;
11531169
}
11541170

1171+
private static Locale getParentLocale(Locale child) {
1172+
Locale parent = childToParentLocaleMap.get(child);
1173+
1174+
// check non-likely script for root
1175+
if (nonlikelyScript && parent == null && child.getCountry().isEmpty()) {
1176+
var lang = " " + child.getLanguage() + " ";
1177+
var script = child.getScript();
1178+
1179+
if (!script.isEmpty()) {
1180+
parent = likelyScriptMap.entrySet().stream()
1181+
.filter(e -> e.getValue().contains(lang))
1182+
.findAny()
1183+
.map(Map.Entry::getKey)
1184+
.map(likely -> likely.equals(script) ? null : Locale.ROOT)
1185+
.orElse(null);
1186+
}
1187+
}
1188+
1189+
return parent;
1190+
}
1191+
11551192
private static void generateZoneName() throws Exception {
11561193
Files.createDirectories(Paths.get(DESTINATION_DIR, "java", "time", "format"));
11571194
Files.write(Paths.get(DESTINATION_DIR, "java", "time", "format", "ZoneName.java"),

make/jdk/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java

Lines changed: 84 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, 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
@@ -38,6 +38,7 @@
3838
import java.util.Objects;
3939
import java.util.Set;
4040
import java.util.SortedSet;
41+
import java.util.stream.Collectors;
4142

4243
class ResourceBundleGenerator implements BundleGenerator {
4344
// preferred timezones - keeping compatibility with JDK1.1 3 letter abbreviations
@@ -306,81 +307,77 @@ public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOE
306307
import sun.util.locale.provider.LocaleProviderAdapter;
307308
308309
public class %s implements LocaleDataMetaInfo {
309-
private static final Map<String, String> resourceNameToLocales = HashMap.newHashMap(%d);
310-
%s
311-
static {
312-
""", CLDRConverter.isBaseModule ? "cldr" : "resources.cldr.provider",
313-
className, metaInfo.keySet().stream().filter(k -> k.equals("AvailableLocales")).count(),
314-
CLDRConverter.isBaseModule ?
315-
"""
310+
""",
311+
CLDRConverter.isBaseModule ? "cldr" : "resources.cldr.provider",
312+
className);
313+
314+
if (CLDRConverter.isBaseModule) {
315+
out.printf("""
316316
private static final Map<Locale, String[]> parentLocalesMap = HashMap.newHashMap(%d);
317317
private static final Map<String, String> languageAliasMap = HashMap.newHashMap(%d);
318+
static final boolean nonlikelyScript = %s; // package access from CLDRLocaleProviderAdapter
319+
320+
static {
318321
""".formatted(
319322
metaInfo.keySet().stream().filter(k -> k.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)).count(),
320-
CLDRConverter.handlerSupplMeta.getLanguageAliasData().size()) :
321-
"");
322-
323-
for (String key : metaInfo.keySet()) {
324-
if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
325-
String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
326-
if ("root".equals(parentTag)) {
327-
out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
328-
} else {
329-
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
330-
parentTag);
331-
}
332-
String[] children = toLocaleList(metaInfo.get(key), true).split(" ");
333-
Arrays.sort(children);
334-
out.printf(" new String[] {\n" +
335-
" ");
336-
int count = 0;
337-
for (int i = 0; i < children.length; i++) {
338-
String child = children[i];
339-
out.printf("\"%s\", ", child);
340-
count += child.length() + 4;
341-
if (i != children.length - 1 && count > 64) {
342-
out.printf("\n ");
343-
count = 0;
323+
CLDRConverter.handlerSupplMeta.getLanguageAliasData().size(),
324+
Boolean.valueOf(CLDRConverter.nonlikelyScript)));
325+
326+
for (String key : metaInfo.keySet()) {
327+
if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
328+
String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
329+
if ("root".equals(parentTag)) {
330+
out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
331+
} else {
332+
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
333+
parentTag);
344334
}
345-
}
346-
out.printf("\n });\n");
347-
} else {
348-
if ("AvailableLocales".equals(key)) {
349-
out.printf(" resourceNameToLocales.put(\"%s\",\n", key);
350-
out.printf(" \"%s\");\n", toLocaleList(applyLanguageAliases(metaInfo.get(key)), false));
335+
generateStringArray(metaInfo.get(key), out);
351336
}
352337
}
353-
}
354-
// for languageAliasMap
355-
if (CLDRConverter.isBaseModule) {
338+
out.println();
339+
340+
// for languageAliasMap
356341
CLDRConverter.handlerSupplMeta.getLanguageAliasData().forEach((key, value) -> {
357342
out.printf(" languageAliasMap.put(\"%s\", \"%s\");\n", key, value);
358343
});
359-
}
344+
out.printf(" }\n\n");
360345

361-
out.printf(" }\n\n");
346+
// end of static initializer block.
362347

363-
// end of static initializer block.
364-
365-
// Canonical TZ names for delayed initialization
366-
if (CLDRConverter.isBaseModule) {
348+
// Delayed initialization section
367349
out.printf("""
368-
private static class TZCanonicalIDMapHolder {
369-
static final Map<String, String> tzCanonicalIDMap = HashMap.newHashMap(%d);
350+
private static class CLDRMapHolder {
351+
private static final Map<String, String> tzCanonicalIDMap = HashMap.newHashMap(%d);
352+
private static final Map<String, String> likelyScriptMap = HashMap.newHashMap(%d);
353+
370354
static {
371-
""", CLDRConverter.handlerTimeZone.getData().size());
355+
""", CLDRConverter.handlerTimeZone.getData().size(),
356+
metaInfo.keySet().stream().filter(k -> k.startsWith(CLDRConverter.LIKELY_SCRIPT_PREFIX)).count());
372357
CLDRConverter.handlerTimeZone.getData().entrySet().stream()
373358
.forEach(e -> {
374359
String[] ids = ((String)e.getValue()).split("\\s");
375360
out.printf(" tzCanonicalIDMap.put(\"%s\", \"%s\");\n", e.getKey(),
376-
ids[0]);
361+
ids[0]);
377362
for (int i = 1; i < ids.length; i++) {
378363
out.printf(" tzCanonicalIDMap.put(\"%s\", \"%s\");\n", ids[i],
379364
ids[0]);
380365
}
381366
});
382-
out.printf(" }\n }\n\n");
367+
out.println();
368+
369+
// for likelyScript map
370+
for (String key : metaInfo.keySet()) {
371+
if (key.startsWith(CLDRConverter.LIKELY_SCRIPT_PREFIX)) {
372+
// ensure spaces at the begin/end for delimiting purposes
373+
out.printf(" likelyScriptMap.put(\"%s\", \"%s\");\n",
374+
key.substring(CLDRConverter.LIKELY_SCRIPT_PREFIX.length()),
375+
" " + metaInfo.get(key).stream().collect(Collectors.joining(" ")) + " ");
376+
}
377+
}
378+
out.printf(" }\n }\n");
383379
}
380+
out.println();
384381

385382
out.printf("""
386383
@Override
@@ -390,12 +387,13 @@ public LocaleProviderAdapter.Type getType() {
390387
391388
@Override
392389
public String availableLanguageTags(String category) {
393-
return resourceNameToLocales.getOrDefault(category, "");
390+
return " %s";
394391
}
395-
%s
396-
}
397392
""",
398-
CLDRConverter.isBaseModule ? """
393+
toLocaleList(applyLanguageAliases(metaInfo.get("AvailableLocales")), false));
394+
395+
if(CLDRConverter.isBaseModule) {
396+
out.printf("""
399397
400398
@Override
401399
public Map<String, String> getLanguageAliasMap() {
@@ -404,16 +402,41 @@ public Map<String, String> getLanguageAliasMap() {
404402
405403
@Override
406404
public Map<String, String> tzCanonicalIDs() {
407-
return TZCanonicalIDMapHolder.tzCanonicalIDMap;
405+
return CLDRMapHolder.tzCanonicalIDMap;
408406
}
409407
410408
public Map<Locale, String[]> parentLocales() {
411409
return parentLocalesMap;
412410
}
413-
""" : "");
411+
412+
// package access from CLDRLocaleProviderAdapter
413+
Map<String, String> likelyScriptMap() {
414+
return CLDRMapHolder.likelyScriptMap;
415+
}
416+
""");
417+
}
418+
out.printf("}\n");
414419
}
415420
}
416421

422+
private static void generateStringArray(SortedSet<String> set, PrintWriter out) throws IOException {
423+
String[] children = toLocaleList(set, true).split(" ");
424+
Arrays.sort(children);
425+
out.printf(" new String[] {\n" +
426+
" ");
427+
int count = 0;
428+
for (int i = 0; i < children.length; i++) {
429+
String child = children[i];
430+
out.printf("\"%s\", ", child);
431+
count += child.length() + 4;
432+
if (i != children.length - 1 && count > 64) {
433+
out.printf("\n ");
434+
count = 0;
435+
}
436+
}
437+
out.printf("\n });\n");
438+
}
439+
417440
private static final Locale.Builder LOCALE_BUILDER = new Locale.Builder();
418441
private static boolean isBaseLocale(String localeID) {
419442
localeID = localeID.replaceAll("-", "_");
@@ -433,7 +456,9 @@ private static String toLocaleList(SortedSet<String> set, boolean all) {
433456
if (!all && CLDRConverter.isBaseModule ^ isBaseLocale(id)) {
434457
continue;
435458
}
436-
sb.append(' ');
459+
if (sb.length() > 0) {
460+
sb.append(' ');
461+
}
437462
sb.append(id);
438463
}
439464
}

0 commit comments

Comments
 (0)