Skip to content

Commit 9bc93b3

Browse files
author
duke
committed
Automatic merge of master into sealed-types
2 parents a16b816 + c140773 commit 9bc93b3

File tree

481 files changed

+13288
-42604
lines changed

Some content is hidden

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

481 files changed

+13288
-42604
lines changed

.github/workflows/submit.yml

Lines changed: 578 additions & 5 deletions
Large diffs are not rendered by default.

doc/hotspot-style.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ <h1 class="title">HotSpot Coding Style</h1>
4949
<li><a href="#thread_local">thread_local</a></li>
5050
<li><a href="#nullptr">nullptr</a></li>
5151
<li><a href="#atomic">&lt;atomic&gt;</a></li>
52+
<li><a href="#uniform-initialization">Uniform Initialization</a></li>
5253
<li><a href="#additional-permitted-features">Additional Permitted Features</a></li>
5354
<li><a href="#excluded-features">Excluded Features</a></li>
5455
<li><a href="#undecided-features">Undecided Features</a></li>
@@ -275,6 +276,17 @@ <h3 id="atomic">&lt;atomic&gt;</h3>
275276
<p>Do not use facilities provided by the <code>&lt;atomic&gt;</code> header (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html">n2427</a>), (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm">n2752</a>); instead, use the HotSpot <code>Atomic</code> class and related facilities.</p>
276277
<p>Atomic operations in HotSpot code must have semantics which are consistent with those provided by the JDK's compilers for Java. There are platform-specific implementation choices that a C++ compiler might make or change that are outside the scope of the C++ Standard, and might differ from what the Java compilers implement.</p>
277278
<p>In addition, HotSpot <code>Atomic</code> has a concept of &quot;conservative&quot; memory ordering, which may differ from (may be stronger than) sequentially consistent. There are algorithms in HotSpot that are believed to rely on that ordering.</p>
279+
<h3 id="uniform-initialization">Uniform Initialization</h3>
280+
<p>The use of <em>uniform initialization</em> (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm">n2672</a>), also known as <em>brace initialization</em>, is permitted.</p>
281+
<p>Some relevant sections from cppreference.com:</p>
282+
<ul>
283+
<li><a href="https://en.cppreference.com/w/cpp/language/initialization">initialization</a></li>
284+
<li><a href="https://en.cppreference.com/w/cpp/language/value_initialization">value initialization</a></li>
285+
<li><a href="https://en.cppreference.com/w/cpp/language/direct_initialization">direct initialization</a></li>
286+
<li><a href="https://en.cppreference.com/w/cpp/language/list_initialization">list initialization</a></li>
287+
<li><a href="https://en.cppreference.com/w/cpp/language/aggregate_initialization">aggregate initialization</a></li>
288+
</ul>
289+
<p>Although related, the use of <code>std::initializer_list</code> remains forbidden, as part of the avoidance of the C++ Standard Library in HotSpot code.</p>
278290
<h3 id="additional-permitted-features">Additional Permitted Features</h3>
279291
<ul>
280292
<li><p><code>constexpr</code> (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf">n2235</a>) (<a href="https://isocpp.org/files/papers/N3652.html">n3652</a>)</p></li>

doc/hotspot-style.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,23 @@ ordering, which may differ from (may be stronger than) sequentially
681681
consistent. There are algorithms in HotSpot that are believed to rely
682682
on that ordering.
683683

684+
### Uniform Initialization
685+
686+
The use of _uniform initialization_
687+
([n2672](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm)),
688+
also known as _brace initialization_, is permitted.
689+
690+
Some relevant sections from cppreference.com:
691+
692+
* [initialization](https://en.cppreference.com/w/cpp/language/initialization)
693+
* [value initialization](https://en.cppreference.com/w/cpp/language/value_initialization)
694+
* [direct initialization](https://en.cppreference.com/w/cpp/language/direct_initialization)
695+
* [list initialization](https://en.cppreference.com/w/cpp/language/list_initialization)
696+
* [aggregate initialization](https://en.cppreference.com/w/cpp/language/aggregate_initialization)
697+
698+
Although related, the use of `std::initializer_list` remains forbidden, as
699+
part of the avoidance of the C++ Standard Library in HotSpot code.
700+
684701
### Additional Permitted Features
685702

686703
* `constexpr`

make/autoconf/boot-jdk.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
7575
else
7676
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
7777
# Additional [] needed to keep m4 from mangling shell constructs.
78-
[ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $AWK '/version \"[0-9a-zA-Z\._\-]+\"/{print $ 0; exit;}'` ]
78+
[ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
7979
if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
8080
AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
8181
AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
@@ -516,7 +516,7 @@ AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
516516
else
517517
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
518518
# Additional [] needed to keep m4 from mangling shell constructs.
519-
[ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $AWK '/version \"[0-9a-zA-Z\._\-]+\"/{print $ 0; exit;}'` ]
519+
[ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
520520
521521
# Extra M4 quote needed to protect [] in grep expression.
522522
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP "\"$VERSION_FEATURE([\.+-].*)?\""`]

make/autoconf/jvm-features.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
476476
JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
477477
elif test "x$variant" = "xzero"; then
478478
JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \
479-
epsilongc g1gc graal jvmci minimal shenandoahgc zgc"
479+
g1gc graal jvmci minimal shenandoahgc zgc"
480480
else
481481
JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
482482
fi

make/conf/jib-profiles.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ var getJibProfilesCommon = function (input, data) {
256256
"--disable-jvm-feature-shenandoahgc",
257257
versionArgs(input, common))
258258
};
259+
// Extra settings for release profiles
260+
common.release_profile_base = {
261+
configure_args: [
262+
"--enable-reproducible-build",
263+
"--with-source-date=current",
264+
],
265+
};
259266
// Extra settings for debug profiles
260267
common.debug_suffix = "-debug";
261268
common.debug_profile_base = {
@@ -268,6 +275,12 @@ var getJibProfilesCommon = function (input, data) {
268275
configure_args: ["--with-debug-level=slowdebug"],
269276
labels: "slowdebug"
270277
};
278+
// Extra settings for optimized profiles
279+
common.optimized_suffix = "-optimized";
280+
common.optimized_profile_base = {
281+
configure_args: ["--with-debug-level=optimized"],
282+
labels: "optimized",
283+
};
271284
// Extra settings for openjdk only profiles
272285
common.open_suffix = "-open";
273286
common.open_profile_base = {
@@ -510,6 +523,13 @@ var getJibProfilesProfiles = function (input, common, data) {
510523
profiles[debugName] = concatObjects(profiles[name],
511524
common.slowdebug_profile_base);
512525
});
526+
// Generate optimized versions of all the main profiles
527+
common.main_profile_names.forEach(function (name) {
528+
var optName = name + common.optimized_suffix;
529+
profiles[optName] = concatObjects(profiles[name],
530+
common.optimized_profile_base);
531+
profiles[optName].default_make_targets = [ "hotspot" ];
532+
});
513533
// Generate testmake profiles for the main profile of each build host
514534
// platform. This profile only runs the makefile tests.
515535
// Ant is needed to run the idea project generator test.
@@ -797,6 +817,13 @@ var getJibProfilesProfiles = function (input, common, data) {
797817
});
798818
});
799819

820+
// After creating all derived profiles, we can add the release profile base
821+
// to the main profiles
822+
common.main_profile_names.forEach(function (name) {
823+
profiles[name] = concatObjects(profiles[name],
824+
common.release_profile_base);
825+
});
826+
800827
// Artifacts of JCov profiles
801828
[ "linux-aarch64", "linux-x64", "macosx-x64", "windows-x64" ]
802829
.forEach(function (name) {

make/hotspot/lib/JvmFeatures.gmk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ifneq ($(call check-jvm-feature, jvmti), true)
8484
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
8585
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
8686
jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
87-
jvmtiClassFileReconstituter.cpp
87+
jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp
8888
endif
8989

9090
ifneq ($(call check-jvm-feature, jvmci), true)

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,16 @@ Map<String, Object> getTargetMap() throws Exception {
375375
}
376376
}
377377

378+
// rules
379+
String rule = CLDRConverter.pluralRules.get(id);
380+
if (rule != null) {
381+
myMap.put("PluralRules", rule);
382+
}
383+
rule = CLDRConverter.dayPeriodRules.get(id);
384+
if (rule != null) {
385+
myMap.put("DayPeriodRules", rule);
386+
}
387+
378388
// Remove all duplicates
379389
if (Objects.nonNull(parentsMap)) {
380390
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
@@ -522,8 +532,6 @@ private void handleDateTimeFormatPatterns(String[] patternKeys, Map<String, Obje
522532
if (pattern != null) {
523533
// Perform date-time format pattern conversion which is
524534
// applicable to both SimpleDateFormat and j.t.f.DateTimeFormatter.
525-
// For example, character 'B' is mapped with 'a', as 'B' is not
526-
// supported in either SimpleDateFormat or j.t.f.DateTimeFormatter
527535
String transPattern = translateDateFormatLetters(calendarType, pattern, this::convertDateTimePatternLetter);
528536
dateTimePatterns.add(i, transPattern);
529537
// Additionally, perform SDF specific date-time format pattern conversion
@@ -653,17 +661,6 @@ private void convertDateTimePatternLetter(CalendarType calendarType, char cldrLe
653661
// as the best approximation
654662
appendN('y', count, sb);
655663
break;
656-
case 'B':
657-
// 'B' character (day period) is not supported by
658-
// SimpleDateFormat and j.t.f.DateTimeFormatter,
659-
// this is a workaround in which 'B' character
660-
// appearing in CLDR date-time pattern is replaced
661-
// with 'a' character and hence resolved with am/pm strings.
662-
// This workaround is based on the the fallback mechanism
663-
// specified in LDML spec for 'B' character, when a locale
664-
// does not have data for day period ('B')
665-
appendN('a', count, sb);
666-
break;
667664
default:
668665
appendN(cldrLetter, count, sb);
669666
break;
@@ -720,6 +717,17 @@ private void convertSDFLetter(CalendarType calendarType, char cldrLetter, int co
720717
}
721718
break;
722719

720+
case 'B':
721+
// 'B' character (day period) is not supported by SimpleDateFormat,
722+
// this is a workaround in which 'B' character
723+
// appearing in CLDR date-time pattern is replaced
724+
// with 'a' character and hence resolved with am/pm strings.
725+
// This workaround is based on the the fallback mechanism
726+
// specified in LDML spec for 'B' character, when a locale
727+
// does not have data for day period ('B')
728+
appendN('a', count, sb);
729+
break;
730+
723731
default:
724732
appendN(cldrLetter, count, sb);
725733
break;

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

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public class CLDRConverter {
7070
private static String TIMEZONE_SOURCE_FILE;
7171
private static String WINZONES_SOURCE_FILE;
7272
private static String PLURALS_SOURCE_FILE;
73+
private static String DAYPERIODRULE_SOURCE_FILE;
7374
static String DESTINATION_DIR = "build/gensrc";
7475

7576
static final String LOCALE_NAME_PREFIX = "locale.displayname.";
@@ -100,6 +101,7 @@ public class CLDRConverter {
100101
static NumberingSystemsParseHandler handlerNumbering;
101102
static MetaZonesParseHandler handlerMetaZones;
102103
static TimeZoneParseHandler handlerTimeZone;
104+
static DayPeriodRuleParseHandler handlerDayPeriodRule;
103105
private static BundleGenerator bundleGenerator;
104106

105107
// java.base module related
@@ -116,6 +118,10 @@ public class CLDRConverter {
116118
private static String tzDataDir;
117119
private static final Map<String, String> canonicalTZMap = new HashMap<>();
118120

121+
// rules maps
122+
static Map<String, String> pluralRules;
123+
static Map<String, String> dayPeriodRules;
124+
119125
static enum DraftType {
120126
UNCONFIRMED,
121127
PROVISIONAL,
@@ -248,6 +254,7 @@ public static void main(String[] args) throws Exception {
248254
SPPL_META_SOURCE_FILE = CLDR_BASE + "/supplemental/supplementalMetadata.xml";
249255
WINZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/windowsZones.xml";
250256
PLURALS_SOURCE_FILE = CLDR_BASE + "/supplemental/plurals.xml";
257+
DAYPERIODRULE_SOURCE_FILE = CLDR_BASE + "/supplemental/dayPeriods.xml";
251258

252259
if (BASE_LOCALES.isEmpty()) {
253260
setupBaseLocales("en-US");
@@ -259,6 +266,10 @@ public static void main(String[] args) throws Exception {
259266
parseSupplemental();
260267
parseBCP47();
261268

269+
// rules maps
270+
pluralRules = generateRules(handlerPlurals);
271+
dayPeriodRules = generateRules(handlerDayPeriodRule);
272+
262273
List<Bundle> bundles = readBundleList();
263274
convertBundles(bundles);
264275

@@ -268,9 +279,6 @@ public static void main(String[] args) throws Exception {
268279

269280
// Generate Windows tzmappings
270281
generateWindowsTZMappings();
271-
272-
// Generate Plural rules
273-
generatePluralRules();
274282
}
275283
}
276284

@@ -462,6 +470,10 @@ private static void parseSupplemental() throws Exception {
462470
// Parse plurals
463471
handlerPlurals = new PluralsParseHandler();
464472
parseLDMLFile(new File(PLURALS_SOURCE_FILE), handlerPlurals);
473+
474+
// Parse day period rules
475+
handlerDayPeriodRule = new DayPeriodRuleParseHandler();
476+
parseLDMLFile(new File(DAYPERIODRULE_SOURCE_FILE), handlerDayPeriodRule);
465477
}
466478

467479
// Parsers for data in "bcp47" directory
@@ -809,7 +821,9 @@ private static Map<String, Object> extractCalendarData(Map<String, Object> map,
809821
"TimePatterns",
810822
"DatePatterns",
811823
"DateTimePatterns",
812-
"DateTimePatternChars"
824+
"DateTimePatternChars",
825+
"PluralRules",
826+
"DayPeriodRules",
813827
};
814828

815829
private static Map<String, Object> extractFormatData(Map<String, Object> map, String id) {
@@ -1125,49 +1139,21 @@ public int compare(String t1, String t2) {
11251139
}
11261140

11271141
/**
1128-
* Generate ResourceBundle source file for plural rules. The generated
1129-
* class is {@code sun.text.resources.PluralRules} which has one public
1130-
* two dimensional array {@code rulesArray}. Each array element consists
1131-
* of two elements that designate the locale and the locale's plural rules
1132-
* string. The latter has the syntax from Unicode Consortium's
1133-
* <a href="http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax">
1134-
* Plural rules syntax</a>. {@code samples} and {@code "other"} are being ommited.
1135-
*
1136-
* @throws Exception
1142+
* Generates rules map for Plural rules and DayPeriod rules. The key is the locale id,
1143+
* and the value is rules, defined by the LDML spec. Each rule consists of {@code type:rule}
1144+
* notation, concatenated with a ";" as a delimiter.
1145+
* @param handler handler containing rules
1146+
* @return the map
11371147
*/
1138-
private static void generatePluralRules() throws Exception {
1139-
Files.createDirectories(Paths.get(DESTINATION_DIR, "sun", "text", "resources"));
1140-
Files.write(Paths.get(DESTINATION_DIR, "sun", "text", "resources", "PluralRules.java"),
1141-
Stream.concat(
1142-
Stream.concat(
1143-
Stream.of(
1144-
"package sun.text.resources;",
1145-
"public final class PluralRules {",
1146-
" public static final String[][] rulesArray = {"
1147-
),
1148-
pluralRulesStream().sorted()
1149-
),
1150-
Stream.of(
1151-
" };",
1152-
"}"
1153-
)
1154-
)
1155-
.collect(Collectors.toList()),
1156-
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
1157-
}
1158-
1159-
private static Stream<String> pluralRulesStream() {
1160-
return handlerPlurals.getData().entrySet().stream()
1161-
.filter(e -> !(e.getValue()).isEmpty())
1162-
.map(e -> {
1163-
String loc = e.getKey();
1148+
private static Map<String, String> generateRules(AbstractLDMLHandler<Map<String, String>> handler) {
1149+
return handler.getData().entrySet().stream()
1150+
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
11641151
Map<String, String> rules = e.getValue();
1165-
return " {\"" + loc + "\", \"" +
1166-
rules.entrySet().stream()
1167-
.map(rule -> rule.getKey() + ":" + rule.getValue().replaceFirst("@.*", ""))
1168-
.map(String::trim)
1169-
.collect(Collectors.joining(";")) + "\"},";
1170-
});
1152+
return rules.entrySet().stream()
1153+
.map(rule -> rule.getKey() + ":" + rule.getValue().replaceFirst("@.*", ""))
1154+
.map(String::trim)
1155+
.collect(Collectors.joining(";"));
1156+
}));
11711157
}
11721158

11731159
// for debug
@@ -1188,4 +1174,3 @@ static void dumpMap(Map<String, Object> map) {
11881174
.forEach(System.out::println);
11891175
}
11901176
}
1191-

0 commit comments

Comments
 (0)