Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mrserb committed Oct 19, 2023
2 parents 68b3d1b + 9cf334f commit e74925b
Show file tree
Hide file tree
Showing 659 changed files with 12,395 additions and 5,404 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ on:
jobs:
build-macos:
name: build
runs-on: macos-11
runs-on: macos-13

strategy:
fail-fast: false
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -148,8 +148,8 @@ jobs:
apt-architecture: 'i386'
# Some multilib libraries do not have proper inter-dependencies, so we have to
# install their dependencies manually.
apt-extra-packages: 'libfreetype-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386 libc6-i386 libgcc-s1:i386 libstdc++6:i386'
extra-conf-options: '--with-target-bits=32'
apt-extra-packages: 'libfreetype-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386 libc6-i386 libgcc-s1:i386 libstdc++6:i386 libffi-dev:i386'
extra-conf-options: '--with-target-bits=32 --enable-fallback-linker --enable-libffi-bundling'
configure-arguments: ${{ github.event.inputs.configure-arguments }}
make-arguments: ${{ github.event.inputs.make-arguments }}
if: needs.select.outputs.linux-x86 == 'true'
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
uses: ./.github/workflows/build-macos.yml
with:
platform: macos-x64
xcode-toolset-version: '12.5.1'
xcode-toolset-version: '14.3.1'
configure-arguments: ${{ github.event.inputs.configure-arguments }}
make-arguments: ${{ github.event.inputs.make-arguments }}
if: needs.select.outputs.macos-x64 == 'true'
Expand All @@ -240,7 +240,7 @@ jobs:
uses: ./.github/workflows/build-macos.yml
with:
platform: macos-aarch64
xcode-toolset-version: '12.5.1'
xcode-toolset-version: '14.3.1'
extra-conf-options: '--openjdk-target=aarch64-apple-darwin'
configure-arguments: ${{ github.event.inputs.configure-arguments }}
make-arguments: ${{ github.event.inputs.make-arguments }}
Expand Down Expand Up @@ -320,7 +320,7 @@ jobs:
with:
platform: macos-x64
bootjdk-platform: macos-x64
runs-on: macos-11
runs-on: macos-13

test-windows-x64:
name: windows-x64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
run: |
# On macOS we need to install some dependencies for testing
brew install make
sudo xcode-select --switch /Applications/Xcode_11.7.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
# This will make GNU make available as 'make' and not only as 'gmake'
echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH
if: runner.os == 'macOS'
Expand Down
10 changes: 3 additions & 7 deletions make/autoconf/flags.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -128,16 +128,12 @@ AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
# The expected format for <version> is either nn.n.n or nn.nn.nn. See
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h
# MACOSX_VERSION_MIN specifies the lowest version of Macosx that the built
# MACOSX_VERSION_MIN specifies the lowest version of macOS that the built
# binaries should be compatible with, even if compiled on a newer version
# of the OS. It currently has a hard coded value. Setting this also limits
# exposure to API changes in header files. Bumping this is likely to
# require code changes to build.
if test "x$OPENJDK_TARGET_CPU_ARCH" = xaarch64; then
MACOSX_VERSION_MIN=11.00.00
else
MACOSX_VERSION_MIN=10.12.0
fi
MACOSX_VERSION_MIN=11.00.00
MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
AC_SUBST(MACOSX_VERSION_MIN)
Expand Down
5 changes: 3 additions & 2 deletions make/autoconf/lib-hsdis.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -236,7 +236,8 @@ AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
if test "x$BINUTILS_DIR" = xsystem; then
AC_CHECK_LIB(bfd, bfd_openr, [ HSDIS_LIBS="-lbfd" ], [ binutils_system_error="libbfd not found" ])
AC_CHECK_LIB(opcodes, disassembler, [ HSDIS_LIBS="$HSDIS_LIBS -lopcodes" ], [ binutils_system_error="libopcodes not found" ])
AC_CHECK_LIB(iberty, xmalloc, [ HSDIS_LIBS="$HSDIS_LIBS -liberty" ], [ binutils_system_error="libiberty not found" ])
# libiberty is not required on Ubuntu
AC_CHECK_LIB(iberty, xmalloc, [ HSDIS_LIBS="$HSDIS_LIBS -liberty" ])
AC_CHECK_LIB(z, deflate, [ HSDIS_LIBS="$HSDIS_LIBS -lz" ], [ binutils_system_error="libz not found" ])
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB"
elif test "x$BINUTILS_DIR" != x; then
Expand Down
13 changes: 9 additions & 4 deletions make/conf/jib-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,22 @@ var getJibProfilesProfiles = function (input, common, data) {
target_os: "linux",
target_cpu: "x86",
build_cpu: "x64",
dependencies: ["devkit", "gtest"],
configure_args: concat(common.configure_args_32bit,
"--with-jvm-variants=minimal,server", "--with-zlib=system"),
dependencies: ["devkit", "gtest", "libffi"],
configure_args: concat(common.configure_args_32bit, [
"--with-jvm-variants=minimal,server",
"--with-zlib=system",
"--with-libffi=" + input.get("libffi", "home_path"),
"--enable-libffi-bundling",
"--enable-fallback-linker"
])
},

"macosx-x64": {
target_os: "macosx",
target_cpu: "x64",
dependencies: ["devkit", "gtest", "pandoc"],
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
"--with-macosx-version-max=10.12.00",
"--with-macosx-version-max=11.00.00",
"--enable-compatible-cds-alignment",
// Use system SetFile instead of the one in the devkit as the
// devkit one may not work on Catalina.
Expand Down
15 changes: 15 additions & 0 deletions make/hotspot/gensrc/GensrcAdlc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ ifeq ($(call check-jvm-feature, compiler2), true)
ADLCFLAGS += -DARM=1
endif

# Set ASSERT, NDEBUG and PRODUCT flags just like in JvmFlags.gmk
ifeq ($(DEBUG_LEVEL), release)
# release builds disable uses of assert macro from <assert.h>.
ADLCFLAGS += -DNDEBUG
# For hotspot, release builds differ internally between "optimized" and "product"
# in that "optimize" does not define PRODUCT.
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
ADLCFLAGS += -DPRODUCT
endif
else ifeq ($(DEBUG_LEVEL), fastdebug)
ADLCFLAGS += -DASSERT
else ifeq ($(DEBUG_LEVEL), slowdebug)
ADLCFLAGS += -DASSERT
endif

##############################################################################
# Concatenate all ad source files into a single file, which will be fed to
# adlc. Also include a #line directive at the start of every included file
Expand Down
145 changes: 140 additions & 5 deletions make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.*;
import java.text.MessageFormat;
import java.time.*;
import java.util.*;
import java.util.ResourceBundle.Control;
Expand Down Expand Up @@ -92,6 +91,12 @@ public class CLDRConverter {
static final String[] EMPTY_ZONE = {"", "", "", "", "", ""};
static final String META_ETCUTC_ZONE_NAME = "ETC_UTC";

// constants used for TZDB short names
private static final String NBSP = "\u00A0";
private static final String STD = "std";
private static final String DST = "dst";
private static final String NO_SUBST = "-";

private static SupplementDataParseHandler handlerSuppl;
private static LikelySubtagsParseHandler handlerLikelySubtags;
private static WinZonesParseHandler handlerWinZones;
Expand Down Expand Up @@ -123,6 +128,10 @@ public class CLDRConverter {
static Map<String, String> pluralRules;
static Map<String, String> dayPeriodRules;

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

static enum DraftType {
UNCONFIRMED,
PROVISIONAL,
Expand Down Expand Up @@ -284,6 +293,9 @@ public static void main(String[] args) throws Exception {
pluralRules = generateRules(handlerPlurals);
dayPeriodRules = generateRules(handlerDayPeriodRule);

// TZDB short names map
generateTZDBShortNamesMap();

List<Bundle> bundles = readBundleList();
convertBundles(bundles);

Expand Down Expand Up @@ -757,21 +769,25 @@ private static Map<String, Object> extractZoneNames(Map<String, Object> map, Str
.orElse(tzid);
Object data = map.get(TIMEZONE_ID_PREFIX + tzKey);

if (data instanceof String[]) {
if (data instanceof String[] tznames) {
// Hack for UTC. UTC is an alias to Etc/UTC in CLDR
if (tzid.equals("Etc/UTC") && !map.containsKey(TIMEZONE_ID_PREFIX + "UTC")) {
names.put(METAZONE_ID_PREFIX + META_ETCUTC_ZONE_NAME, data);
names.put(METAZONE_ID_PREFIX + META_ETCUTC_ZONE_NAME, tznames);
names.put(tzid, META_ETCUTC_ZONE_NAME);
names.put("UTC", META_ETCUTC_ZONE_NAME);
} else {
names.put(tzid, data);
// TZDB short names
fillTZDBShortNames(tzid, tznames);
names.put(tzid, tznames);
}
} else {
String meta = handlerMetaZones.get(tzKey);
if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey);
if (data instanceof String[]) {
if (data instanceof String[] tznames) {
// TZDB short names
fillTZDBShortNames(tzid, tznames);
// Keep the metazone prefix here.
names.put(metaKey, data);
names.put(tzid, meta);
Expand Down Expand Up @@ -1246,6 +1262,125 @@ private static Map<Locale, String> coverageLevelsMap() throws Exception {
return covMap;
}

/*
* Generates two 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
* its FORMAT and Rule which determines the substitution. In "America/Los_Angeles"
* case, its FORMAT is "P%sT" and the Rule is "US". They are concatenated with
* an NBSP, so the eventual mapping will be:
*
* "America/Los_Angeles" -> "P%sT<NBSP>US"
*
* The other 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,
* 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"
*/
private static void generateTZDBShortNamesMap() throws IOException {
Files.walk(Path.of(tzDataDir), 1, FileVisitOption.FOLLOW_LINKS)
.filter(p -> p.toFile().isFile())
.forEach(p -> {
try {
String zone = null;
String rule = null;
String format = null;
for (var line : Files.readAllLines(p)) {
if (line.contains("#STDOFF")) continue;
line = line.replaceAll("[ \t]*#.*", "");

// Zone line
if (line.startsWith("Zone")) {
var zl = line.split("[ \t]+", -1);
zone = zl[1];
rule = zl[3];
format = zl[4];
} else {
if (zone != null) {
if (line.isBlank()) {
tzdbShortNamesMap.put(zone, format + NBSP + rule);
zone = null;
rule = null;
format = null;
} else {
var s = line.split("[ \t]+", -1);
rule = s[2];
format = s[3];
}
}
}

// Rule line
if (line.startsWith("Rule")) {
var rl = line.split("[ \t]+", -1);
tzdbSubstLetters.put(rl[1] + NBSP + (rl[8].equals("0") ? STD : DST),
rl[9].replace(NO_SUBST, ""));
}
}
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
});
}

/*
* 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);
if (val != null) {
var format = val.split(NBSP)[0];
var rule = val.split(NBSP)[1];
IntStream.of(1, 3, 5).forEach(i -> {
if (names[i] == null) {
if (format.contains("%s")) {
names[i] = switch (i) {
case 1 -> format.formatted(tzdbSubstLetters.get(rule + NBSP + STD));
case 3 -> format.formatted(tzdbSubstLetters.get(rule + NBSP + DST));
case 5 -> format.formatted("");
default -> throw new InternalError();
};
} else if (format.contains("/")) { // such as "+08/+09" or "GMT/BST"
names[i] = switch (i) {
case 1, 5 -> convertGMTName(format.substring(0, format.indexOf("/")));
case 3 -> convertGMTName(format.substring(format.indexOf("/") + 1));
default -> throw new InternalError();
};
} else {
names[i] = convertGMTName(format);
}
}
});
}
}

/*
* Convert TZDB offsets to JDK's offsets, eg, "-08" to "GMT-08:00".
* If it cannot recognize the pattern, return the argument as is.
*/
private static String convertGMTName(String f) {
try {
// Should pre-fill GMT format once COMPAT is gone.
// Till then, fall back to GMT format at runtime, after COMPAT short
// names are populated
ZoneOffset.of(f);
return null;
} catch (DateTimeException dte) {
// textual representation. return as is
}
return f;
}

// for debug
static void dumpMap(Map<String, Object> map) {
map.entrySet().stream()
Expand Down
15 changes: 1 addition & 14 deletions make/modules/java.desktop/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -919,19 +919,6 @@ endif

################################################################################

# MACOSX_METAL_VERSION_MIN specifies the lowest version of Macosx
# that should be used to compile Metal shaders. We support Metal
# pipeline only on Macosx >=10.14. For Macosx versions <10.14 even if
# we enable Metal pipeline using -Dsun.java2d.metal=true, at
# runtime we force it to use OpenGL pipeline. And MACOSX_VERSION_MIN
# for aarch64 has always been >10.14 so we use continue to use
# MACOSX_VERSION_MIN for aarch64.
ifeq ($(OPENJDK_TARGET_CPU_ARCH), xaarch64)
MACOSX_METAL_VERSION_MIN=$(MACOSX_VERSION_MIN)
else
MACOSX_METAL_VERSION_MIN=10.14.0
endif

ifeq ($(call isTargetOs, macosx), true)
SHADERS_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/shaders.metal
SHADERS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libosxui
Expand All @@ -944,7 +931,7 @@ ifeq ($(call isTargetOs, macosx), true)
OUTPUT_FILE := $(SHADERS_AIR), \
SUPPORT_DIR := $(SHADERS_SUPPORT_DIR), \
COMMAND := $(METAL) -c -std=osx-metal2.0 \
-mmacosx-version-min=$(MACOSX_METAL_VERSION_MIN) \
-mmacosx-version-min=$(MACOSX_VERSION_MIN) \
-o $(SHADERS_AIR) $(SHADERS_SRC), \
))

Expand Down
Loading

0 comments on commit e74925b

Please sign in to comment.