mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-08 17:41:41 +01:00
Compare commits
128 Commits
jb25-b107.
...
vpr/jbr25_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38afbeccf1 | ||
|
|
b86151562f | ||
|
|
00dfb2b2ce | ||
|
|
4c46c41847 | ||
|
|
16405f4f09 | ||
|
|
9f98448896 | ||
|
|
7abc1a541d | ||
|
|
de8ea2d81c | ||
|
|
bc737fb03a | ||
|
|
f8e0ee5a18 | ||
|
|
e956e04e37 | ||
|
|
9cae1177d6 | ||
|
|
50729485cf | ||
|
|
59055bc850 | ||
|
|
7666cf1882 | ||
|
|
21a1668c8f | ||
|
|
aa937adccf | ||
|
|
1434025d74 | ||
|
|
89b841701e | ||
|
|
352117baf3 | ||
|
|
79d925f6ae | ||
|
|
e37c54a24f | ||
|
|
d96581ebec | ||
|
|
f37e00d801 | ||
|
|
a49aa72e7b | ||
|
|
5af08d88d5 | ||
|
|
87a46979f3 | ||
|
|
e7a86af739 | ||
|
|
60bfa2b12e | ||
|
|
ae6360371c | ||
|
|
f8aee55ea6 | ||
|
|
ffc581146c | ||
|
|
75930f77d2 | ||
|
|
7b721d2610 | ||
|
|
fed9ce336e | ||
|
|
14be13239e | ||
|
|
c9aea14597 | ||
|
|
d619feefc6 | ||
|
|
b38204cb12 | ||
|
|
c7fe20689c | ||
|
|
bb52503876 | ||
|
|
a9554a0e4a | ||
|
|
cbae1a769b | ||
|
|
505522f2e2 | ||
|
|
9e729bf99d | ||
|
|
14eaa570d1 | ||
|
|
54b65e514f | ||
|
|
86e6947981 | ||
|
|
0f7c371233 | ||
|
|
e880107619 | ||
|
|
39743018bb | ||
|
|
ceb2dcb091 | ||
|
|
fe29694915 | ||
|
|
a336a88057 | ||
|
|
6c753b5d49 | ||
|
|
099394e43a | ||
|
|
71241ecc59 | ||
|
|
377b0902b1 | ||
|
|
04fdd306ab | ||
|
|
06b190878a | ||
|
|
b8cfdc28dc | ||
|
|
1e7ae9c8d5 | ||
|
|
0c7f8b1b00 | ||
|
|
3f53deeaf2 | ||
|
|
a2f4b57bb2 | ||
|
|
a471e942e4 | ||
|
|
d5ceea456c | ||
|
|
e6cb0a1b56 | ||
|
|
ab7a9f8f87 | ||
|
|
6b43d1a768 | ||
|
|
dfe78a31f5 | ||
|
|
e48181b9aa | ||
|
|
f0d54ab6e5 | ||
|
|
20b513f189 | ||
|
|
58f04296e7 | ||
|
|
7a2d71329d | ||
|
|
54276e869b | ||
|
|
75dcbe8f20 | ||
|
|
37b13e2f17 | ||
|
|
bde37c774a | ||
|
|
8dfd14f671 | ||
|
|
49bed44184 | ||
|
|
a270d9e6a3 | ||
|
|
11e3c06ba0 | ||
|
|
95c6f7c37f | ||
|
|
c4f2b64d19 | ||
|
|
9a6415585d | ||
|
|
51d7cd2afb | ||
|
|
3c66bdc1e9 | ||
|
|
e65cb43ba1 | ||
|
|
7c84fbe810 | ||
|
|
6c47534225 | ||
|
|
ffde0964ef | ||
|
|
d0299a4c6a | ||
|
|
1186447190 | ||
|
|
4eab05ccd9 | ||
|
|
74b4df4496 | ||
|
|
8f660e630c | ||
|
|
4bd1551dc4 | ||
|
|
4879508145 | ||
|
|
84473294fb | ||
|
|
57e694c1ae | ||
|
|
12e0466566 | ||
|
|
02ab184c01 | ||
|
|
bf7dea965a | ||
|
|
58b3c7ed57 | ||
|
|
631811837d | ||
|
|
3ff4b846da | ||
|
|
b175e32148 | ||
|
|
8e287c09a0 | ||
|
|
28f9408b29 | ||
|
|
338f1df777 | ||
|
|
690349f07c | ||
|
|
fe1d8d85ae | ||
|
|
a1d745006b | ||
|
|
2d345b9aab | ||
|
|
d720f1ee4a | ||
|
|
a2fa35786e | ||
|
|
e66f996829 | ||
|
|
8569475930 | ||
|
|
7433067506 | ||
|
|
2e517af41f | ||
|
|
a54096f118 | ||
|
|
d3f0367a19 | ||
|
|
14f93c154e | ||
|
|
07a1aee823 | ||
|
|
3345eb8e16 | ||
|
|
987f5f9561 |
5
.github/README.md
vendored
5
.github/README.md
vendored
@@ -161,7 +161,7 @@ Install the necessary tools, libraries, and headers with:
|
||||
```
|
||||
$ sudo apt-get install autoconf make build-essential libx11-dev libxext-dev libxrender-dev libxtst-dev \
|
||||
libxt-dev libxrandr-dev libcups2-dev libfontconfig1-dev libasound2-dev libspeechd-dev libwayland-dev \
|
||||
wayland-protocols libxkbcommon-x11-0
|
||||
wayland-protocols libxkbcommon-x11-0 libdbus-1-dev
|
||||
```
|
||||
Get Java 23 (for instance, [Azul Zulu Builds of OpenJDK 23](https://www.azul.com/downloads/?version=java-23&os=linux&package=jdk#zulu)).
|
||||
|
||||
@@ -254,8 +254,7 @@ configurations (for example, `release` and `fastdebug`), supply the `--conf <con
|
||||
Then open the git root directory as a project in IDEA.
|
||||
|
||||
## Contributing
|
||||
We are happy to receive your pull requests!
|
||||
Before you submit one, please sign our [Contributor License Agreement (CLA)](https://www.jetbrains.com/agreements/cla/).
|
||||
Please contribute your changes through [OpenJDK](https://dev.java/contribute/openjdk/).
|
||||
|
||||
## Resources
|
||||
* [JetBrains Runtime on GitHub](https://github.com/JetBrains/JetBrainsRuntime).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[general]
|
||||
project=jdk
|
||||
project=jdk-updates
|
||||
jbs=JDK
|
||||
version=25
|
||||
version=25.0.1
|
||||
|
||||
[checks]
|
||||
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists,copyright
|
||||
|
||||
@@ -47,8 +47,8 @@ VERSION_PATCH=$(getVersionProp "DEFAULT_VERSION_PATCH")
|
||||
[[ $VERSION_UPDATE = 0 ]] && JBSDK_VERSION="$VERSION_FEATURE" || JBSDK_VERSION="${VERSION_FEATURE}.${VERSION_INTERIM}.${VERSION_UPDATE}"
|
||||
[[ $VERSION_PATCH = 0 ]] || JBSDK_VERSION="${VERSION_FEATURE}.${VERSION_INTERIM}.${VERSION_UPDATE}.${VERSION_PATCH}"
|
||||
echo "##teamcity[setParameter name='env.JBSDK_VERSION' value='${JBSDK_VERSION}']"
|
||||
tag_prefix="jdk-"
|
||||
OPENJDK_TAG=$(git tag -l | grep "$tag_prefix$JBSDK_VERSION" | grep -v ga | sort -t "-" -k 2 -V -f | tail -n 1)
|
||||
tag_prefix="jbr-"
|
||||
OPENJDK_TAG=$(git log --simplify-by-decoration --decorate=short --pretty=short | grep "${tag_prefix}${JBSDK_VERSION}" | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -V -f | tail -n 1 | tr -d ",")
|
||||
JDK_BUILD_NUMBER=$(echo $OPENJDK_TAG | awk -F "-|[+]" '{print $3}')
|
||||
[ -z $JDK_BUILD_NUMBER ] && JDK_BUILD_NUMBER=1
|
||||
re='^[0-9]+$'
|
||||
|
||||
@@ -27,6 +27,12 @@ JCEF_PATH=${JCEF_PATH:=./jcef_linux_aarch64}
|
||||
function do_configure {
|
||||
|
||||
GTK_SHELL_PATH=/gtk-shell.xml
|
||||
WAYLAND_PROTOCOLS_PATH=/opt/wayland-protocols
|
||||
WITH_WAYLAND_PROTOCOLS=
|
||||
|
||||
if [ -e "$WAYLAND_PROTOCOLS_PATH" ]; then
|
||||
WITH_WAYLAND_PROTOCOLS="--with-wayland-protocols=$WAYLAND_PROTOCOLS_PATH"
|
||||
fi
|
||||
|
||||
if [ ! -e $GTK_SHELL_PATH ]; then
|
||||
echo $GTK_SHELL_PATH" does not exist"
|
||||
@@ -54,6 +60,7 @@ function do_configure {
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
$WITH_BUNDLED_FREETYPE \
|
||||
$WITH_WAYLAND_PROTOCOLS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@ function do_configure {
|
||||
fi
|
||||
|
||||
GTK_SHELL_PATH=/gtk-shell.xml
|
||||
WAYLAND_PROTOCOLS_PATH=/opt/wayland-protocols
|
||||
WITH_WAYLAND_PROTOCOLS=
|
||||
|
||||
if [ -e "$WAYLAND_PROTOCOLS_PATH" ]; then
|
||||
WITH_WAYLAND_PROTOCOLS="--with-wayland-protocols=$WAYLAND_PROTOCOLS_PATH"
|
||||
fi
|
||||
|
||||
if [ ! -e $GTK_SHELL_PATH ]; then
|
||||
echo $GTK_SHELL_PATH" does not exist"
|
||||
@@ -68,6 +74,7 @@ function do_configure {
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
$WITH_BUNDLED_FREETYPE \
|
||||
$WITH_WAYLAND_PROTOCOLS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ else ifeq ($(call isBuildOsEnv, windows.wsl1 windows.wsl2), true)
|
||||
else
|
||||
M2_REPO := $(HOME)/.m2/repository
|
||||
endif
|
||||
M2_ARTIFACT := $(M2_REPO)/com/jetbrains/jbr-api/SNAPSHOT
|
||||
M2_ARTIFACT := $(M2_REPO)/org/jetbrains/runtime/jbr-api/SNAPSHOT
|
||||
M2_POM_CONTENT := \
|
||||
<?xml version="1.0" encoding="UTF-8"?> \
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" \
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \
|
||||
<modelVersion>4.0.0</modelVersion> \
|
||||
<groupId>com.jetbrains</groupId> \
|
||||
<groupId>org.jetbrains.runtime</groupId> \
|
||||
<artifactId>jbr-api</artifactId> \
|
||||
<version>SNAPSHOT</version> \
|
||||
</project> \
|
||||
@@ -65,7 +65,8 @@ jbr-api:
|
||||
$(MKDIR) -p $(M2_ARTIFACT); \
|
||||
$(ECHO) '$(M2_POM_CONTENT)' > $(M2_ARTIFACT)/$(ARTIFACT_NAME).pom; \
|
||||
$(CP) "$(JBR_API_DIR)/out/$(ARTIFACT_NAME).jar" "$(M2_ARTIFACT)"; \
|
||||
$(ECHO) "Installed into local Maven repository as com.jetbrains:jbr-api:SNAPSHOT"; \
|
||||
$(ECHO) "Installed into local Maven repository as org.jetbrains.runtime:jbr-api:SNAPSHOT"; \
|
||||
cd "$(M2_ARTIFACT)" && sha256sum --binary "$(ARTIFACT_NAME).jar"; \
|
||||
else \
|
||||
$(ECHO) "No Maven repository found at $(M2_REPO) - skipping local installation"; \
|
||||
fi
|
||||
|
||||
@@ -89,7 +89,7 @@ AC_DEFUN_ONCE([LIB_SETUP_VULKAN],
|
||||
if (test "x${with_vulkan_shader_compiler}" = x || test "x${with_vulkan_shader_compiler}" = xglslc); then
|
||||
UTIL_LOOKUP_PROGS(GLSLC, glslc)
|
||||
SHADER_COMPILER="$GLSLC"
|
||||
VULKAN_SHADER_COMPILER="glslc --target-env=vulkan1.2 -mfmt=num -o"
|
||||
VULKAN_SHADER_COMPILER="glslc --target-env=vulkan1.2 -mfmt=num"
|
||||
fi
|
||||
|
||||
# Check glslangValidator
|
||||
@@ -97,7 +97,8 @@ AC_DEFUN_ONCE([LIB_SETUP_VULKAN],
|
||||
test "x$SHADER_COMPILER" = x; then
|
||||
UTIL_LOOKUP_PROGS(GLSLANG, glslangValidator)
|
||||
SHADER_COMPILER="$GLSLANG"
|
||||
VULKAN_SHADER_COMPILER="glslangValidator --target-env vulkan1.2 -x -o"
|
||||
# Newer glslangValidator could use -P\"\#extension GL_GOOGLE_include_directive: require\"
|
||||
VULKAN_SHADER_COMPILER="glslangValidator --target-env vulkan1.2 -x"
|
||||
fi
|
||||
|
||||
if test "x$SHADER_COMPILER" = x; then
|
||||
|
||||
@@ -40,12 +40,23 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
[specify the root directory for the wayland protocols xml files])])
|
||||
AC_ARG_WITH(gtk-shell1-protocol, [AS_HELP_STRING([--with-gtk-shell1-protocol],
|
||||
[specify the path to the gtk-shell1 Wayland protocol xml file])])
|
||||
AC_ARG_WITH(xkbcommon, [AS_HELP_STRING([--with-xkbcommon],
|
||||
[specify prefix directory for the xkbcommon package
|
||||
(expecting the headers under PATH/include)])])
|
||||
AC_ARG_WITH(xkbcommon-include, [AS_HELP_STRING([--with-xkbcommon-include],
|
||||
[specify directory for the xkbcommon include files])])
|
||||
AC_ARG_WITH(xkbcommon-lib, [AS_HELP_STRING([--with-xkbcommon-lib],
|
||||
[specify directory for the xkbcommon library files])])
|
||||
|
||||
if test "x$NEEDS_LIB_WAYLAND" = xfalse; then
|
||||
if (test "x${with_wayland}" != x && test "x${with_wayland}" != xno) || \
|
||||
(test "x${with_wayland_include}" != x && test "x${with_wayland_include}" != xno); then
|
||||
AC_MSG_WARN([[wayland not used, so --with-wayland[-*] is ignored]])
|
||||
fi
|
||||
if (test "x${with_xkbcommon}" != x && test "x${with_xkbcommon}" != xno) || \
|
||||
(test "x${with_xkbcommon_include}" != x && test "x${with_xkbcommon_include}" != xno); then
|
||||
AC_MSG_WARN([[wayland not used, so --with-xkbcommon[-*] is ignored]])
|
||||
fi
|
||||
WAYLAND_CFLAGS=
|
||||
WAYLAND_LIBS=
|
||||
else
|
||||
@@ -55,6 +66,9 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
if test "x${with_wayland}" = xno || test "x${with_wayland_include}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of wayland. Remove the --without-wayland option.])
|
||||
fi
|
||||
if test "x${with_xkbcommon}" = xno || test "x${with_xkbcommon_include}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of xkbcommon. Remove the --without-xkbcommon option.])
|
||||
fi
|
||||
|
||||
if test "x${with_wayland}" != x; then
|
||||
AC_MSG_CHECKING([for wayland headers])
|
||||
@@ -121,7 +135,52 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
HELP_MSG_MISSING_DEPENDENCY([wayland])
|
||||
AC_MSG_ERROR([Could not find wayland! $HELP_MSG ])
|
||||
fi
|
||||
WAYLAND_CFLAGS="${WAYLAND_INCLUDES} ${WAYLAND_DEFINES}"
|
||||
|
||||
XKBCOMMON_FOUND=no
|
||||
XKBCOMMON_INCLUDES=
|
||||
XKBCOMMON_LIBS=-lxkbcommon
|
||||
if test "x${with_xkbcommon}" != x; then
|
||||
AC_MSG_CHECKING([for xkbcommon headers])
|
||||
if test -s "${with_xkbcommon}/include/xkbcommon/xkbcommon.h" &&
|
||||
test -s "${with_xkbcommon}/include/xkbcommon/xkbcommon-compose.h"; then
|
||||
XKBCOMMON_INCLUDES="-I${with_xkbcommon}/include"
|
||||
XKBCOMMON_LIBS="-L${with_xkbcommon}/lib ${XKBCOMMON_LIBS}"
|
||||
|
||||
XKBCOMMON_FOUND=yes
|
||||
AC_MSG_RESULT([$XKBCOMMON_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'include/xkbcommon/xkbcommon.h' and 'include/xkbcommon/xkbcommon-compose.h' under ${with_xkbcommon} given with the --with-xkbcommon option.])
|
||||
fi
|
||||
fi
|
||||
if test "x${with_xkbcommon_include}" != x; then
|
||||
AC_MSG_CHECKING([for xkbcommon headers])
|
||||
if test -s "${with_xkbcommon_include}/xkbcommon/xkbcommon.h" &&
|
||||
test -s "${with_xkbcommon_include}/xkbcommon/xkbcommon-compose.h"; then
|
||||
XKBCOMMON_INCLUDES="-I${with_xkbcommon_include}"
|
||||
XKBCOMMON_FOUND=yes
|
||||
AC_MSG_RESULT([$XKBCOMMON_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'include/xkbcommon/xkbcommon.h' and 'include/xkbcommon/xkbcommon-compose.h' under ${with_xkbcommon_include} given with the --with-xkbcommon-include option.])
|
||||
fi
|
||||
fi
|
||||
if test "x${with_xkbcommon_lib}" != x; then
|
||||
XKBCOMMON_LIBS="-L${with_xkbcommon_lib} ${XKBCOMMON_LIBS}"
|
||||
fi
|
||||
|
||||
if test "x${XKBCOMMON_FOUND}" != xyes; then
|
||||
AC_CHECK_HEADERS([xkbcommon/xkbcommon.h xkbcommon/xkbcommon-compose.h],
|
||||
[ XKBCOMMON_FOUND=yes ],
|
||||
[ XKBCOMMON_FOUND=no; break ]
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$XKBCOMMON_FOUND" != xyes; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([xkbcommon])
|
||||
AC_MSG_ERROR([Could not find xkbcommon! $HELP_MSG ])
|
||||
fi
|
||||
|
||||
WAYLAND_LIBS="${WAYLAND_LIBS} ${XKBCOMMON_LIBS}"
|
||||
WAYLAND_CFLAGS="${WAYLAND_INCLUDES} ${XKBCOMMON_INCLUDES} ${WAYLAND_DEFINES}"
|
||||
fi
|
||||
AC_SUBST(WAYLAND_CFLAGS)
|
||||
AC_SUBST(WAYLAND_LIBS)
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
DEFAULT_VERSION_FEATURE=25
|
||||
DEFAULT_VERSION_INTERIM=0
|
||||
DEFAULT_VERSION_UPDATE=0
|
||||
DEFAULT_VERSION_UPDATE=1
|
||||
DEFAULT_VERSION_PATCH=0
|
||||
DEFAULT_VERSION_EXTRA1=0
|
||||
DEFAULT_VERSION_EXTRA2=0
|
||||
DEFAULT_VERSION_EXTRA3=0
|
||||
DEFAULT_VERSION_DATE=2025-09-16
|
||||
DEFAULT_VERSION_DATE=2025-10-21
|
||||
DEFAULT_VERSION_CLASSFILE_MAJOR=69 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
|
||||
DEFAULT_VERSION_CLASSFILE_MINOR=0
|
||||
DEFAULT_VERSION_DOCS_API_SINCE=11
|
||||
|
||||
@@ -542,10 +542,10 @@ class Bundle {
|
||||
if (pattern != null) {
|
||||
// Perform date-time format pattern conversion which is
|
||||
// applicable to both SimpleDateFormat and j.t.f.DateTimeFormatter.
|
||||
String transPattern = translateDateFormatLetters(calendarType, pattern, this::convertDateTimePatternLetter);
|
||||
String transPattern = translateDateFormatLetters(calendarType, key, pattern, this::convertDateTimePatternLetter);
|
||||
dateTimePatterns.add(i, transPattern);
|
||||
// Additionally, perform SDF specific date-time format pattern conversion
|
||||
sdfPatterns.add(i, translateDateFormatLetters(calendarType, transPattern, this::convertSDFLetter));
|
||||
sdfPatterns.add(i, translateDateFormatLetters(calendarType, key, transPattern, this::convertSDFLetter));
|
||||
} else {
|
||||
dateTimePatterns.add(i, null);
|
||||
sdfPatterns.add(i, null);
|
||||
@@ -568,7 +568,7 @@ class Bundle {
|
||||
}
|
||||
}
|
||||
|
||||
private String translateDateFormatLetters(CalendarType calendarType, String cldrFormat, ConvertDateTimeLetters converter) {
|
||||
private String translateDateFormatLetters(CalendarType calendarType, String patternKey, String cldrFormat, ConvertDateTimeLetters converter) {
|
||||
String pattern = cldrFormat;
|
||||
int length = pattern.length();
|
||||
boolean inQuote = false;
|
||||
@@ -587,7 +587,7 @@ class Bundle {
|
||||
if (nextc == '\'') {
|
||||
i++;
|
||||
if (count != 0) {
|
||||
converter.convert(calendarType, lastLetter, count, jrePattern);
|
||||
converter.convert(calendarType, patternKey, lastLetter, count, jrePattern);
|
||||
lastLetter = 0;
|
||||
count = 0;
|
||||
}
|
||||
@@ -597,7 +597,7 @@ class Bundle {
|
||||
}
|
||||
if (!inQuote) {
|
||||
if (count != 0) {
|
||||
converter.convert(calendarType, lastLetter, count, jrePattern);
|
||||
converter.convert(calendarType, patternKey, lastLetter, count, jrePattern);
|
||||
lastLetter = 0;
|
||||
count = 0;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ class Bundle {
|
||||
}
|
||||
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
|
||||
if (count != 0) {
|
||||
converter.convert(calendarType, lastLetter, count, jrePattern);
|
||||
converter.convert(calendarType, patternKey, lastLetter, count, jrePattern);
|
||||
lastLetter = 0;
|
||||
count = 0;
|
||||
}
|
||||
@@ -627,7 +627,7 @@ class Bundle {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
converter.convert(calendarType, lastLetter, count, jrePattern);
|
||||
converter.convert(calendarType, patternKey, lastLetter, count, jrePattern);
|
||||
lastLetter = c;
|
||||
count = 1;
|
||||
}
|
||||
@@ -637,7 +637,7 @@ class Bundle {
|
||||
}
|
||||
|
||||
if (count != 0) {
|
||||
converter.convert(calendarType, lastLetter, count, jrePattern);
|
||||
converter.convert(calendarType, patternKey, lastLetter, count, jrePattern);
|
||||
}
|
||||
if (cldrFormat.contentEquals(jrePattern)) {
|
||||
return cldrFormat;
|
||||
@@ -661,7 +661,7 @@ class Bundle {
|
||||
* on the support given by the SimpleDateFormat and the j.t.f.DateTimeFormatter
|
||||
* for date-time formatting.
|
||||
*/
|
||||
private void convertDateTimePatternLetter(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
|
||||
private void convertDateTimePatternLetter(CalendarType calendarType, String patternKey, char cldrLetter, int count, StringBuilder sb) {
|
||||
switch (cldrLetter) {
|
||||
case 'u':
|
||||
case 'U':
|
||||
@@ -683,7 +683,7 @@ class Bundle {
|
||||
* Perform a conversion of CLDR date-time format pattern letter which is
|
||||
* specific to the SimpleDateFormat.
|
||||
*/
|
||||
private void convertSDFLetter(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
|
||||
private void convertSDFLetter(CalendarType calendarType, String patternKey, char cldrLetter, int count, StringBuilder sb) {
|
||||
switch (cldrLetter) {
|
||||
case 'G':
|
||||
if (calendarType != CalendarType.GREGORIAN) {
|
||||
@@ -722,6 +722,17 @@ class Bundle {
|
||||
appendN('z', count, sb);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
// If the style is FULL/LONG for a Japanese Calendar, make the
|
||||
// count == 4 for Gan-nen
|
||||
if (calendarType == CalendarType.JAPANESE &&
|
||||
(patternKey.contains("full-") ||
|
||||
patternKey.contains("long-"))) {
|
||||
count = 4;
|
||||
}
|
||||
appendN(cldrLetter, count, sb);
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
if (count == 4 || count == 5) {
|
||||
sb.append("XXX");
|
||||
@@ -767,6 +778,7 @@ class Bundle {
|
||||
.collect(Collectors.toMap(
|
||||
e -> calendarPrefix + e.getKey(),
|
||||
e -> translateDateFormatLetters(calendarType,
|
||||
e.getKey(),
|
||||
(String)e.getValue(),
|
||||
this::convertDateTimePatternLetter)
|
||||
))
|
||||
@@ -775,7 +787,7 @@ class Bundle {
|
||||
|
||||
@FunctionalInterface
|
||||
private interface ConvertDateTimeLetters {
|
||||
void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb);
|
||||
void convert(CalendarType calendarType, String patternKey, char cldrLetter, int count, StringBuilder sb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,7 @@ ifeq ($(call isTargetOs, aix), false)
|
||||
CXXFLAGS := $(LIBJSOUND_CFLAGS), \
|
||||
DISABLED_WARNINGS_gcc := undef unused-variable, \
|
||||
DISABLED_WARNINGS_clang := undef unused-variable, \
|
||||
DISABLED_WARNINGS_clang_PLATFORM_API_MacOSX_Ports.cpp := vla-cxx-extension, \
|
||||
DISABLED_WARNINGS_clang_PLATFORM_API_MacOSX_MidiUtils.c := \
|
||||
unused-but-set-variable, \
|
||||
DISABLED_WARNINGS_clang_DirectAudioDevice.c := unused-function, \
|
||||
|
||||
@@ -33,8 +33,12 @@ WAYLAND_BASIC_PROTOCOL_FILES := \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/stable/viewporter/viewporter.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/stable/xdg-shell/xdg-shell.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/staging/xdg-activation/xdg-activation-v1.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/unstable/primary-selection/primary-selection-unstable-v1.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/unstable/xdg-output/xdg-output-unstable-v1.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/unstable/relative-pointer/relative-pointer-unstable-v1.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/unstable/text-input/text-input-unstable-v3.xml \
|
||||
$(WAYLAND_PROTOCOLS_ROOT)/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml \
|
||||
$(GTK_SHELL1_PROTOCOL_PATH) \
|
||||
#
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
$(TOPDIR)/src/$(MODULE)/share/native/common/font \
|
||||
$(TOPDIR)/src/$(MODULE)/share/native/common/java2d/opengl \
|
||||
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
|
||||
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/launcher \
|
||||
#
|
||||
endif
|
||||
|
||||
@@ -102,6 +101,7 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
LIBAWT_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
|
||||
LIBAWT_VERSIONINFO_RESOURCE := \
|
||||
$(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc
|
||||
LIBAWT_EXTRA_HEADER_DIRS += $(TOPDIR)/src/java.base/windows/native/launcher
|
||||
endif
|
||||
|
||||
# This is the object file to provide the dladdr API, which is not
|
||||
@@ -199,7 +199,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
|
||||
-framework OpenGL, \
|
||||
LIBS_windows := advapi32.lib comctl32.lib comdlg32.lib delayimp.lib \
|
||||
gdi32.lib gdiplus.lib imm32.lib kernel32.lib ole32.lib shell32.lib shlwapi.lib \
|
||||
user32.lib uuid.lib winmm.lib winspool.lib dwmapi.lib $(A11Y_NVDA_ANNOUNCING_LIBS), \
|
||||
user32.lib uuid.lib winmm.lib winspool.lib dwmapi.lib $(A11Y_NVDA_ANNOUNCING_LIBS) oleacc.lib, \
|
||||
VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
|
||||
EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \
|
||||
STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_STATIC_EXCLUDE_OBJS), \
|
||||
@@ -220,7 +220,7 @@ endif
|
||||
# Compile Vulkan shaders
|
||||
define compile-spirv
|
||||
$(call MakeTargetDir)
|
||||
$(VULKAN_SHADER_COMPILER) '$(call DecodeSpace, $@)' '$(call DecodeSpace, $<)'
|
||||
$(VULKAN_SHADER_COMPILER) -D$(call uppercase,$(patsubst .%,STAGE_%,$(suffix $<))) -o '$(call DecodeSpace, $@)' '$(call DecodeSpace, $<)'
|
||||
endef
|
||||
spirv-name = $(strip $1).h
|
||||
|
||||
|
||||
@@ -5344,42 +5344,6 @@ void MacroAssembler::add2_with_carry(Register final_dest_hi, Register dest_hi, R
|
||||
add(final_dest_hi, dest_hi, carry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiply 32 bit by 32 bit first loop.
|
||||
*/
|
||||
void MacroAssembler::multiply_32_x_32_loop(Register x, Register xstart, Register x_xstart,
|
||||
Register y, Register y_idx, Register z,
|
||||
Register carry, Register product,
|
||||
Register idx, Register kdx) {
|
||||
// jlong carry, x[], y[], z[];
|
||||
// for (int idx=ystart, kdx=ystart+1+xstart; idx >= 0; idx--, kdx--) {
|
||||
// long product = y[idx] * x[xstart] + carry;
|
||||
// z[kdx] = (int)product;
|
||||
// carry = product >>> 32;
|
||||
// }
|
||||
// z[xstart] = (int)carry;
|
||||
|
||||
Label L_first_loop, L_first_loop_exit;
|
||||
blez(idx, L_first_loop_exit);
|
||||
|
||||
shadd(t0, xstart, x, t0, LogBytesPerInt);
|
||||
lwu(x_xstart, Address(t0, 0));
|
||||
|
||||
bind(L_first_loop);
|
||||
subiw(idx, idx, 1);
|
||||
shadd(t0, idx, y, t0, LogBytesPerInt);
|
||||
lwu(y_idx, Address(t0, 0));
|
||||
mul(product, x_xstart, y_idx);
|
||||
add(product, product, carry);
|
||||
srli(carry, product, 32);
|
||||
subiw(kdx, kdx, 1);
|
||||
shadd(t0, kdx, z, t0, LogBytesPerInt);
|
||||
sw(product, Address(t0, 0));
|
||||
bgtz(idx, L_first_loop);
|
||||
|
||||
bind(L_first_loop_exit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiply 64 bit by 64 bit first loop.
|
||||
*/
|
||||
@@ -5596,77 +5560,16 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
|
||||
const Register carry = tmp5;
|
||||
const Register product = xlen;
|
||||
const Register x_xstart = tmp0;
|
||||
const Register jdx = tmp1;
|
||||
|
||||
mv(idx, ylen); // idx = ylen;
|
||||
addw(kdx, xlen, ylen); // kdx = xlen+ylen;
|
||||
mv(carry, zr); // carry = 0;
|
||||
|
||||
Label L_multiply_64_x_64_loop, L_done;
|
||||
|
||||
Label L_done;
|
||||
subiw(xstart, xlen, 1);
|
||||
bltz(xstart, L_done);
|
||||
|
||||
const Register jdx = tmp1;
|
||||
|
||||
if (AvoidUnalignedAccesses) {
|
||||
int base_offset = arrayOopDesc::base_offset_in_bytes(T_INT);
|
||||
assert((base_offset % (UseCompactObjectHeaders ? 4 :
|
||||
(UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
|
||||
|
||||
if ((base_offset % 8) == 0) {
|
||||
// multiply_64_x_64_loop emits 8-byte load/store to access two elements
|
||||
// at a time from int arrays x and y. When base_offset is 8 bytes, these
|
||||
// accesses are naturally aligned if both xlen and ylen are even numbers.
|
||||
orr(t0, xlen, ylen);
|
||||
test_bit(t0, t0, 0);
|
||||
beqz(t0, L_multiply_64_x_64_loop);
|
||||
}
|
||||
|
||||
Label L_second_loop_unaligned, L_third_loop, L_third_loop_exit;
|
||||
|
||||
multiply_32_x_32_loop(x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);
|
||||
shadd(t0, xstart, z, t0, LogBytesPerInt);
|
||||
sw(carry, Address(t0, 0));
|
||||
|
||||
bind(L_second_loop_unaligned);
|
||||
mv(carry, zr);
|
||||
mv(jdx, ylen);
|
||||
subiw(xstart, xstart, 1);
|
||||
bltz(xstart, L_done);
|
||||
|
||||
subi(sp, sp, 2 * wordSize);
|
||||
sd(z, Address(sp, 0));
|
||||
sd(zr, Address(sp, wordSize));
|
||||
shadd(t0, xstart, z, t0, LogBytesPerInt);
|
||||
addi(z, t0, 4);
|
||||
shadd(t0, xstart, x, t0, LogBytesPerInt);
|
||||
lwu(product, Address(t0, 0));
|
||||
|
||||
blez(jdx, L_third_loop_exit);
|
||||
|
||||
bind(L_third_loop);
|
||||
subiw(jdx, jdx, 1);
|
||||
shadd(t0, jdx, y, t0, LogBytesPerInt);
|
||||
lwu(t0, Address(t0, 0));
|
||||
mul(t1, t0, product);
|
||||
add(t0, t1, carry);
|
||||
shadd(tmp6, jdx, z, t1, LogBytesPerInt);
|
||||
lwu(t1, Address(tmp6, 0));
|
||||
add(t0, t0, t1);
|
||||
sw(t0, Address(tmp6, 0));
|
||||
srli(carry, t0, 32);
|
||||
bgtz(jdx, L_third_loop);
|
||||
|
||||
bind(L_third_loop_exit);
|
||||
ld(z, Address(sp, 0));
|
||||
addi(sp, sp, 2 * wordSize);
|
||||
shadd(t0, xstart, z, t0, LogBytesPerInt);
|
||||
sw(carry, Address(t0, 0));
|
||||
|
||||
j(L_second_loop_unaligned);
|
||||
}
|
||||
|
||||
bind(L_multiply_64_x_64_loop);
|
||||
multiply_64_x_64_loop(x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);
|
||||
|
||||
Label L_second_loop_aligned;
|
||||
|
||||
@@ -1384,10 +1384,6 @@ public:
|
||||
void adc(Register dst, Register src1, Register src2, Register carry);
|
||||
void add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
|
||||
Register src1, Register src2, Register carry);
|
||||
void multiply_32_x_32_loop(Register x, Register xstart, Register x_xstart,
|
||||
Register y, Register y_idx, Register z,
|
||||
Register carry, Register product,
|
||||
Register idx, Register kdx);
|
||||
void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
|
||||
Register y, Register y_idx, Register z,
|
||||
Register carry, Register product,
|
||||
|
||||
@@ -8431,6 +8431,17 @@ instruct castVV(vReg dst)
|
||||
ins_pipe(pipe_class_empty);
|
||||
%}
|
||||
|
||||
instruct castVVMask(vRegMask dst)
|
||||
%{
|
||||
match(Set dst (CastVV dst));
|
||||
|
||||
size(0);
|
||||
format %{ "# castVV of $dst" %}
|
||||
ins_encode(/* empty encoding */);
|
||||
ins_cost(0);
|
||||
ins_pipe(pipe_class_empty);
|
||||
%}
|
||||
|
||||
// ============================================================================
|
||||
// Convert Instructions
|
||||
|
||||
|
||||
@@ -203,15 +203,15 @@ void VM_Version::common_initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
// Misc Intrinsics could depend on RVV
|
||||
// Misc Intrinsics that could depend on RVV.
|
||||
|
||||
if (UseZba || UseRVV) {
|
||||
if (!AvoidUnalignedAccesses && (UseZba || UseRVV)) {
|
||||
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
|
||||
}
|
||||
} else {
|
||||
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
|
||||
warning("CRC32 intrinsic requires Zba or RVV instructions (not available on this CPU)");
|
||||
warning("CRC32 intrinsic are not available on this CPU.");
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
|
||||
}
|
||||
@@ -325,20 +325,40 @@ void VM_Version::c2_initialize() {
|
||||
FLAG_SET_DEFAULT(UseMulAddIntrinsic, true);
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
|
||||
if (!AvoidUnalignedAccesses) {
|
||||
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
|
||||
}
|
||||
} else if (UseMultiplyToLenIntrinsic) {
|
||||
warning("Intrinsics for BigInteger.multiplyToLen() not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, false);
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, true);
|
||||
if (!AvoidUnalignedAccesses) {
|
||||
if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, true);
|
||||
}
|
||||
} else if (UseSquareToLenIntrinsic) {
|
||||
warning("Intrinsics for BigInteger.squareToLen() not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, false);
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true);
|
||||
if (!AvoidUnalignedAccesses) {
|
||||
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true);
|
||||
}
|
||||
} else if (UseMontgomeryMultiplyIntrinsic) {
|
||||
warning("Intrinsics for BigInteger.montgomeryMultiply() not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, false);
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
|
||||
if (!AvoidUnalignedAccesses) {
|
||||
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
|
||||
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
|
||||
}
|
||||
} else if (UseMontgomerySquareIntrinsic) {
|
||||
warning("Intrinsics for BigInteger.montgomerySquare() not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, false);
|
||||
}
|
||||
|
||||
// Adler32
|
||||
|
||||
@@ -352,16 +352,6 @@ void ClassLoaderDataGraph::verify_dictionary() {
|
||||
}
|
||||
}
|
||||
|
||||
// (DCEVM) - iterate over dict classes
|
||||
void ClassLoaderDataGraph::dictionary_classes_do(KlassClosure* klass_closure) {
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
while (ClassLoaderData* cld = iter.get_next()) {
|
||||
if (cld->dictionary() != nullptr) {
|
||||
cld->dictionary()->classes_do(klass_closure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// (DCEVM) rollback redefined classes
|
||||
void ClassLoaderDataGraph::rollback_redefinition() {
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
@@ -373,17 +363,27 @@ void ClassLoaderDataGraph::rollback_redefinition() {
|
||||
}
|
||||
|
||||
// (DCEVM) - iterate over all classes in all dictionaries
|
||||
bool ClassLoaderDataGraph::dictionary_classes_do_update_klass(Thread* current, Symbol* name, InstanceKlass* k, InstanceKlass* old_klass) {
|
||||
bool ClassLoaderDataGraph::dictionary_classes_do_update_klass(Thread* current, Symbol* name, InstanceKlass* k, InstanceKlass* old_klass, bool check_old) {
|
||||
bool ok = false;
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
while (ClassLoaderData* cld = iter.get_next()) {
|
||||
if (cld->dictionary() != nullptr) {
|
||||
ok = cld->dictionary()->update_klass(current, name, k, old_klass) || ok;
|
||||
ok = cld->dictionary()->update_klass(current, name, k, old_klass, check_old) || ok;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
// (DCEVM) - iterate over all classes in all dictionaries
|
||||
void ClassLoaderDataGraph::dictionary_classes_do_classes_do_safepoint(void f(InstanceKlass* const)) {
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
while (ClassLoaderData* cld = iter.get_next()) {
|
||||
if (cld->dictionary() != nullptr) {
|
||||
cld->dictionary()->classes_do_safepoint(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClassLoaderDataGraph::print_dictionary(outputStream* st) {
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
while (ClassLoaderData *cld = iter.get_next()) {
|
||||
|
||||
@@ -102,9 +102,9 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
static void walk_metadata_and_clean_metaspaces();
|
||||
|
||||
// (DCEVM) Enhanced class redefinition
|
||||
static void dictionary_classes_do(KlassClosure* klass_closure);
|
||||
static void rollback_redefinition();
|
||||
static bool dictionary_classes_do_update_klass(Thread* current, Symbol* name, InstanceKlass* k, InstanceKlass* old_klass);
|
||||
static bool dictionary_classes_do_update_klass(Thread* current, Symbol* name, InstanceKlass* k, InstanceKlass* old_klass, bool check_old);
|
||||
static void dictionary_classes_do_classes_do_safepoint(void f(InstanceKlass* const));
|
||||
|
||||
static void verify_dictionary();
|
||||
static void print_dictionary(outputStream* st);
|
||||
|
||||
@@ -211,15 +211,23 @@ class UpdateKlassDcevm : public StackObj {
|
||||
InstanceKlass* _new_klass;
|
||||
InstanceKlass* _old_klass;
|
||||
bool _replaced;
|
||||
bool _check_old;
|
||||
public:
|
||||
UpdateKlassDcevm(InstanceKlass* new_klass, InstanceKlass* old_klass) :
|
||||
UpdateKlassDcevm(InstanceKlass* new_klass, InstanceKlass* old_klass, bool check_old) :
|
||||
_new_klass(new_klass),
|
||||
_old_klass(old_klass),
|
||||
_replaced(false) {
|
||||
_replaced(false),
|
||||
_check_old(check_old) {
|
||||
}
|
||||
|
||||
void operator()(InstanceKlass** old_table_value) {
|
||||
assert(*old_table_value == _old_klass, "should be old class");
|
||||
InstanceKlass* table_class = *old_table_value;
|
||||
assert(!_check_old || table_class == _old_klass, "should be old class");
|
||||
assert(table_class->class_loader_data() == _new_klass->class_loader_data(), "Must be same class loader");
|
||||
if (!_check_old && table_class->new_version() != nullptr) {
|
||||
ResourceMark rm;
|
||||
log_debug(redefine, class, redefine, metadata)("Updating old class from doit() %s", table_class->name()->as_C_string());
|
||||
}
|
||||
*old_table_value = _new_klass;
|
||||
_replaced = true;
|
||||
}
|
||||
@@ -230,14 +238,14 @@ public:
|
||||
};
|
||||
|
||||
// (DCEVM) replace old_class by new class in dictionary
|
||||
bool Dictionary::update_klass(Thread* current, Symbol* class_name, InstanceKlass* k, InstanceKlass* old_klass) {
|
||||
UpdateKlassDcevm found(k, old_klass);
|
||||
bool Dictionary::update_klass(Thread* current, Symbol* class_name, InstanceKlass* k, InstanceKlass* old_klass, bool check_old) {
|
||||
UpdateKlassDcevm found(k, old_klass, check_old);
|
||||
|
||||
DictionaryLookup lookup(class_name);
|
||||
InstanceKlass* result = nullptr;
|
||||
bool needs_rehashing = false;
|
||||
bool ret = _table->insert_get(current, lookup, old_klass, found);
|
||||
return ret || found.get_replaced();
|
||||
// (DCEVM): old_klass is replaced with the new one in UpdateKlassDcevm::operator(),
|
||||
// which is invoked when class_name is found in the dictionary.
|
||||
bool exists = _table->get(current, lookup, found);
|
||||
return exists && found.get_replaced();
|
||||
}
|
||||
|
||||
class RollBackDcevm : public StackObj {
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
void verify();
|
||||
|
||||
// (DCEVM) Enhanced class redefinition
|
||||
bool update_klass(Thread* current, Symbol* class_name, InstanceKlass* k, InstanceKlass* old_klass);
|
||||
bool update_klass(Thread* current, Symbol* class_name, InstanceKlass* k, InstanceKlass* old_klass, bool check_old);
|
||||
|
||||
void rollback_redefinition();
|
||||
private:
|
||||
|
||||
@@ -1507,7 +1507,7 @@ BasicType java_lang_Class::as_BasicType(oop java_class, Klass** reference_klass)
|
||||
oop java_lang_Class::primitive_mirror(BasicType t) {
|
||||
oop mirror = Universe::java_mirror(t);
|
||||
assert(mirror != nullptr && (mirror->is_a(vmClasses::Class_klass())
|
||||
|| (Universe::is_inside_redefinition() && vmClasses::Class_klass()->old_version() != NULL && mirror->is_a(vmClasses::Class_klass()->old_version()))), "must be a Class");
|
||||
|| (Universe::is_inside_redefinition() && vmClasses::Class_klass()->old_version() != nullptr && mirror->is_a(vmClasses::Class_klass()->old_version()))), "must be a Class");
|
||||
assert(is_primitive(mirror), "must be primitive");
|
||||
return mirror;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,16 @@ bool StackMapTable::match_stackmap(
|
||||
}
|
||||
|
||||
void StackMapTable::check_jump_target(
|
||||
StackMapFrame* frame, int32_t target, TRAPS) const {
|
||||
StackMapFrame* frame, int bci, int offset, TRAPS) const {
|
||||
ErrorContext ctx;
|
||||
// Jump targets must be within the method and the method size is limited. See JVMS 4.11
|
||||
int min_offset = -1 * max_method_code_size;
|
||||
if (offset < min_offset || offset > max_method_code_size) {
|
||||
frame->verifier()->verify_error(ErrorContext::bad_stackmap(bci, frame),
|
||||
"Illegal target of jump or branch (bci %d + offset %d)", bci, offset);
|
||||
return;
|
||||
}
|
||||
int target = bci + offset;
|
||||
bool match = match_stackmap(
|
||||
frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier()));
|
||||
if (!match || (target < 0 || target >= _code_length)) {
|
||||
|
||||
@@ -67,7 +67,7 @@ class StackMapTable : public StackObj {
|
||||
|
||||
// Check jump instructions. Make sure there are no uninitialized
|
||||
// instances on backward branch.
|
||||
void check_jump_target(StackMapFrame* frame, int32_t target, TRAPS) const;
|
||||
void check_jump_target(StackMapFrame* frame, int bci, int offset, TRAPS) const;
|
||||
|
||||
// The following methods are only used inside this class.
|
||||
|
||||
|
||||
@@ -1360,7 +1360,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, InstanceKlass* ol
|
||||
|
||||
ClassLoaderData* loader_data = k->class_loader_data();
|
||||
assert(loader_data->class_loader() == class_loader(), "they must be the same");
|
||||
bool is_redefining = (old_klass != NULL);
|
||||
bool is_redefining = (old_klass != nullptr);
|
||||
|
||||
// Bootstrap and other parallel classloaders don't acquire a lock,
|
||||
// they use placeholder token.
|
||||
@@ -1386,10 +1386,9 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, InstanceKlass* ol
|
||||
if (is_redefining) {
|
||||
// Update all dictionaries containing old_class to new_class
|
||||
// outcome must be same as result of standard redefinition, that does not create a new Klass
|
||||
ClassLoaderDataGraph_lock->lock();
|
||||
MutexLocker lock(ClassLoaderDataGraph_lock);
|
||||
Symbol* name_h = k->name();
|
||||
bool ok = ClassLoaderDataGraph::dictionary_classes_do_update_klass(THREAD, name_h, k, old_klass);
|
||||
ClassLoaderDataGraph_lock->unlock();
|
||||
bool ok = ClassLoaderDataGraph::dictionary_classes_do_update_klass(THREAD, name_h, k, old_klass, true);
|
||||
assert (ok, "must have found old class and updated!");
|
||||
}
|
||||
check_constraints(k, loader_data, !is_redefining, CHECK);
|
||||
@@ -1487,7 +1486,7 @@ InstanceKlass* SystemDictionary::find_or_define_helper(Symbol* class_name, Handl
|
||||
}
|
||||
}
|
||||
|
||||
define_instance_class(k, NULL, class_loader, THREAD);
|
||||
define_instance_class(k, nullptr, class_loader, THREAD);
|
||||
|
||||
// definer must notify any waiting threads
|
||||
{
|
||||
@@ -1527,7 +1526,7 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
|
||||
|
||||
// (DCEVM) - remove from klass hierarchy
|
||||
void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
assert(k != NULL, "just checking");
|
||||
assert(k != nullptr, "just checking");
|
||||
|
||||
// remove receiver from sibling list
|
||||
k->remove_from_sibling_list();
|
||||
|
||||
@@ -781,7 +781,6 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
|
||||
|
||||
// Merge with the next instruction
|
||||
{
|
||||
int target;
|
||||
VerificationType type, type2;
|
||||
VerificationType atype;
|
||||
|
||||
@@ -1606,9 +1605,8 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
|
||||
case Bytecodes::_ifle:
|
||||
current_frame.pop_stack(
|
||||
VerificationType::integer_type(), CHECK_VERIFY(this));
|
||||
target = bcs.dest();
|
||||
stackmap_table.check_jump_target(
|
||||
¤t_frame, target, CHECK_VERIFY(this));
|
||||
¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this));
|
||||
no_control_flow = false; break;
|
||||
case Bytecodes::_if_acmpeq :
|
||||
case Bytecodes::_if_acmpne :
|
||||
@@ -1619,19 +1617,16 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
|
||||
case Bytecodes::_ifnonnull :
|
||||
current_frame.pop_stack(
|
||||
VerificationType::reference_check(), CHECK_VERIFY(this));
|
||||
target = bcs.dest();
|
||||
stackmap_table.check_jump_target
|
||||
(¤t_frame, target, CHECK_VERIFY(this));
|
||||
(¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this));
|
||||
no_control_flow = false; break;
|
||||
case Bytecodes::_goto :
|
||||
target = bcs.dest();
|
||||
stackmap_table.check_jump_target(
|
||||
¤t_frame, target, CHECK_VERIFY(this));
|
||||
¤t_frame, bcs.bci(), bcs.get_offset_s2(), CHECK_VERIFY(this));
|
||||
no_control_flow = true; break;
|
||||
case Bytecodes::_goto_w :
|
||||
target = bcs.dest_w();
|
||||
stackmap_table.check_jump_target(
|
||||
¤t_frame, target, CHECK_VERIFY(this));
|
||||
¤t_frame, bcs.bci(), bcs.get_offset_s4(), CHECK_VERIFY(this));
|
||||
no_control_flow = true; break;
|
||||
case Bytecodes::_tableswitch :
|
||||
case Bytecodes::_lookupswitch :
|
||||
@@ -2280,15 +2275,14 @@ void ClassVerifier::verify_switch(
|
||||
}
|
||||
}
|
||||
}
|
||||
int target = bci + default_offset;
|
||||
stackmap_table->check_jump_target(current_frame, target, CHECK_VERIFY(this));
|
||||
stackmap_table->check_jump_target(current_frame, bci, default_offset, CHECK_VERIFY(this));
|
||||
for (int i = 0; i < keys; i++) {
|
||||
// Because check_jump_target() may safepoint, the bytecode could have
|
||||
// moved, which means 'aligned_bcp' is no good and needs to be recalculated.
|
||||
aligned_bcp = align_up(bcs->bcp() + 1, jintSize);
|
||||
target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
|
||||
int offset = (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
|
||||
stackmap_table->check_jump_target(
|
||||
current_frame, target, CHECK_VERIFY(this));
|
||||
current_frame, bci, offset, CHECK_VERIFY(this));
|
||||
}
|
||||
NOT_PRODUCT(aligned_bcp = nullptr); // no longer valid at this point
|
||||
}
|
||||
@@ -2549,7 +2543,12 @@ bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) {
|
||||
|
||||
case Bytecodes::_goto:
|
||||
case Bytecodes::_goto_w: {
|
||||
int target = (opcode == Bytecodes::_goto ? bcs.dest() : bcs.dest_w());
|
||||
int offset = (opcode == Bytecodes::_goto ? bcs.get_offset_s2() : bcs.get_offset_s4());
|
||||
int min_offset = -1 * max_method_code_size;
|
||||
// Check offset for overflow
|
||||
if (offset < min_offset || offset > max_method_code_size) return false;
|
||||
|
||||
int target = bci + offset;
|
||||
if (visited_branches->contains(bci)) {
|
||||
if (bci_stack->is_empty()) {
|
||||
if (handler_stack->is_empty()) {
|
||||
@@ -2607,7 +2606,10 @@ bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) {
|
||||
|
||||
// Push the switch alternatives onto the stack.
|
||||
for (int i = 0; i < keys; i++) {
|
||||
int target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
|
||||
int min_offset = -1 * max_method_code_size;
|
||||
int offset = (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
|
||||
if (offset < min_offset || offset > max_method_code_size) return false;
|
||||
int target = bci + offset;
|
||||
if (target > code_length) return false;
|
||||
bci_stack->push(target);
|
||||
}
|
||||
|
||||
@@ -2353,7 +2353,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
}
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
// Skip redefined methods
|
||||
if (task->method()->is_old() || task->method()->method_holder()->new_version() != NULL) {
|
||||
if (task->method()->is_old() || task->method()->method_holder()->new_version() != nullptr) {
|
||||
ci_env.record_method_not_compilable("redefined method", true);
|
||||
} else {
|
||||
comp->compile_method(&ci_env, target, osr_bci, true, directive);
|
||||
|
||||
@@ -231,11 +231,11 @@ uint G1FullGCCompactionPoint::find_contiguous_before(G1HeapRegion* hr, uint num_
|
||||
}
|
||||
|
||||
HeapWord* G1FullGCCompactionPoint::forward_compact_top(size_t size) {
|
||||
assert(_current_region != NULL, "Must have been initialized");
|
||||
assert(_current_region != nullptr, "Must have been initialized");
|
||||
// Ensure the object fit in the current region.
|
||||
while (!object_will_fit(size)) {
|
||||
if (!_compaction_region_iterator.has_next()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
switch_region();
|
||||
}
|
||||
@@ -243,7 +243,7 @@ HeapWord* G1FullGCCompactionPoint::forward_compact_top(size_t size) {
|
||||
}
|
||||
|
||||
void G1FullGCCompactionPoint::forward_dcevm(oop object, size_t size, bool force_forward) {
|
||||
assert(_current_region != NULL, "Must have been initialized");
|
||||
assert(_current_region != nullptr, "Must have been initialized");
|
||||
|
||||
// Ensure the object fit in the current region.
|
||||
while (!object_will_fit(size)) {
|
||||
|
||||
@@ -1936,7 +1936,7 @@ void ZPageAllocator::cleanup_failed_commit_multi_partition(ZMultiPartitionAlloca
|
||||
}
|
||||
|
||||
const size_t committed = allocation->committed_capacity();
|
||||
const ZVirtualMemory non_harvested_vmem = vmem.last_part(allocation->harvested());
|
||||
const ZVirtualMemory non_harvested_vmem = partial_vmem.last_part(allocation->harvested());
|
||||
const ZVirtualMemory committed_vmem = non_harvested_vmem.first_part(committed);
|
||||
const ZVirtualMemory non_committed_vmem = non_harvested_vmem.last_part(committed);
|
||||
|
||||
|
||||
@@ -214,9 +214,20 @@ void ZPhysicalMemoryManager::free(const ZVirtualMemory& vmem, uint32_t numa_id)
|
||||
});
|
||||
}
|
||||
|
||||
static size_t inject_commit_limit(const ZVirtualMemory& vmem) {
|
||||
// To facilitate easier interoperability with multi partition allocations we
|
||||
// divide by ZNUMA::count(). Users of ZFailLargerCommits need to be aware of
|
||||
// this when writing tests. In the future we could probe the VirtualMemoryManager
|
||||
// and condition this division on whether the vmem is in the multi partition
|
||||
// address space.
|
||||
return align_up(MIN2(ZFailLargerCommits / ZNUMA::count(), vmem.size()), ZGranuleSize);
|
||||
}
|
||||
|
||||
size_t ZPhysicalMemoryManager::commit(const ZVirtualMemory& vmem, uint32_t numa_id) {
|
||||
zbacking_index* const pmem = _physical_mappings.addr(vmem.start());
|
||||
const size_t size = vmem.size();
|
||||
const size_t size = ZFailLargerCommits > 0
|
||||
? inject_commit_limit(vmem)
|
||||
: vmem.size();
|
||||
|
||||
size_t total_committed = 0;
|
||||
|
||||
|
||||
@@ -118,6 +118,11 @@
|
||||
develop(bool, ZVerifyOops, false, \
|
||||
"Verify accessed oops") \
|
||||
\
|
||||
develop(size_t, ZFailLargerCommits, 0, \
|
||||
"Commits larger than ZFailLargerCommits will be truncated, " \
|
||||
"used to stress page allocation commit failure paths " \
|
||||
"(0: Disabled)") \
|
||||
\
|
||||
develop(uint, ZFakeNUMA, 1, \
|
||||
"ZFakeNUMA is used to test the internal NUMA memory support " \
|
||||
"without the need for UseNUMA") \
|
||||
|
||||
@@ -100,8 +100,23 @@ class BaseBytecodeStream: StackObj {
|
||||
void set_next_bci(int bci) { assert(0 <= bci && bci <= method()->code_size(), "illegal bci"); _next_bci = bci; }
|
||||
|
||||
// Bytecode-specific attributes
|
||||
int dest() const { return bci() + bytecode().get_offset_s2(raw_code()); }
|
||||
int dest_w() const { return bci() + bytecode().get_offset_s4(raw_code()); }
|
||||
int get_offset_s2() const { return bytecode().get_offset_s2(raw_code()); }
|
||||
int get_offset_s4() const { return bytecode().get_offset_s4(raw_code()); }
|
||||
|
||||
// These methods are not safe to use before or during verification as they may
|
||||
// have large offsets and cause overflows
|
||||
int dest() const {
|
||||
int min_offset = -1 * max_method_code_size;
|
||||
int offset = bytecode().get_offset_s2(raw_code());
|
||||
guarantee(offset >= min_offset && offset <= max_method_code_size, "must be");
|
||||
return bci() + offset;
|
||||
}
|
||||
int dest_w() const {
|
||||
int min_offset = -1 * max_method_code_size;
|
||||
int offset = bytecode().get_offset_s4(raw_code());
|
||||
guarantee(offset >= min_offset && offset <= max_method_code_size, "must be");
|
||||
return bci() + offset;
|
||||
}
|
||||
|
||||
// One-byte indices.
|
||||
u1 get_index_u1() const { assert_raw_index_size(1); return *(jubyte*)(bcp()+1); }
|
||||
|
||||
@@ -521,7 +521,7 @@ void Klass::initialize_supers(Klass* k, Array<InstanceKlass*>* transitive_interf
|
||||
_primary_supers[0] = this;
|
||||
assert(super_depth() == 0, "Object must already be initialized properly");
|
||||
} else if (k != super() || k == vmClasses::Object_klass() || (k->is_redefining() && k == vmClasses::Object_klass()->newest_version())) {
|
||||
assert(super() == NULL || super() == vmClasses::Object_klass() || (k->is_redefining() && super() == vmClasses::Object_klass()->newest_version()),
|
||||
assert(super() == nullptr || super() == vmClasses::Object_klass() || (k->is_redefining() && super() == vmClasses::Object_klass()->newest_version()),
|
||||
"initialize this only once to a non-trivial value");
|
||||
set_super(k);
|
||||
Klass* sup = k;
|
||||
@@ -1388,18 +1388,18 @@ void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, b
|
||||
}
|
||||
|
||||
void Klass::update_supers_dcevm() {
|
||||
if (_super != NULL) {
|
||||
if (_super != nullptr) {
|
||||
_super = _super->newest_version();
|
||||
}
|
||||
int sup_depth = super_depth();
|
||||
for (int idx = 0; idx < sup_depth; idx++) {
|
||||
Klass* primary = _primary_supers[idx];
|
||||
if (primary == NULL) {
|
||||
if (primary == nullptr) {
|
||||
break;
|
||||
}
|
||||
_primary_supers[idx] = primary->newest_version();
|
||||
}
|
||||
if (secondary_super_cache() != NULL) {
|
||||
if (secondary_super_cache() != nullptr) {
|
||||
set_secondary_super_cache(secondary_super_cache()->newest_version());
|
||||
}
|
||||
|
||||
|
||||
@@ -432,6 +432,9 @@ protected:
|
||||
const Klass* newest_version() const { return _new_version == nullptr ? this : _new_version->newest_version(); }
|
||||
Klass* newest_version() { return _new_version == nullptr ? this : _new_version->newest_version(); }
|
||||
|
||||
const Klass* oldest_version() const { return _old_version == nullptr ? this : _old_version->oldest_version(); }
|
||||
Klass* oldest_version() { return _old_version == nullptr ? this : _old_version->oldest_version(); }
|
||||
|
||||
const Klass* active_version() const { return _new_version == nullptr || _new_version->is_redefining() ? this : _new_version->active_version(); }
|
||||
Klass* active_version() { return _new_version == nullptr || _new_version->is_redefining() ? this : _new_version->active_version(); }
|
||||
|
||||
|
||||
@@ -1575,9 +1575,14 @@ bool LibraryCallKit::inline_string_toBytesU() {
|
||||
Node* src_start = array_element_address(value, offset, T_CHAR);
|
||||
Node* dst_start = basic_plus_adr(newcopy, arrayOopDesc::base_offset_in_bytes(T_BYTE));
|
||||
|
||||
// Check if src array address is aligned to HeapWordSize (dst is always aligned)
|
||||
const TypeInt* toffset = gvn().type(offset)->is_int();
|
||||
bool aligned = toffset->is_con() && ((toffset->get_con() * type2aelembytes(T_CHAR)) % HeapWordSize == 0);
|
||||
// Check if dst array address is aligned to HeapWordSize
|
||||
bool aligned = (arrayOopDesc::base_offset_in_bytes(T_BYTE) % HeapWordSize == 0);
|
||||
// If true, then check if src array address is aligned to HeapWordSize
|
||||
if (aligned) {
|
||||
const TypeInt* toffset = gvn().type(offset)->is_int();
|
||||
aligned = toffset->is_con() && ((arrayOopDesc::base_offset_in_bytes(T_CHAR) +
|
||||
toffset->get_con() * type2aelembytes(T_CHAR)) % HeapWordSize == 0);
|
||||
}
|
||||
|
||||
// Figure out which arraycopy runtime method to call (disjoint, uninitialized).
|
||||
const char* copyfunc_name = "arraycopy";
|
||||
@@ -1658,8 +1663,8 @@ bool LibraryCallKit::inline_string_getCharsU() {
|
||||
// Check if array addresses are aligned to HeapWordSize
|
||||
const TypeInt* tsrc = gvn().type(src_begin)->is_int();
|
||||
const TypeInt* tdst = gvn().type(dst_begin)->is_int();
|
||||
bool aligned = tsrc->is_con() && ((tsrc->get_con() * type2aelembytes(T_BYTE)) % HeapWordSize == 0) &&
|
||||
tdst->is_con() && ((tdst->get_con() * type2aelembytes(T_CHAR)) % HeapWordSize == 0);
|
||||
bool aligned = tsrc->is_con() && ((arrayOopDesc::base_offset_in_bytes(T_BYTE) + tsrc->get_con() * type2aelembytes(T_BYTE)) % HeapWordSize == 0) &&
|
||||
tdst->is_con() && ((arrayOopDesc::base_offset_in_bytes(T_CHAR) + tdst->get_con() * type2aelembytes(T_CHAR)) % HeapWordSize == 0);
|
||||
|
||||
// Figure out which arraycopy runtime method to call (disjoint, uninitialized).
|
||||
const char* copyfunc_name = "arraycopy";
|
||||
|
||||
@@ -1473,9 +1473,14 @@ void PhaseStringOpts::arraycopy(GraphKit& kit, IdealKit& ideal, Node* src_array,
|
||||
|
||||
Node* src_ptr = __ array_element_address(src_array, __ intcon(0), T_BYTE);
|
||||
Node* dst_ptr = __ array_element_address(dst_array, start, T_BYTE);
|
||||
// Check if destination address is aligned to HeapWordSize
|
||||
const TypeInt* tdst = __ gvn().type(start)->is_int();
|
||||
bool aligned = tdst->is_con() && ((tdst->get_con() * type2aelembytes(T_BYTE)) % HeapWordSize == 0);
|
||||
// Check if src array address is aligned to HeapWordSize
|
||||
bool aligned = (arrayOopDesc::base_offset_in_bytes(T_BYTE) % HeapWordSize == 0);
|
||||
// If true, then check if dst array address is aligned to HeapWordSize
|
||||
if (aligned) {
|
||||
const TypeInt* tdst = __ gvn().type(start)->is_int();
|
||||
aligned = tdst->is_con() && ((arrayOopDesc::base_offset_in_bytes(T_BYTE) +
|
||||
tdst->get_con() * type2aelembytes(T_BYTE)) % HeapWordSize == 0);
|
||||
}
|
||||
// Figure out which arraycopy runtime method to call (disjoint, uninitialized).
|
||||
const char* copyfunc_name = "arraycopy";
|
||||
address copyfunc_addr = StubRoutines::select_arraycopy_function(elembt, aligned, true, copyfunc_name, true);
|
||||
|
||||
@@ -218,9 +218,7 @@ intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, int offset) {
|
||||
DEBUG_ONLY(NoSafepointVerifier nosafepoint;)
|
||||
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
while (field_klass->old_version() != NULL) {
|
||||
field_klass = field_klass->old_version();
|
||||
}
|
||||
field_klass = field_klass->oldest_version();
|
||||
}
|
||||
uintptr_t klass_hash = field_klass->identity_hash();
|
||||
return ((klass_hash & klass_mask) << klass_shift) | checked_mask_in_place;
|
||||
@@ -242,9 +240,9 @@ bool jfieldIDWorkaround::klass_hash_ok(Klass* k, jfieldID id) {
|
||||
intptr_t klass_hash = (as_uint >> klass_shift) & klass_mask;
|
||||
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
while (k->old_version() != NULL) {
|
||||
k = k->old_version();
|
||||
}
|
||||
// DCEVM: use the oldest class version so all pre-existing IDs
|
||||
// from old classes match IDs of the new (current) class.
|
||||
k = k->oldest_version();
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -253,6 +251,11 @@ bool jfieldIDWorkaround::klass_hash_ok(Klass* k, jfieldID id) {
|
||||
if ((k->identity_hash() & klass_mask) == klass_hash)
|
||||
return true;
|
||||
k = k->super();
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
// DCEVM: Same for each superclass: normalize to the oldest version
|
||||
// so old IDs match the new class IDs.
|
||||
k = k->oldest_version();
|
||||
}
|
||||
} while (k != nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
#include "prims/jvmtiThreadState.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
#if INCLUDE_G1GC
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#endif
|
||||
@@ -372,7 +371,24 @@ class ChangePointersOopClosure : public BasicOopIterateClosure {
|
||||
int ref_kind = (flags >> REFERENCE_KIND_SHIFT) & REFERENCE_KIND_MASK;
|
||||
if (MethodHandles::ref_kind_is_method(ref_kind)) {
|
||||
Method* m = (Method*) java_lang_invoke_MemberName::vmtarget(obj);
|
||||
if (m != nullptr && m->method_holder()->is_redefining()) {
|
||||
if (m == Universe::throw_no_such_method_error()) {
|
||||
// ResolvedMethodTable patches ResolvedMethodName.vmtarget to throw_no_such_method_error() when a method is deleted
|
||||
oop clazz = java_lang_invoke_MemberName::clazz(obj);
|
||||
if (clazz != nullptr) {
|
||||
Klass* k = java_lang_Class::as_Klass(clazz);
|
||||
if (k != nullptr && (k->is_redefining() || k->new_version() != nullptr)
|
||||
&& (k->newest_version() != vmClasses::internal_Unsafe_klass()->newest_version())) {
|
||||
// vmtarget is a throw-sentinel
|
||||
intptr_t vmindex = java_lang_invoke_MemberName::vmindex(obj);
|
||||
if (vmindex >= 0) {
|
||||
// A vtable/itable vmindex can still be cached for invokeVirtual/invokeInterface handles.
|
||||
// After class redefinition the vtable/itable layout may change and the deleted method is
|
||||
// no longer at this slot, so we must clear the oop.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (m != nullptr && m->method_holder()->is_redefining()) {
|
||||
// Let's try to re-resolve method
|
||||
InstanceKlass* newest = InstanceKlass::cast(m->method_holder()->newest_version());
|
||||
Method* new_method = newest->find_method(m->name(), m->signature());
|
||||
@@ -695,6 +711,16 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
new_class->old_version()->set_new_version(new_class);
|
||||
}
|
||||
|
||||
// Update Dictionaries to ensure all references contain the new class versions.
|
||||
// During load_new_class_versions(), another thread may have loaded an old version, so this pass replaces
|
||||
// any remaining old ones.
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* new_class = _new_classes->at(i);
|
||||
InstanceKlass* old_class = InstanceKlass::cast(new_class->old_version());
|
||||
Symbol *name_h = new_class->name();
|
||||
ClassLoaderDataGraph::dictionary_classes_do_update_klass(Thread::current(), name_h, new_class, old_class, false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
Klass* new_class = _new_classes->at(i);
|
||||
redefine_single_class(current, _new_classes->at(i));
|
||||
@@ -917,7 +943,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
}
|
||||
}
|
||||
log_trace(redefine, class, redefine, metadata)("calling check_class");
|
||||
ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do_safepoint(check_class);
|
||||
ClassLoaderDataGraph::dictionary_classes_do_classes_do_safepoint(check_class);
|
||||
#ifdef PRODUCT
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1097,6 +1097,22 @@ bool WhiteBox::validate_cgroup(bool cgroups_v2_enabled,
|
||||
}
|
||||
#endif
|
||||
|
||||
bool WhiteBox::is_asan_enabled() {
|
||||
#ifdef ADDRESS_SANITIZER
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WhiteBox::is_ubsan_enabled() {
|
||||
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, JavaThread* THREAD) {
|
||||
// Screen for unavailable/bad comp level or null method
|
||||
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
|
||||
@@ -1908,6 +1924,14 @@ WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
|
||||
return (jboolean) obj_oop->mark().has_monitor();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jboolean, WB_IsAsanEnabled(JNIEnv* env))
|
||||
return (jboolean) WhiteBox::is_asan_enabled();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jboolean, WB_IsUbsanEnabled(JNIEnv* env))
|
||||
return (jboolean) WhiteBox::is_ubsan_enabled();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jlong, WB_getInUseMonitorCount(JNIEnv* env, jobject wb))
|
||||
return (jlong) WhiteBox::get_in_use_monitor_count();
|
||||
WB_END
|
||||
@@ -2908,6 +2932,8 @@ static JNINativeMethod methods[] = {
|
||||
(void*)&WB_AddModuleExportsToAll },
|
||||
{CC"deflateIdleMonitors", CC"()Z", (void*)&WB_DeflateIdleMonitors },
|
||||
{CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
|
||||
{CC"isAsanEnabled", CC"()Z", (void*)&WB_IsAsanEnabled },
|
||||
{CC"isUbsanEnabled", CC"()Z", (void*)&WB_IsUbsanEnabled },
|
||||
{CC"getInUseMonitorCount", CC"()J", (void*)&WB_getInUseMonitorCount },
|
||||
{CC"getLockStackCapacity", CC"()I", (void*)&WB_getLockStackCapacity },
|
||||
{CC"supportsRecursiveLightweightLocking", CC"()Z", (void*)&WB_supportsRecursiveLightweightLocking },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2025, 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
|
||||
@@ -72,6 +72,9 @@ class WhiteBox : public AllStatic {
|
||||
#ifdef LINUX
|
||||
static bool validate_cgroup(bool cgroups_v2_enabled, const char* controllers_file, const char* proc_self_cgroup, const char* proc_self_mountinfo, u1* cg_flags);
|
||||
#endif
|
||||
// provide info about enabling of Address Sanitizer / Undefined Behavior Sanitizer
|
||||
static bool is_asan_enabled();
|
||||
static bool is_ubsan_enabled();
|
||||
};
|
||||
|
||||
#endif // SHARE_PRIMS_WHITEBOX_HPP
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __linux
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "cds/aotLogging.hpp"
|
||||
#include "cds/cds_globals.hpp"
|
||||
#include "cds/cdsConfig.hpp"
|
||||
@@ -3855,6 +3859,34 @@ void Arguments::set_compact_headers_flags() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __linux
|
||||
static const char * get_toolkit_name() {
|
||||
const char * toolkit_name = "XToolkit";
|
||||
void* libwayland = dlopen(VERSIONED_JNI_LIB_NAME("wayland-client", "0"), RTLD_LAZY | RTLD_LOCAL);
|
||||
if (!libwayland) {
|
||||
// Fallback to any development version available on the system
|
||||
libwayland = dlopen(JNI_LIB_NAME("wayland-client"), RTLD_LAZY | RTLD_LOCAL);
|
||||
}
|
||||
if (libwayland) {
|
||||
typedef void* (*wl_display_connect_t)(const char*);
|
||||
typedef void (*wl_display_disconnect_t)(void*);
|
||||
|
||||
wl_display_connect_t fp_wl_display_connect = (wl_display_connect_t) dlsym(libwayland, "wl_display_connect");
|
||||
wl_display_disconnect_t fp_wl_display_disconnect = (wl_display_disconnect_t) dlsym(libwayland, "wl_display_disconnect");
|
||||
|
||||
if (fp_wl_display_connect && fp_wl_display_disconnect) {
|
||||
void* display = fp_wl_display_connect(nullptr);
|
||||
if (display) {
|
||||
toolkit_name = "WLToolkit";
|
||||
fp_wl_display_disconnect(display);
|
||||
}
|
||||
}
|
||||
dlclose(libwayland);
|
||||
}
|
||||
return toolkit_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
jint Arguments::apply_ergo() {
|
||||
// Set flags based on ergonomics.
|
||||
jint result = set_ergonomics_flags();
|
||||
@@ -3925,6 +3957,17 @@ jint Arguments::apply_ergo() {
|
||||
FLAG_SET_DEFAULT(BytecodeVerificationRemote, true);
|
||||
}
|
||||
|
||||
#ifdef __linux
|
||||
// Replace -Dawt.toolkit.name=auto with either XToolkit (the default) or
|
||||
// WLToolkit, if we are able to connect to the Wayland server.
|
||||
const char* toolkit_name = PropertyList_get_value(_system_properties, "awt.toolkit.name");
|
||||
if (toolkit_name && strcmp(toolkit_name, "auto") == 0) {
|
||||
const char* toolkit_name = get_toolkit_name();
|
||||
PropertyList_unique_add(&_system_properties, "awt.toolkit.name", toolkit_name,
|
||||
AddProperty, WriteableProperty, ExternalProperty);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
|
||||
if (use_vm_log()) {
|
||||
|
||||
@@ -1312,24 +1312,24 @@ void VMError::report(outputStream* st, bool _verbose) {
|
||||
NativeHeapTrimmer::print_state(st);
|
||||
st->cr();
|
||||
|
||||
STEP("JNI global references")
|
||||
st->print_cr("JNI global refs:");
|
||||
JNIHandles::print_on_unsafe(st);
|
||||
JNIHandles::print_memory_usage_on(st);
|
||||
STEP_IF("JNI global references", _verbose)
|
||||
st->print_cr("JNI global refs:");
|
||||
JNIHandles::print_on_unsafe(st);
|
||||
JNIHandles::print_memory_usage_on(st);
|
||||
|
||||
STEP_IF("Process memory usage", _verbose)
|
||||
print_process_memory_usage(st);
|
||||
|
||||
STEP("OOME stack traces")
|
||||
st->print_cr("OOME stack traces (most recent first):");
|
||||
print_oome_stacks(st);
|
||||
STEP_IF("OOME stack traces", _verbose)
|
||||
st->print_cr("OOME stack traces (most recent first):");
|
||||
print_oome_stacks(st);
|
||||
|
||||
STEP("Classloader stats")
|
||||
st->print_cr("Classloader memory used:");
|
||||
FREE_C_HEAP_ARRAY(void*, _ballast_memory);
|
||||
_ballast_memory = nullptr;
|
||||
print_classloaders_stats(st);
|
||||
print_dup_classes(st); // do it separately in case we're low on memory
|
||||
STEP_IF("Classloader stats", _verbose)
|
||||
st->print_cr("Classloader memory used:");
|
||||
FREE_C_HEAP_ARRAY(void*, _ballast_memory);
|
||||
_ballast_memory = nullptr;
|
||||
print_classloaders_stats(st);
|
||||
print_dup_classes(st); // do it separately in case we're low on memory
|
||||
|
||||
STEP_IF("printing system", _verbose)
|
||||
st->print_cr("--------------- S Y S T E M ---------------");
|
||||
|
||||
@@ -40,7 +40,7 @@ public class IoOverNio {
|
||||
*/
|
||||
public static final Debug DEBUG;
|
||||
public static final boolean IS_ENABLED_IN_GENERAL =
|
||||
System.getProperty("jbr.java.io.use.nio", "false").equalsIgnoreCase("true");
|
||||
System.getProperty("jbr.java.io.use.nio", "true").equalsIgnoreCase("true");
|
||||
private static final ThreadLocal<Integer> ALLOW_IN_THIS_THREAD = new ThreadLocal<>();
|
||||
|
||||
static {
|
||||
@@ -159,5 +159,84 @@ public class IoOverNio {
|
||||
* <p>
|
||||
* The problem was found with the test {@code jtreg:test/jdk/java/io/FileDescriptor/Sharing.java}.
|
||||
*/
|
||||
public static final ThreadLocal<Closeable> PARENT_FOR_FILE_CHANNEL_IMPL = new ThreadLocal<>();
|
||||
public static class ParentForFileChannelImplHolder {
|
||||
private static final ThreadLocal<Closeable> holder = new ThreadLocal<>();
|
||||
|
||||
private ParentForFileChannelImplHolder() {}
|
||||
|
||||
public static Closeable get() {
|
||||
return holder.get();
|
||||
}
|
||||
|
||||
public static void set(Closeable parent) {
|
||||
RecursionGuard.ensureActive();
|
||||
holder.set(parent);
|
||||
}
|
||||
|
||||
public static void remove() {
|
||||
RecursionGuard.ensureActive();
|
||||
holder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>With java.io over java.nio backend, it's possible that some code invokes file system operations while
|
||||
* already executing a similar operation. An example is when a classloader uses {@link FileSystems#getDefault()}
|
||||
* during class loading. Such cases break usage of {@link ParentForFileChannelImplHolder}.</p>
|
||||
*
|
||||
* <p>This class is to be used around places that can hypothetically access {@link ParentForFileChannelImplHolder}
|
||||
* recursively.</p>
|
||||
*/
|
||||
public static class RecursionGuard implements Closeable {
|
||||
private static final ThreadLocal<RecursionGuard> HEAD = new ThreadLocal<>();
|
||||
|
||||
private final RecursionGuard parent;
|
||||
private final Object label;
|
||||
private final ThreadLocalCloseable additionalClosable;
|
||||
|
||||
/**
|
||||
* @param label A unique object for a specific method. The object is used for reference equality.
|
||||
* A static string or a reference to a class is a good candidate.
|
||||
*/
|
||||
public static RecursionGuard create(Object label) {
|
||||
ThreadLocalCloseable additionalClosable = null;
|
||||
for (var guard = HEAD.get(); guard != null; guard = guard.parent) {
|
||||
if (guard.label == label) {
|
||||
additionalClosable = disableInThisThread();
|
||||
break;
|
||||
}
|
||||
}
|
||||
var result = new RecursionGuard(HEAD.get(), label, additionalClosable);
|
||||
HEAD.set(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private RecursionGuard(RecursionGuard parent, Object label, ThreadLocalCloseable additionalClosable) {
|
||||
this.parent = parent;
|
||||
this.label = label;
|
||||
this.additionalClosable = additionalClosable;
|
||||
}
|
||||
|
||||
public static void ensureActive() {
|
||||
if (HEAD.get() == null) {
|
||||
throw new Error("RecursionGuard is not installed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
HEAD.set(parent);
|
||||
if (additionalClosable != null) {
|
||||
additionalClosable.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Intended only for suppressing warnings about unused variables.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static void blackhole(Object any) {
|
||||
// Nothing here.
|
||||
}
|
||||
}
|
||||
@@ -156,37 +156,40 @@ public class FileInputStream extends InputStream
|
||||
}
|
||||
path = file.getPath();
|
||||
|
||||
java.nio.file.FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
Path nioPath = null;
|
||||
if (nioFs != null && path != null) {
|
||||
try {
|
||||
nioPath = nioFs.getPath(path);
|
||||
isRegularFile = Files.isRegularFile(nioPath);
|
||||
} catch (InvalidPathException _) {
|
||||
// Nothing.
|
||||
try (var guard = IoOverNio.RecursionGuard.create(FileInputStream.class)) {
|
||||
IoOverNio.blackhole(guard);
|
||||
java.nio.file.FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
Path nioPath = null;
|
||||
if (nioFs != null && path != null) {
|
||||
try {
|
||||
nioPath = nioFs.getPath(path);
|
||||
isRegularFile = Files.isRegularFile(nioPath);
|
||||
} catch (InvalidPathException _) {
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Two significant differences between the legacy java.io and java.nio.files:
|
||||
// * java.nio.file allows to open directories as streams, java.io.FileInputStream doesn't.
|
||||
// * java.nio.file doesn't work well with pseudo devices, i.e., `seek()` fails, while java.io works well.
|
||||
useNio = nioPath != null && isRegularFile == Boolean.TRUE;
|
||||
// Two significant differences between the legacy java.io and java.nio.files:
|
||||
// * java.nio.file allows to open directories as streams, java.io.FileInputStream doesn't.
|
||||
// * java.nio.file doesn't work well with pseudo devices, i.e., `seek()` fails, while java.io works well.
|
||||
useNio = nioPath != null && isRegularFile == Boolean.TRUE;
|
||||
|
||||
if (useNio) {
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, Set.of(StandardOpenOption.READ), channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
open(path);
|
||||
FileCleanable.register(fd); // open set the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a FileInputStream for %s%n", file);
|
||||
if (useNio) {
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, Set.of(StandardOpenOption.READ), channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
open(path);
|
||||
FileCleanable.register(fd); // open set the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a FileInputStream for %s%n", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,46 +225,49 @@ public class FileOutputStream extends OutputStream
|
||||
}
|
||||
this.path = file.getPath();
|
||||
|
||||
java.nio.file.FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
useNio = path != null && nioFs != null;
|
||||
if (useNio) {
|
||||
Path nioPath = nioFs.getPath(path);
|
||||
try (var guard = IoOverNio.RecursionGuard.create(FileOutputStream.class)) {
|
||||
IoOverNio.blackhole(guard);
|
||||
java.nio.file.FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
useNio = path != null && nioFs != null;
|
||||
if (useNio) {
|
||||
Path nioPath = nioFs.getPath(path);
|
||||
|
||||
// java.io backend doesn't open DOS hidden files for writing, but java.nio.file opens.
|
||||
// This code mimics the old behavior.
|
||||
if (nioFs.getSeparator().equals("\\")) {
|
||||
DosFileAttributes attrs = null;
|
||||
try {
|
||||
var view = Files.getFileAttributeView(nioPath, DosFileAttributeView.class);
|
||||
if (view != null) {
|
||||
attrs = view.readAttributes();
|
||||
// java.io backend doesn't open DOS hidden files for writing, but java.nio.file opens.
|
||||
// This code mimics the old behavior.
|
||||
if (nioFs.getSeparator().equals("\\")) {
|
||||
DosFileAttributes attrs = null;
|
||||
try {
|
||||
var view = Files.getFileAttributeView(nioPath, DosFileAttributeView.class);
|
||||
if (view != null) {
|
||||
attrs = view.readAttributes();
|
||||
}
|
||||
} catch (IOException | UnsupportedOperationException _) {
|
||||
// Windows paths without DOS attributes? Not a problem in this case.
|
||||
}
|
||||
if (attrs != null && (attrs.isHidden() || attrs.isDirectory())) {
|
||||
throw new FileNotFoundException(file.getPath() + " (Access is denied)");
|
||||
}
|
||||
} catch (IOException | UnsupportedOperationException _) {
|
||||
// Windows paths without DOS attributes? Not a problem in this case.
|
||||
}
|
||||
if (attrs != null && (attrs.isHidden() || attrs.isDirectory())) {
|
||||
throw new FileNotFoundException(file.getPath() + " (Access is denied)");
|
||||
}
|
||||
|
||||
Set<OpenOption> options = append
|
||||
? Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.APPEND)
|
||||
: Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, options, channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
this.fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
|
||||
open(this.path, append);
|
||||
FileCleanable.register(fd); // open sets the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a FileOutputStream for %s%n", file);
|
||||
}
|
||||
|
||||
Set<OpenOption> options = append
|
||||
? Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.APPEND)
|
||||
: Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, options, channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
this.fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
|
||||
open(this.path, append);
|
||||
FileCleanable.register(fd); // open sets the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a FileOutputStream for %s%n", file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,10 +273,10 @@ class IoOverNioFileSystem extends FileSystem {
|
||||
try {
|
||||
// This tricky thread local variable allows specifying an argument for sun.nio.ch.FileChannelImpl.<init>
|
||||
// which is not present in the NIO public API and which is not easy to specify another way.
|
||||
IoOverNio.PARENT_FOR_FILE_CHANNEL_IMPL.set(owner);
|
||||
IoOverNio.ParentForFileChannelImplHolder.set(owner);
|
||||
return initializeStreamsUsingNio0(owner, nioFs, file, nioPath, optionsForChannel, channelCleanable);
|
||||
} finally {
|
||||
IoOverNio.PARENT_FOR_FILE_CHANNEL_IMPL.remove();
|
||||
IoOverNio.ParentForFileChannelImplHolder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,7 +876,8 @@ class IoOverNioFileSystem extends FileSystem {
|
||||
|
||||
@Override
|
||||
public boolean delete(File f) {
|
||||
try {
|
||||
try (var guard = IoOverNio.RecursionGuard.create("IoOverNioFileSystem.delete")) {
|
||||
IoOverNio.blackhole(guard);
|
||||
boolean result = delete0(f, true);
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("IoOverNioFileSystem.delete(%s) = %b%n", f, result);
|
||||
|
||||
@@ -279,47 +279,50 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
}
|
||||
path = name;
|
||||
|
||||
FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
Path nioPath = null;
|
||||
if (nioFs != null) {
|
||||
try {
|
||||
nioPath = nioFs.getPath(path);
|
||||
} catch (InvalidPathException _) {
|
||||
// Nothing.
|
||||
try (var guard = IoOverNio.RecursionGuard.create(RandomAccessFile.class)) {
|
||||
IoOverNio.blackhole(guard);
|
||||
FileSystem nioFs = IoOverNioFileSystem.acquireNioFs(path);
|
||||
Path nioPath = null;
|
||||
if (nioFs != null) {
|
||||
try {
|
||||
nioPath = nioFs.getPath(path);
|
||||
} catch (InvalidPathException _) {
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Two significant differences between the legacy java.io and java.nio.files:
|
||||
// * java.nio.file allows to open directories as streams, java.io.FileInputStream doesn't.
|
||||
// * java.nio.file doesn't work well with pseudo devices, i.e., `seek()` fails, while java.io works well.
|
||||
boolean isRegularFile;
|
||||
try {
|
||||
isRegularFile = nioPath != null &&
|
||||
Files.readAttributes(nioPath, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).isRegularFile();
|
||||
}
|
||||
catch (NoSuchFileException _) {
|
||||
isRegularFile = true;
|
||||
}
|
||||
catch (IOException _) {
|
||||
isRegularFile = false;
|
||||
}
|
||||
// Two significant differences between the legacy java.io and java.nio.files:
|
||||
// * java.nio.file allows to open directories as streams, java.io.FileInputStream doesn't.
|
||||
// * java.nio.file doesn't work well with pseudo devices, i.e., `seek()` fails, while java.io works well.
|
||||
boolean isRegularFile;
|
||||
try {
|
||||
isRegularFile = nioPath != null &&
|
||||
Files.readAttributes(nioPath, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).isRegularFile();
|
||||
}
|
||||
catch (NoSuchFileException _) {
|
||||
isRegularFile = true;
|
||||
}
|
||||
catch (IOException _) {
|
||||
isRegularFile = false;
|
||||
}
|
||||
|
||||
useNio = nioPath != null && isRegularFile;
|
||||
if (useNio) {
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, optionsForChannel(imode), channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
open(name, imode);
|
||||
FileCleanable.register(fd); // open sets the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a RandomAccessFile for %s%n", file);
|
||||
useNio = nioPath != null && isRegularFile;
|
||||
if (useNio) {
|
||||
var bundle = IoOverNioFileSystem.initializeStreamUsingNio(
|
||||
this, nioFs, file, nioPath, optionsForChannel(imode), channelCleanable);
|
||||
channel = bundle.channel();
|
||||
fd = bundle.fd();
|
||||
externalChannelHolder = bundle.externalChannelHolder();
|
||||
} else {
|
||||
fd = new FileDescriptor();
|
||||
fd.attach(this);
|
||||
open(name, imode);
|
||||
FileCleanable.register(fd); // open sets the fd, register the cleanup
|
||||
externalChannelHolder = null;
|
||||
}
|
||||
if (DEBUG.writeTraces()) {
|
||||
System.err.printf("Created a RandomAccessFile for %s%n", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1448,8 +1448,8 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
||||
shift(currValue, coder, count, dstOffset, len);
|
||||
count += len;
|
||||
// Coder of CharSequence may be a mismatch, requiring the value array to be inflated
|
||||
byte[] newValue = (s instanceof String str)
|
||||
? putStringAt(currValue, coder, count, dstOffset, str, start, end)
|
||||
byte[] newValue = (s instanceof String str && str.length() == len)
|
||||
? putStringAt(currValue, coder, count, dstOffset, str)
|
||||
: putCharsAt(currValue, coder, count, dstOffset, s, start, end);
|
||||
if (currValue != newValue) {
|
||||
this.coder = UTF16;
|
||||
@@ -1928,10 +1928,10 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
||||
* @param index the index to insert the string
|
||||
* @param str the string
|
||||
*/
|
||||
private static byte[] putStringAt(byte[] value, byte coder, int count, int index, String str, int off, int end) {
|
||||
private static byte[] putStringAt(byte[] value, byte coder, int count, int index, String str) {
|
||||
byte[] newValue = inflateIfNeededFor(value, count, coder, str.coder());
|
||||
coder = (newValue == value) ? coder : UTF16;
|
||||
str.getBytes(newValue, off, index, coder, end - off);
|
||||
str.getBytes(newValue, 0, index, coder, str.length());
|
||||
return newValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,11 +182,11 @@ public final class LocalDate
|
||||
/**
|
||||
* @serial The month-of-year.
|
||||
*/
|
||||
private final byte month;
|
||||
private final short month;
|
||||
/**
|
||||
* @serial The day-of-month.
|
||||
*/
|
||||
private final byte day;
|
||||
private final short day;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@@ -490,8 +490,8 @@ public final class LocalDate
|
||||
*/
|
||||
private LocalDate(int year, int month, int dayOfMonth) {
|
||||
this.year = year;
|
||||
this.month = (byte) month;
|
||||
this.day = (byte) dayOfMonth;
|
||||
this.month = (short) month;
|
||||
this.day = (short) dayOfMonth;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -146,11 +146,11 @@ public final class MonthDay
|
||||
/**
|
||||
* @serial The month-of-year, not null.
|
||||
*/
|
||||
private final byte month;
|
||||
private final int month;
|
||||
/**
|
||||
* @serial The day-of-month.
|
||||
*/
|
||||
private final byte day;
|
||||
private final int day;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@@ -319,8 +319,8 @@ public final class MonthDay
|
||||
* @param dayOfMonth the day-of-month to represent, validated from 1 to 29-31
|
||||
*/
|
||||
private MonthDay(int month, int dayOfMonth) {
|
||||
this.month = (byte) month;
|
||||
this.day = (byte) dayOfMonth;
|
||||
this.month = month;
|
||||
this.day = dayOfMonth;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -153,7 +153,7 @@ public final class YearMonth
|
||||
/**
|
||||
* @serial The month-of-year, not null.
|
||||
*/
|
||||
private final byte month;
|
||||
private final int month;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
@@ -306,7 +306,7 @@ public final class YearMonth
|
||||
*/
|
||||
private YearMonth(int year, int month) {
|
||||
this.year = year;
|
||||
this.month = (byte) month;
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@@ -137,11 +137,11 @@ public final class HijrahDate
|
||||
/**
|
||||
* The month-of-year.
|
||||
*/
|
||||
private final transient byte monthOfYear;
|
||||
private final transient int monthOfYear;
|
||||
/**
|
||||
* The day-of-month.
|
||||
*/
|
||||
private final transient byte dayOfMonth;
|
||||
private final transient int dayOfMonth;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
@@ -273,8 +273,8 @@ public final class HijrahDate
|
||||
|
||||
this.chrono = chrono;
|
||||
this.prolepticYear = prolepticYear;
|
||||
this.monthOfYear = (byte) monthOfYear;
|
||||
this.dayOfMonth = (byte) dayOfMonth;
|
||||
this.monthOfYear = monthOfYear;
|
||||
this.dayOfMonth = dayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,8 +287,8 @@ public final class HijrahDate
|
||||
|
||||
this.chrono = chrono;
|
||||
this.prolepticYear = dateInfo[0];
|
||||
this.monthOfYear = (byte) dateInfo[1];
|
||||
this.dayOfMonth = (byte) dateInfo[2];
|
||||
this.monthOfYear = dateInfo[1];
|
||||
this.dayOfMonth = dateInfo[2];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -140,7 +140,7 @@ public class FileChannelImpl
|
||||
this.sync = sync;
|
||||
this.direct = direct;
|
||||
if (parent == null) {
|
||||
parent = IoOverNio.PARENT_FOR_FILE_CHANNEL_IMPL.get();
|
||||
parent = IoOverNio.ParentForFileChannelImplHolder.get();
|
||||
}
|
||||
this.parent = parent;
|
||||
if (direct) {
|
||||
|
||||
@@ -859,6 +859,22 @@ public class DerValue {
|
||||
return readStringInternal(tag_UniversalString, new UTF_32BE());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the BMPString does not contain any surrogate characters,
|
||||
* which are outside the Basic Multilingual Plane.
|
||||
*
|
||||
* @throws IOException if illegal characters are detected
|
||||
*/
|
||||
public void validateBMPString() throws IOException {
|
||||
String bmpString = getBMPString();
|
||||
for (int i = 0; i < bmpString.length(); i++) {
|
||||
if (Character.isSurrogate(bmpString.charAt(i))) {
|
||||
throw new IOException(
|
||||
"Illegal character in BMPString, index: " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the ASN.1 NULL value
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 2025, 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
|
||||
@@ -71,19 +71,7 @@ final class EntrustTLSPolicy {
|
||||
// OU=(c) 1999 Entrust.net Limited,
|
||||
// OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),
|
||||
// O=Entrust.net
|
||||
"6DC47172E01CBCB0BF62580D895FE2B8AC9AD4F873801E0C10B9C837D21EB177",
|
||||
// cacerts alias: affirmtrustcommercialca
|
||||
// DN: CN=AffirmTrust Commercial, O=AffirmTrust, C=US
|
||||
"0376AB1D54C5F9803CE4B2E201A0EE7EEF7B57B636E8A93C9B8D4860C96F5FA7",
|
||||
// cacerts alias: affirmtrustnetworkingca
|
||||
// DN: CN=AffirmTrust Networking, O=AffirmTrust, C=US
|
||||
"0A81EC5A929777F145904AF38D5D509F66B5E2C58FCDB531058B0E17F3F0B41B",
|
||||
// cacerts alias: affirmtrustpremiumca
|
||||
// DN: CN=AffirmTrust Premium, O=AffirmTrust, C=US
|
||||
"70A73F7F376B60074248904534B11482D5BF0E698ECC498DF52577EBF2E93B9A",
|
||||
// cacerts alias: affirmtrustpremiumeccca
|
||||
// DN: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
|
||||
"BD71FDF6DA97E4CF62D1647ADD2581B07D79ADF8397EB4ECBA9C5E8488821423"
|
||||
"6DC47172E01CBCB0BF62580D895FE2B8AC9AD4F873801E0C10B9C837D21EB177"
|
||||
);
|
||||
|
||||
// Any TLS Server certificate that is anchored by one of the Entrust
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, 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
|
||||
@@ -28,10 +28,13 @@ package sun.security.x509;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.Normalizer;
|
||||
import java.util.*;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.ISO_8859_1;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.nio.charset.StandardCharsets.UTF_16BE;
|
||||
|
||||
import sun.security.util.*;
|
||||
import sun.security.pkcs.PKCS9Attribute;
|
||||
@@ -589,6 +592,10 @@ public class AVA implements DerEncoder {
|
||||
throw new IOException("AVA, extra bytes = "
|
||||
+ derval.data.available());
|
||||
}
|
||||
|
||||
if (value.tag == DerValue.tag_BMPString) {
|
||||
value.validateBMPString();
|
||||
}
|
||||
}
|
||||
|
||||
AVA(DerInputStream in) throws IOException {
|
||||
@@ -713,7 +720,8 @@ public class AVA implements DerEncoder {
|
||||
* NOTE: this implementation only emits DirectoryStrings of the
|
||||
* types returned by isDerString().
|
||||
*/
|
||||
String valStr = new String(value.getDataBytes(), UTF_8);
|
||||
String valStr =
|
||||
new String(value.getDataBytes(), getCharset(value, false));
|
||||
|
||||
/*
|
||||
* 2.4 (cont): If the UTF-8 string does not have any of the
|
||||
@@ -832,7 +840,8 @@ public class AVA implements DerEncoder {
|
||||
* NOTE: this implementation only emits DirectoryStrings of the
|
||||
* types returned by isDerString().
|
||||
*/
|
||||
String valStr = new String(value.getDataBytes(), UTF_8);
|
||||
String valStr =
|
||||
new String(value.getDataBytes(), getCharset(value, true));
|
||||
|
||||
/*
|
||||
* 2.4 (cont): If the UTF-8 string does not have any of the
|
||||
@@ -927,6 +936,39 @@ public class AVA implements DerEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the charset that should be used to decode each DN string type.
|
||||
*
|
||||
* This method ensures that multi-byte (UTF8String and BMPString) types
|
||||
* are decoded using the correct charset and the String forms represent
|
||||
* the correct characters. For 8-bit ASCII-based types (PrintableString
|
||||
* and IA5String), we return ISO_8859_1 rather than ASCII, so that the
|
||||
* complete range of characters can be represented, as many certificates
|
||||
* do not comply with the Internationalized Domain Name ACE format.
|
||||
*
|
||||
* NOTE: this method only supports DirectoryStrings of the types returned
|
||||
* by isDerString().
|
||||
*/
|
||||
private static Charset getCharset(DerValue value, boolean canonical) {
|
||||
if (canonical) {
|
||||
return switch (value.tag) {
|
||||
case DerValue.tag_PrintableString -> ISO_8859_1;
|
||||
case DerValue.tag_UTF8String -> UTF_8;
|
||||
default -> throw new Error("unexpected tag: " + value.tag);
|
||||
};
|
||||
}
|
||||
|
||||
return switch (value.tag) {
|
||||
case DerValue.tag_PrintableString,
|
||||
DerValue.tag_T61String,
|
||||
DerValue.tag_IA5String,
|
||||
DerValue.tag_GeneralString -> ISO_8859_1;
|
||||
case DerValue.tag_BMPString -> UTF_16BE;
|
||||
case DerValue.tag_UTF8String -> UTF_8;
|
||||
default -> throw new Error("unexpected tag: " + value.tag);
|
||||
};
|
||||
}
|
||||
|
||||
boolean hasRFC2253Keyword() {
|
||||
return AVAKeyword.hasKeyword(oid, RFC2253);
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
Owner: CN=AffirmTrust Commercial, O=AffirmTrust, C=US
|
||||
Issuer: CN=AffirmTrust Commercial, O=AffirmTrust, C=US
|
||||
Serial number: 7777062726a9b17c
|
||||
Valid from: Fri Jan 29 14:06:06 GMT 2010 until: Tue Dec 31 14:06:06 GMT 2030
|
||||
Signature algorithm name: SHA256withRSA
|
||||
Subject Public Key Algorithm: 2048-bit RSA key
|
||||
Version: 3
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE
|
||||
BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz
|
||||
dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL
|
||||
MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp
|
||||
cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
|
||||
AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP
|
||||
Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr
|
||||
ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL
|
||||
MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1
|
||||
yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr
|
||||
VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/
|
||||
nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ
|
||||
KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG
|
||||
XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj
|
||||
vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt
|
||||
Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g
|
||||
N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC
|
||||
nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,27 +0,0 @@
|
||||
Owner: CN=AffirmTrust Networking, O=AffirmTrust, C=US
|
||||
Issuer: CN=AffirmTrust Networking, O=AffirmTrust, C=US
|
||||
Serial number: 7c4f04391cd4992d
|
||||
Valid from: Fri Jan 29 14:08:24 GMT 2010 until: Tue Dec 31 14:08:24 GMT 2030
|
||||
Signature algorithm name: SHA1withRSA
|
||||
Subject Public Key Algorithm: 2048-bit RSA key
|
||||
Version: 3
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE
|
||||
BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz
|
||||
dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL
|
||||
MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp
|
||||
cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
|
||||
AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y
|
||||
YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua
|
||||
kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL
|
||||
QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp
|
||||
6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG
|
||||
yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i
|
||||
QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ
|
||||
KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO
|
||||
tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu
|
||||
QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ
|
||||
Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u
|
||||
olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48
|
||||
x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,38 +0,0 @@
|
||||
Owner: CN=AffirmTrust Premium, O=AffirmTrust, C=US
|
||||
Issuer: CN=AffirmTrust Premium, O=AffirmTrust, C=US
|
||||
Serial number: 6d8c1446b1a60aee
|
||||
Valid from: Fri Jan 29 14:10:36 GMT 2010 until: Mon Dec 31 14:10:36 GMT 2040
|
||||
Signature algorithm name: SHA384withRSA
|
||||
Subject Public Key Algorithm: 4096-bit RSA key
|
||||
Version: 3
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE
|
||||
BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz
|
||||
dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG
|
||||
A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U
|
||||
cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf
|
||||
qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ
|
||||
JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ
|
||||
+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS
|
||||
s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5
|
||||
HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7
|
||||
70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG
|
||||
V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S
|
||||
qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S
|
||||
5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia
|
||||
C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX
|
||||
OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE
|
||||
FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/
|
||||
BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2
|
||||
KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
|
||||
Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B
|
||||
8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ
|
||||
MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc
|
||||
0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ
|
||||
u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF
|
||||
u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH
|
||||
YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8
|
||||
GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO
|
||||
RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e
|
||||
KeC2uAloGRwYQw==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,20 +0,0 @@
|
||||
Owner: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
|
||||
Issuer: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
|
||||
Serial number: 7497258ac73f7a54
|
||||
Valid from: Fri Jan 29 14:20:24 GMT 2010 until: Mon Dec 31 14:20:24 GMT 2040
|
||||
Signature algorithm name: SHA384withECDSA
|
||||
Subject Public Key Algorithm: 384-bit EC (secp384r1) key
|
||||
Version: 3
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC
|
||||
VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ
|
||||
cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ
|
||||
BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt
|
||||
VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D
|
||||
0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9
|
||||
ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G
|
||||
A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G
|
||||
A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs
|
||||
aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I
|
||||
flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -32,7 +32,7 @@ formatVersion=3
|
||||
# Version of the currency code information in this class.
|
||||
# It is a serial number that accompanies with each amendment.
|
||||
|
||||
dataVersion=179
|
||||
dataVersion=180
|
||||
|
||||
# List of all valid ISO 4217 currency codes.
|
||||
# To ensure compatibility, do not remove codes.
|
||||
@@ -147,7 +147,7 @@ IO=USD
|
||||
# BRUNEI DARUSSALAM
|
||||
BN=BND
|
||||
# BULGARIA
|
||||
BG=BGN
|
||||
BG=BGN;2025-12-31-22-00-00;EUR
|
||||
# BURKINA FASO
|
||||
BF=XOF
|
||||
# BURUNDI
|
||||
@@ -193,7 +193,7 @@ HR=EUR
|
||||
# CUBA
|
||||
CU=CUP
|
||||
# Curaçao
|
||||
CW=ANG;2025-04-01-04-00-00;XCG
|
||||
CW=XCG
|
||||
# CYPRUS
|
||||
CY=EUR
|
||||
# CZECHIA
|
||||
@@ -510,7 +510,7 @@ SR=SRD
|
||||
# SVALBARD AND JAN MAYEN
|
||||
SJ=NOK
|
||||
# Sint Maarten (Dutch part)
|
||||
SX=ANG;2025-04-01-04-00-00;XCG
|
||||
SX=XCG
|
||||
# ESWATINI
|
||||
SZ=SZL
|
||||
# SWEDEN
|
||||
|
||||
@@ -395,7 +395,8 @@ static jboolean is_superclass(context_type *, fullinfo_type);
|
||||
|
||||
static void initialize_exception_table(context_type *);
|
||||
static int instruction_length(unsigned char *iptr, unsigned char *end);
|
||||
static jboolean isLegalTarget(context_type *, int offset);
|
||||
static jboolean isLegalOffset(context_type *, int bci, int offset);
|
||||
static jboolean isLegalTarget(context_type *, int target);
|
||||
static void verify_constant_pool_type(context_type *, int, unsigned);
|
||||
|
||||
static void initialize_dataflow(context_type *);
|
||||
@@ -1154,9 +1155,9 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
|
||||
case JVM_OPC_goto: {
|
||||
/* Set the ->operand to be the instruction number of the target. */
|
||||
int jump = (((signed char)(code[offset+1])) << 8) + code[offset+2];
|
||||
int target = offset + jump;
|
||||
if (!isLegalTarget(context, target))
|
||||
if (!isLegalOffset(context, offset, jump))
|
||||
CCerror(context, "Illegal target of jump or branch");
|
||||
int target = offset + jump;
|
||||
this_idata->operand.i = code_data[target];
|
||||
break;
|
||||
}
|
||||
@@ -1170,9 +1171,9 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
|
||||
int jump = (((signed char)(code[offset+1])) << 24) +
|
||||
(code[offset+2] << 16) + (code[offset+3] << 8) +
|
||||
(code[offset + 4]);
|
||||
int target = offset + jump;
|
||||
if (!isLegalTarget(context, target))
|
||||
if (!isLegalOffset(context, offset, jump))
|
||||
CCerror(context, "Illegal target of jump or branch");
|
||||
int target = offset + jump;
|
||||
this_idata->operand.i = code_data[target];
|
||||
break;
|
||||
}
|
||||
@@ -1211,13 +1212,16 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
|
||||
}
|
||||
}
|
||||
saved_operand = NEW(int, keys + 2);
|
||||
if (!isLegalTarget(context, offset + _ck_ntohl(lpc[0])))
|
||||
int jump = _ck_ntohl(lpc[0]);
|
||||
if (!isLegalOffset(context, offset, jump))
|
||||
CCerror(context, "Illegal default target in switch");
|
||||
saved_operand[keys + 1] = code_data[offset + _ck_ntohl(lpc[0])];
|
||||
int target = offset + jump;
|
||||
saved_operand[keys + 1] = code_data[target];
|
||||
for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) {
|
||||
int target = offset + _ck_ntohl(lptr[0]);
|
||||
if (!isLegalTarget(context, target))
|
||||
jump = _ck_ntohl(lptr[0]);
|
||||
if (!isLegalOffset(context, offset, jump))
|
||||
CCerror(context, "Illegal branch in tableswitch");
|
||||
target = offset + jump;
|
||||
saved_operand[k + 1] = code_data[target];
|
||||
}
|
||||
saved_operand[0] = keys + 1; /* number of successors */
|
||||
@@ -1746,11 +1750,24 @@ static int instruction_length(unsigned char *iptr, unsigned char *end)
|
||||
|
||||
/* Given the target of a branch, make sure that it's a legal target. */
|
||||
static jboolean
|
||||
isLegalTarget(context_type *context, int offset)
|
||||
isLegalTarget(context_type *context, int target)
|
||||
{
|
||||
int code_length = context->code_length;
|
||||
int *code_data = context->code_data;
|
||||
return (offset >= 0 && offset < code_length && code_data[offset] >= 0);
|
||||
return (target >= 0 && target < code_length && code_data[target] >= 0);
|
||||
}
|
||||
|
||||
/* Given a bci and offset, make sure the offset is valid and the target is legal */
|
||||
static jboolean
|
||||
isLegalOffset(context_type *context, int bci, int offset)
|
||||
{
|
||||
int code_length = context->code_length;
|
||||
int *code_data = context->code_data;
|
||||
int max_offset = 65535; // JVMS 4.11
|
||||
int min_offset = -65535;
|
||||
if (offset < min_offset || offset > max_offset) return JNI_FALSE;
|
||||
int target = bci + offset;
|
||||
return (target >= 0 && target < code_length && code_data[target] >= 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -144,9 +144,6 @@ typedef enum awt_toolkit {
|
||||
TK_WAYLAND = 2
|
||||
} awt_toolkit;
|
||||
|
||||
// TODO when wayland support will be fully implemented change to TK_UNKNOWN
|
||||
// currently wayland support is not Production-Ready ready so default awt toolkit is X11
|
||||
// wayland could be chosen manually via passing -Dawt.toolkit.name=WLToolkit argument
|
||||
static awt_toolkit _awt_toolkit = TK_X11;
|
||||
|
||||
/*
|
||||
@@ -759,33 +756,48 @@ CallJavaMainInNewThread(jlong stack_size, void* args) {
|
||||
/* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */
|
||||
#define MAX_PID_STR_SZ 20
|
||||
|
||||
#ifdef __linux
|
||||
static char*
|
||||
getToolkitNameByEnv() {
|
||||
if (_awt_toolkit == TK_UNKNOWN) {
|
||||
char *xdg_session_type = getenv("XDG_SESSION_TYPE");
|
||||
if (xdg_session_type != NULL && strcmp(xdg_session_type, "wayland") == 0) {
|
||||
_awt_toolkit = TK_WAYLAND;
|
||||
} else if (xdg_session_type != NULL && strcmp(xdg_session_type, "x11") == 0) {
|
||||
_awt_toolkit = TK_X11;
|
||||
} else if (getenv("DISPLAY") != NULL) {
|
||||
_awt_toolkit = TK_X11;
|
||||
} else if (getenv("WAYLAND_DISPLAY") != NULL) {
|
||||
_awt_toolkit = TK_WAYLAND;
|
||||
GetToolkitName(void) {
|
||||
if (_awt_toolkit == TK_UNKNOWN) { // Prefer WLToolkit, then XToolkit
|
||||
void* libwayland = dlopen(VERSIONED_JNI_LIB_NAME("wayland-client", "0"), RTLD_LAZY | RTLD_LOCAL);
|
||||
if (!libwayland) {
|
||||
// Fallback to any development version available on the system
|
||||
libwayland = dlopen(JNI_LIB_NAME("wayland-client"), RTLD_LAZY | RTLD_LOCAL);
|
||||
}
|
||||
if (libwayland) {
|
||||
typedef void* (*wl_display_connect_t)(const char*);
|
||||
typedef void (*wl_display_disconnect_t)(void*);
|
||||
|
||||
wl_display_connect_t fp_wl_display_connect = dlsym(libwayland, "wl_display_connect");
|
||||
wl_display_disconnect_t fp_wl_display_disconnect = dlsym(libwayland, "wl_display_disconnect");
|
||||
|
||||
if (fp_wl_display_connect && fp_wl_display_disconnect) {
|
||||
void* display = fp_wl_display_connect(NULL);
|
||||
if (display) {
|
||||
_awt_toolkit = TK_WAYLAND;
|
||||
fp_wl_display_disconnect(display);
|
||||
}
|
||||
}
|
||||
dlclose(libwayland);
|
||||
}
|
||||
}
|
||||
return _awt_toolkit == TK_WAYLAND ? "WLToolkit" : "XToolkit";
|
||||
}
|
||||
#endif // __linux
|
||||
|
||||
int
|
||||
JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
||||
int argc, char **argv,
|
||||
int mode, char *what, int ret)
|
||||
{
|
||||
char *toolkit_name = getToolkitNameByEnv();
|
||||
#ifdef __linux
|
||||
char *toolkit_name = GetToolkitName();
|
||||
size_t toolkit_name_size = JLI_StrLen("-Dawt.toolkit.name=") + JLI_StrLen(toolkit_name) + 1;
|
||||
char *toolkit_option = (char *)JLI_MemAlloc(toolkit_name_size);
|
||||
snprintf(toolkit_option, toolkit_name_size, "-Dawt.toolkit.name=%s", toolkit_name);
|
||||
AddOption(toolkit_option, NULL);
|
||||
#endif // __linux
|
||||
|
||||
ShowSplashScreen();
|
||||
return ContinueInNewThread(ifn, threadStackSize, argc, argv, mode, what, ret);
|
||||
@@ -806,7 +818,10 @@ RegisterThread()
|
||||
jboolean
|
||||
ProcessPlatformOption(const char *arg)
|
||||
{
|
||||
if (JLI_StrCCmp(arg, "-Dawt.toolkit.name=WLToolkit") == 0) {
|
||||
if (JLI_StrCCmp(arg, "-Dawt.toolkit.name=auto") == 0) {
|
||||
_awt_toolkit = TK_UNKNOWN;
|
||||
return JNI_TRUE;
|
||||
} else if (JLI_StrCCmp(arg, "-Dawt.toolkit.name=WLToolkit") == 0) {
|
||||
_awt_toolkit = TK_WAYLAND;
|
||||
return JNI_TRUE;
|
||||
} else if (JLI_StrCCmp(arg, "-Dawt.toolkit.name=XToolkit") == 0) {
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.util.ArraysSupport;
|
||||
|
||||
import static sun.nio.fs.WindowsNativeDispatcher.*;
|
||||
import static sun.nio.fs.WindowsConstants.*;
|
||||
@@ -284,9 +285,26 @@ class WindowsWatchService
|
||||
private static final short OFFSETOF_FILENAMELENGTH = 8;
|
||||
private static final short OFFSETOF_FILENAME = 12;
|
||||
|
||||
// size of per-directory buffer for events (FIXME - make this configurable)
|
||||
// Need to be less than 4*16384 = 65536. DWORD align.
|
||||
private static final int CHANGES_BUFFER_SIZE = 16 * 1024;
|
||||
// size of per-directory buffer for events
|
||||
// Need to be less than 4*16384 = 65536 when monitoring a directory over the network. DWORD align.
|
||||
private static final int DEFAULT_CHANGES_BUFFER_SIZE = 16 * 1024;
|
||||
static final int CHANGES_BUFFER_SIZE;
|
||||
static {
|
||||
String rawValue = System.getProperty(
|
||||
"jdk.nio.file.WatchService.bufferSizeToRetrieveEventsPerDirectory",
|
||||
String.valueOf(DEFAULT_CHANGES_BUFFER_SIZE));
|
||||
int intValue;
|
||||
try {
|
||||
// Clamp to size of per-directory buffer used to retrieve events.
|
||||
intValue = Math.clamp(
|
||||
Long.decode(rawValue),
|
||||
1,
|
||||
ArraysSupport.SOFT_MAX_ARRAY_LENGTH);
|
||||
} catch (NumberFormatException e) {
|
||||
intValue = DEFAULT_CHANGES_BUFFER_SIZE;
|
||||
}
|
||||
CHANGES_BUFFER_SIZE = intValue;
|
||||
}
|
||||
|
||||
private final WindowsFileSystem fs;
|
||||
private final WindowsWatchService watcher;
|
||||
|
||||
@@ -27,6 +27,7 @@ package com.apple.eawt;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.desktop.AboutEvent;
|
||||
import java.awt.desktop.AboutHandler;
|
||||
@@ -65,8 +66,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.CGraphicsDevice;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
class _AppEventHandler {
|
||||
@@ -274,9 +275,14 @@ class _AppEventHandler {
|
||||
logger.fine("NOTIFY_SCREEN_CHANGE_PARAMETERS");
|
||||
}
|
||||
if (AppContext.getAppContext() != null) {
|
||||
EventQueue.invokeLater(
|
||||
() -> ((SunGraphicsEnvironment) GraphicsEnvironment.
|
||||
getLocalGraphicsEnvironment()).displayParametersChanged());
|
||||
CGraphicsDevice.DisplayConfiguration displayConfiguration = CGraphicsDevice.DisplayConfiguration.get();
|
||||
EventQueue.invokeLater(() -> {
|
||||
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
|
||||
if (gd instanceof CGraphicsDevice) {
|
||||
((CGraphicsDevice) gd).updateDisplayParameters(displayConfiguration);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2025 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.jetbrains.desktop;
|
||||
|
||||
import com.jetbrains.desktop.image.TextureWrapperSurfaceManager;
|
||||
import com.jetbrains.exported.JBRApi;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.java2d.SurfaceData;
|
||||
import sun.java2d.metal.MTLGraphicsConfig;
|
||||
import sun.java2d.metal.MTLTextureWrapperSurfaceData;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
|
||||
@JBRApi.Service
|
||||
@JBRApi.Provides("SharedTextures")
|
||||
public class SharedTexturesService extends SharedTextures {
|
||||
private final int textureType;
|
||||
|
||||
public SharedTexturesService() {
|
||||
textureType = getTextureTypeImpl();
|
||||
if (textureType == UNDEFINED_TEXTURE_TYPE) {
|
||||
throw new JBRApi.ServiceNotAvailableException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureType() {
|
||||
return textureType;
|
||||
}
|
||||
|
||||
private static int getTextureTypeImpl() {
|
||||
GraphicsConfiguration gc = GraphicsEnvironment
|
||||
.getLocalGraphicsEnvironment()
|
||||
.getDefaultScreenDevice()
|
||||
.getDefaultConfiguration();
|
||||
|
||||
if (gc instanceof MTLGraphicsConfig) {
|
||||
return METAL_TEXTURE_TYPE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SurfaceManager createSurfaceManager(GraphicsConfiguration gc, Image image, long texture) {
|
||||
SurfaceData sd;
|
||||
if (gc instanceof MTLGraphicsConfig mtlGraphicsConfig) {
|
||||
sd = new MTLTextureWrapperSurfaceData(mtlGraphicsConfig, image, texture);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported graphics configuration: " + gc);
|
||||
}
|
||||
|
||||
return new TextureWrapperSurfaceManager(sd);
|
||||
}
|
||||
}
|
||||
@@ -34,18 +34,21 @@ import java.awt.Window;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.peer.WindowPeer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.java2d.MacOSFlags;
|
||||
import sun.java2d.metal.MTLGraphicsConfig;
|
||||
import sun.java2d.opengl.CGLGraphicsConfig;
|
||||
import sun.lwawt.macosx.CThreading;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import static java.awt.peer.ComponentPeer.SET_BOUNDS;
|
||||
|
||||
public final class CGraphicsDevice extends GraphicsDevice
|
||||
implements DisplayChangedListener, DisplayParametersChangedListener {
|
||||
implements DisplayChangedListener {
|
||||
|
||||
private static final PlatformLogger logger = PlatformLogger.getLogger(CGraphicsDevice.class.getName());
|
||||
/**
|
||||
@@ -67,7 +70,7 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
private DisplayMode originalMode;
|
||||
private DisplayMode initialMode;
|
||||
|
||||
public CGraphicsDevice(final int displayID) {
|
||||
public CGraphicsDevice(final int displayID, DisplayConfiguration config) {
|
||||
this.displayID = displayID;
|
||||
this.initialMode = getDisplayMode();
|
||||
StringBuilder errorMessage = new StringBuilder();
|
||||
@@ -91,7 +94,7 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
}
|
||||
|
||||
// [JBR] we don't call displayChanged after creating a device, so call it here.
|
||||
displayChanged();
|
||||
updateDevice(config);
|
||||
}
|
||||
|
||||
int getDisplayID() {
|
||||
@@ -174,8 +177,6 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
yResolution = nativeGetYResolution(displayID);
|
||||
isMirroring = nativeIsMirroring(displayID);
|
||||
bounds = nativeGetBounds(displayID).getBounds(); //does integer rounding
|
||||
screenInsets = nativeGetScreenInsets(displayID);
|
||||
initScaleFactor();
|
||||
resizeFSWindow(getFullScreenWindow(), bounds);
|
||||
//TODO configs?
|
||||
}
|
||||
@@ -183,29 +184,43 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
/**
|
||||
* @return false if display parameters were changed, so we need to recreate the device.
|
||||
*/
|
||||
boolean updateDevice() {
|
||||
boolean updateDevice(DisplayConfiguration config) {
|
||||
int s = scale;
|
||||
double xr = xResolution, yr = yResolution;
|
||||
boolean m = isMirroring;
|
||||
var b = bounds;
|
||||
updateDisplayParameters(config);
|
||||
displayChanged();
|
||||
return s == scale && xr == xResolution && yr == yResolution && m == isMirroring && b.equals(bounds);
|
||||
}
|
||||
|
||||
public void displayParametersChanged() {
|
||||
Insets newScreenInsets = nativeGetScreenInsets(displayID);
|
||||
if (!newScreenInsets.equals(screenInsets)) {
|
||||
public void updateDisplayParameters(DisplayConfiguration config) {
|
||||
Descriptor desc = config.getDescriptor(displayID);
|
||||
if (desc == null) return;
|
||||
if (!desc.screenInsets.equals(screenInsets)) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("Screen insets for display(" + displayID + ") changed " +
|
||||
"[top=" + screenInsets.top + ",left=" + screenInsets.left +
|
||||
",bottom=" + screenInsets.bottom + ",right=" + screenInsets.right +
|
||||
"]->[top=" + newScreenInsets.top + ",left=" + newScreenInsets.left +
|
||||
",bottom=" + newScreenInsets.bottom + ",right=" + newScreenInsets.right +
|
||||
"]->[top=" + desc.screenInsets.top + ",left=" + desc.screenInsets.left +
|
||||
",bottom=" + desc.screenInsets.bottom + ",right=" + desc.screenInsets.right +
|
||||
"]");
|
||||
}
|
||||
screenInsets = newScreenInsets;
|
||||
screenInsets = desc.screenInsets;
|
||||
}
|
||||
int newScale = 1;
|
||||
if (SunGraphicsEnvironment.isUIScaleEnabled()) {
|
||||
double debugScale = SunGraphicsEnvironment.getDebugScale();
|
||||
newScale = (int) (debugScale >= 1 ? Math.round(debugScale) : (int) desc.scale);
|
||||
}
|
||||
if (newScale != scale) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("Scale for display(" + displayID + ") changed " + scale + "->" + newScale);
|
||||
}
|
||||
scale = newScale;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paletteChanged() {
|
||||
// devices do not need to react to this event.
|
||||
@@ -352,23 +367,6 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
}
|
||||
}
|
||||
|
||||
private void initScaleFactor() {
|
||||
int _scale = scale;
|
||||
if (SunGraphicsEnvironment.isUIScaleEnabled()) {
|
||||
double debugScale = SunGraphicsEnvironment.getDebugScale();
|
||||
scale = (int) (debugScale >= 1
|
||||
? Math.round(debugScale)
|
||||
: nativeGetScaleFactor(displayID));
|
||||
} else {
|
||||
scale = 1;
|
||||
}
|
||||
if (_scale != scale && logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("current scale = " + _scale + ", new scale = " + scale + " (" + this + ")");
|
||||
}
|
||||
}
|
||||
|
||||
private static native double nativeGetScaleFactor(int displayID);
|
||||
|
||||
private static native void nativeResetDisplayMode();
|
||||
|
||||
private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate);
|
||||
@@ -383,7 +381,37 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
|
||||
private static native boolean nativeIsMirroring(int displayID);
|
||||
|
||||
private static native Insets nativeGetScreenInsets(int displayID);
|
||||
|
||||
private static native Rectangle2D nativeGetBounds(int displayID);
|
||||
|
||||
private static native void nativeGetDisplayConfiguration(DisplayConfiguration config);
|
||||
|
||||
public static final class DisplayConfiguration {
|
||||
private final Map<Integer, Descriptor> map = new HashMap<>();
|
||||
private void addDescriptor(int displayID, int top, int left, int bottom, int right, double scale) {
|
||||
map.put(displayID, new Descriptor(new Insets(top, left, bottom, right), scale));
|
||||
}
|
||||
public Descriptor getDescriptor(int displayID) {
|
||||
return map.get(displayID);
|
||||
}
|
||||
public static DisplayConfiguration get() {
|
||||
try {
|
||||
return CThreading.executeOnAppKit(() -> {
|
||||
DisplayConfiguration config = new DisplayConfiguration();
|
||||
nativeGetDisplayConfiguration(config);
|
||||
return config;
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Descriptor {
|
||||
private final Insets screenInsets;
|
||||
private final double scale;
|
||||
private Descriptor(Insets screenInsets, double scale) {
|
||||
this.screenInsets = screenInsets;
|
||||
this.scale = scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +245,7 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
Map<Integer, CGraphicsDevice> old = new HashMap<>(devices);
|
||||
devices.clear();
|
||||
mainDisplayID = getMainDisplayID();
|
||||
CGraphicsDevice.DisplayConfiguration config = CGraphicsDevice.DisplayConfiguration.get();
|
||||
|
||||
// initialization of the graphics device may change list of displays on
|
||||
// hybrid systems via an activation of discrete video.
|
||||
@@ -252,7 +253,7 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
// of displays, and then recheck the main display again.
|
||||
if (!old.containsKey(mainDisplayID)) {
|
||||
try {
|
||||
old.put(mainDisplayID, new CGraphicsDevice(mainDisplayID));
|
||||
old.put(mainDisplayID, new CGraphicsDevice(mainDisplayID, config));
|
||||
} catch (IllegalStateException e) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("Unable to initialize graphics device for displayID=" +
|
||||
@@ -268,13 +269,13 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
}
|
||||
for (int id : displayIDs) {
|
||||
old.compute(id, (i, d) -> {
|
||||
if (d != null && d.updateDevice()) {
|
||||
if (d != null && d.updateDevice(config)) {
|
||||
// Device didn't change -> reuse
|
||||
devices.put(i, d);
|
||||
return null;
|
||||
} else {
|
||||
// Device changed -> create new
|
||||
devices.put(i, new CGraphicsDevice(i));
|
||||
devices.put(i, new CGraphicsDevice(i, config));
|
||||
return d;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2024, 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
|
||||
@@ -31,7 +31,6 @@ import sun.awt.CGraphicsEnvironment;
|
||||
import sun.awt.image.OffScreenImage;
|
||||
import sun.awt.image.SunVolatileImage;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.awt.image.TextureWrapperSurfaceManager;
|
||||
import sun.awt.image.VolatileSurfaceManager;
|
||||
import sun.java2d.Disposer;
|
||||
import sun.java2d.DisposerRecord;
|
||||
@@ -49,7 +48,6 @@ import java.awt.BufferCapabilities;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Image;
|
||||
import java.awt.ImageCapabilities;
|
||||
import java.awt.Rectangle;
|
||||
@@ -71,7 +69,7 @@ import static sun.java2d.pipe.hw.ContextCapabilities.*;
|
||||
import static sun.java2d.metal.MTLContext.MTLContextCaps.CAPS_EXT_BIOP_SHADER;
|
||||
|
||||
public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
implements AccelGraphicsConfig, SurfaceManager.Factory, SurfaceManager.TextureWrapperFactory
|
||||
implements AccelGraphicsConfig, SurfaceManager.Factory
|
||||
{
|
||||
private static ImageCapabilities imageCaps = new MTLImageCaps();
|
||||
|
||||
@@ -380,11 +378,4 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
Object context) {
|
||||
return new MTLVolatileSurfaceManager(image, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceManager createTextureWrapperSurfaceManager(
|
||||
GraphicsConfiguration gc, Image image, long texture) {
|
||||
SurfaceData sd = MTLSurfaceData.createData(this, image, texture);
|
||||
return new TextureWrapperSurfaceManager(sd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import sun.lwawt.macosx.CFLayer;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Window;
|
||||
|
||||
@@ -51,12 +50,13 @@ public class MTLLayer extends CFLayer {
|
||||
private static native void nativeSetOpaque(long layerPtr, boolean opaque);
|
||||
|
||||
private int scale = 1;
|
||||
private final boolean perfCountersEnabled;
|
||||
|
||||
public MTLLayer(LWWindowPeer peer) {
|
||||
super(0, true);
|
||||
|
||||
Window target = (peer != null) ? peer.getTarget() : null;
|
||||
boolean perfCountersEnabled = (target != null) && AWTAccessor.getWindowAccessor().countersEnabled(target);
|
||||
this.perfCountersEnabled = (target != null) && AWTAccessor.getWindowAccessor().countersEnabled(target);
|
||||
|
||||
setPtr(nativeCreateLayer(perfCountersEnabled));
|
||||
this.peer = peer;
|
||||
@@ -150,11 +150,29 @@ public class MTLLayer extends CFLayer {
|
||||
}
|
||||
}
|
||||
|
||||
private final static String[] STAT_NAMES = new String[]{
|
||||
"java2d.native.mtlLayer.drawInMTLContext", // type = 0
|
||||
"java2d.native.mtlLayer.nextDrawable" // type = 1
|
||||
};
|
||||
|
||||
private void addStat(int type, double value) {
|
||||
// Called from the native code when this layer has been presented on screen
|
||||
if (perfCountersEnabled && (peer != null)) {
|
||||
final Component target = peer.getTarget();
|
||||
if (target instanceof Window window) {
|
||||
AWTAccessor.getWindowAccessor().addStat(window,
|
||||
((type >= 0) && (type < STAT_NAMES.length)) ? STAT_NAMES[type] : "undefined", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void countNewFrame() {
|
||||
// Called from the native code when this layer has been presented on screen
|
||||
Component target = peer.getTarget();
|
||||
if (target instanceof Window window) {
|
||||
AWTAccessor.getWindowAccessor().bumpCounter(window, "java2d.native.frames");
|
||||
if (perfCountersEnabled && (peer != null)) {
|
||||
final Component target = peer.getTarget();
|
||||
if (target instanceof Window window) {
|
||||
AWTAccessor.getWindowAccessor().incrementCounter(window, "java2d.native.frames");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,9 +180,11 @@ public class MTLLayer extends CFLayer {
|
||||
// Called from the native code when an attempt was made to present this layer
|
||||
// on screen, but that attempt was not successful. This can happen, for example,
|
||||
// when those attempts are too frequent.
|
||||
Component target = peer.getTarget();
|
||||
if (target instanceof Window window) {
|
||||
AWTAccessor.getWindowAccessor().bumpCounter(window, "java2d.native.framesDropped");
|
||||
if (perfCountersEnabled && (peer != null)) {
|
||||
final Component target = peer.getTarget();
|
||||
if (target instanceof Window window) {
|
||||
AWTAccessor.getWindowAccessor().incrementCounter(window, "java2d.native.framesDropped");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import java.awt.Transparency;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static sun.java2d.pipe.BufferedOpCodes.DISPOSE_SURFACE;
|
||||
import static sun.java2d.pipe.BufferedOpCodes.FLUSH_SURFACE;
|
||||
@@ -152,7 +151,7 @@ public abstract class MTLSurfaceData extends SurfaceData
|
||||
private native void initOps(MTLGraphicsConfig gc, long pConfigInfo, long pPeerData, long layerPtr,
|
||||
int xoff, int yoff, boolean isOpaque);
|
||||
|
||||
private MTLSurfaceData(MTLLayer layer, MTLGraphicsConfig gc,
|
||||
protected MTLSurfaceData(MTLLayer layer, MTLGraphicsConfig gc,
|
||||
ColorModel cm, int type, int width, int height)
|
||||
{
|
||||
super(getCustomSurfaceType(type), cm);
|
||||
@@ -201,10 +200,6 @@ public abstract class MTLSurfaceData extends SurfaceData
|
||||
type);
|
||||
}
|
||||
|
||||
public static MTLTextureWrapperSurfaceData createData(MTLGraphicsConfig gc, Image image, long pTexture) {
|
||||
return new MTLTextureWrapperSurfaceData(gc, image, pTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDefaultScaleX() {
|
||||
return scale;
|
||||
@@ -224,8 +219,6 @@ public abstract class MTLSurfaceData extends SurfaceData
|
||||
|
||||
protected native boolean initTexture(long pData, boolean isOpaque, int width, int height);
|
||||
|
||||
protected native boolean initWithTexture(long pData, boolean isOpaque, long texturePtr);
|
||||
|
||||
protected native boolean initRTexture(long pData, boolean isOpaque, int width, int height);
|
||||
|
||||
protected native boolean initFlipBackbuffer(long pData, boolean isOpaque, int width, int height);
|
||||
@@ -681,46 +674,4 @@ public abstract class MTLSurfaceData extends SurfaceData
|
||||
}
|
||||
|
||||
private static native boolean loadNativeRasterWithRects(long sdops, long pRaster, int width, int height, long pRects, int rectsCount);
|
||||
|
||||
/**
|
||||
* Surface data for an existing texture
|
||||
*/
|
||||
public static final class MTLTextureWrapperSurfaceData extends MTLSurfaceData {
|
||||
private final Image myImage;
|
||||
|
||||
private MTLTextureWrapperSurfaceData(MTLGraphicsConfig gc, Image image, long pTexture) throws IllegalArgumentException {
|
||||
super(null, gc, ColorModel.getRGBdefault(), RT_TEXTURE, /*width=*/ 0, /*height=*/ 0);
|
||||
myImage = image;
|
||||
|
||||
MTLRenderQueue rq = MTLRenderQueue.getInstance();
|
||||
AtomicBoolean success = new AtomicBoolean(false);
|
||||
|
||||
rq.lock();
|
||||
try {
|
||||
MTLContext.setScratchSurface(gc);
|
||||
rq.flushAndInvokeNow(() -> success.set(initWithTexture(getNativeOps(), false, pTexture)));
|
||||
} finally {
|
||||
rq.unlock();
|
||||
}
|
||||
|
||||
if (!success.get()) {
|
||||
throw new IllegalArgumentException("Failed to init the surface data");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceData getReplacement() {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDestination() {
|
||||
return myImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getBounds() {
|
||||
return getNativeBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package sun.java2d.metal;
|
||||
|
||||
public class MTLSurfaceDataExt {
|
||||
public static boolean initWithTexture(MTLSurfaceData sd, long texturePtr) {
|
||||
return initWithTexture(sd.getNativeOps(), false, texturePtr);
|
||||
}
|
||||
|
||||
private static native boolean initWithTexture(long pData, boolean isOpaque, long texturePtr);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package sun.java2d.metal;
|
||||
|
||||
import sun.java2d.SurfaceData;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Surface data for an existing texture
|
||||
*/
|
||||
public final class MTLTextureWrapperSurfaceData extends MTLSurfaceData {
|
||||
private final Image myImage;
|
||||
|
||||
public MTLTextureWrapperSurfaceData(MTLGraphicsConfig gc, Image image, long pTexture) throws IllegalArgumentException {
|
||||
super(null, gc, gc.getColorModel(TRANSLUCENT), RT_TEXTURE, /*width=*/ 0, /*height=*/ 0);
|
||||
myImage = image;
|
||||
|
||||
MTLRenderQueue rq = MTLRenderQueue.getInstance();
|
||||
AtomicBoolean success = new AtomicBoolean(false);
|
||||
|
||||
rq.lock();
|
||||
try {
|
||||
MTLContext.setScratchSurface(gc);
|
||||
rq.flushAndInvokeNow(() -> success.set(MTLSurfaceDataExt.initWithTexture(this, pTexture)));
|
||||
} finally {
|
||||
rq.unlock();
|
||||
}
|
||||
|
||||
if (!success.get()) {
|
||||
throw new IllegalArgumentException("Failed to init the surface data");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceData getReplacement() {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDestination() {
|
||||
return myImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getBounds() {
|
||||
return getNativeBounds();
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,6 @@ import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowStateListener;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@@ -1066,33 +1065,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
return isFullScreenMode;
|
||||
}
|
||||
|
||||
private void waitForWindowState(int state) {
|
||||
if (peer.getState() == state) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object lock = new Object();
|
||||
WindowStateListener wsl = new WindowStateListener() {
|
||||
public void windowStateChanged(WindowEvent e) {
|
||||
synchronized (lock) {
|
||||
if (e.getNewState() == state) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
target.addWindowStateListener(wsl);
|
||||
if (peer.getState() != state) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (InterruptedException ie) {}
|
||||
}
|
||||
}
|
||||
target.removeWindowStateListener(wsl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowState(int windowState) {
|
||||
if (peer == null || !peer.isVisible()) {
|
||||
@@ -1114,7 +1086,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
// let's return into the normal states first
|
||||
// the zoom call toggles between the normal and the max states
|
||||
unmaximize();
|
||||
waitForWindowState(Frame.NORMAL);
|
||||
}
|
||||
execute(CWrapper.NSWindow::miniaturize);
|
||||
break;
|
||||
@@ -1122,7 +1093,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
if (prevWindowState == Frame.ICONIFIED) {
|
||||
// let's return into the normal states first
|
||||
execute(CWrapper.NSWindow::deminiaturize);
|
||||
waitForWindowState(Frame.NORMAL);
|
||||
}
|
||||
maximize();
|
||||
break;
|
||||
|
||||
@@ -75,6 +75,19 @@ BOOL isColorMatchingEnabled() {
|
||||
return (BOOL)colorMatchingEnabled;
|
||||
}
|
||||
|
||||
BOOL isWindowAnimationEnabled() {
|
||||
static int windowAnimationEnabled = -1;
|
||||
if (windowAnimationEnabled == -1) {
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
||||
if (env == NULL) return NO;
|
||||
NSString* windowAnimationEnabledProp = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.window.animation"
|
||||
withEnv:env];
|
||||
windowAnimationEnabled = [@"true" isCaseInsensitiveLike:windowAnimationEnabledProp] ? YES : NO;
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO, "AWTWindow_windowAnimationEnabled: %d", windowAnimationEnabled);
|
||||
}
|
||||
return (BOOL)windowAnimationEnabled;
|
||||
}
|
||||
|
||||
@interface NSTitlebarAccessoryViewController (Private)
|
||||
- (void)_setHidden:(BOOL)h animated:(BOOL)a;
|
||||
@end
|
||||
@@ -605,6 +618,10 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
if (self.nsWindow == nil) return nil; // no hope either
|
||||
[self.nsWindow release]; // the property retains the object already
|
||||
|
||||
if (!isWindowAnimationEnabled()
|
||||
&& (self.nsWindow.animationBehavior != NSWindowAnimationBehaviorNone)) {
|
||||
self.nsWindow.animationBehavior = NSWindowAnimationBehaviorNone;
|
||||
}
|
||||
if (isColorMatchingEnabled()) {
|
||||
// Supported by both OpenGL & Metal pipelines
|
||||
// Tell the system we have an sRGB backing store
|
||||
@@ -3008,8 +3025,6 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetRoundedCor
|
||||
|
||||
NSWindow *w = (NSWindow *)jlong_to_ptr(windowPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
w.hasShadow = YES;
|
||||
w.contentView.wantsLayer = YES;
|
||||
w.contentView.layer.cornerRadius = radius;
|
||||
w.contentView.layer.masksToBounds = YES;
|
||||
w.contentView.layer.opaque = NO;
|
||||
@@ -3024,11 +3039,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetRoundedCor
|
||||
w.contentView.layer.borderWidth = borderWidth;
|
||||
w.contentView.layer.borderColor = color.CGColor;
|
||||
}
|
||||
w.contentView.wantsLayer = YES;
|
||||
|
||||
w.backgroundColor = NSColor.clearColor;
|
||||
w.opaque = NO;
|
||||
// remove corner radius animation
|
||||
[w.contentView.layer removeAllAnimations];
|
||||
w.hasShadow = YES;
|
||||
[w invalidateShadow];
|
||||
}];
|
||||
|
||||
|
||||
@@ -363,47 +363,6 @@ Java_sun_awt_CGraphicsDevice_nativeGetBounds
|
||||
return CGToJavaRect(env, rect);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_CGraphicsDevice
|
||||
* Method: nativeGetScreenInsets
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetScreenInsets
|
||||
(JNIEnv *env, jclass class, jint displayID)
|
||||
{
|
||||
jobject ret = NULL;
|
||||
__block NSRect frame = NSZeroRect;
|
||||
__block NSRect visibleFrame = NSZeroRect;
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
NSArray *screens = [NSScreen screens];
|
||||
for (NSScreen *screen in screens) {
|
||||
NSDictionary *screenInfo = [screen deviceDescription];
|
||||
NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"];
|
||||
if ([screenID unsignedIntValue] == displayID){
|
||||
frame = [screen frame];
|
||||
visibleFrame = [screen visibleFrame];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}];
|
||||
// Convert between Cocoa's coordinate system and Java.
|
||||
jint bottom = visibleFrame.origin.y - frame.origin.y;
|
||||
jint top = frame.size.height - visibleFrame.size.height - bottom;
|
||||
jint left = visibleFrame.origin.x - frame.origin.x;
|
||||
jint right = frame.size.width - visibleFrame.size.width - left;
|
||||
|
||||
DECLARE_CLASS_RETURN(jc_Insets, "java/awt/Insets", ret);
|
||||
DECLARE_METHOD_RETURN(jc_Insets_ctor, jc_Insets, "<init>", "(IIII)V", ret);
|
||||
ret = (*env)->NewObject(env, jc_Insets, jc_Insets_ctor, top, left, bottom, right);
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_CGraphicsDevice
|
||||
* Method: nativeResetDisplayMode
|
||||
@@ -557,31 +516,40 @@ Java_sun_awt_CGraphicsDevice_nativeGetDisplayModes
|
||||
|
||||
/*
|
||||
* Class: sun_awt_CGraphicsDevice
|
||||
* Method: nativeGetScaleFactor
|
||||
* Signature: (I)D
|
||||
* Method: nativeGetDisplayConfiguration
|
||||
* Signature: (Lsun/awt/CGraphicsDevice$DisplayConfiguration;)V
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetScaleFactor
|
||||
(JNIEnv *env, jclass class, jint displayID)
|
||||
{
|
||||
__block jdouble ret = 1.0f;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetDisplayConfiguration
|
||||
(JNIEnv *env, jclass class, jobject config) {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
NSArray *screens = [NSScreen screens];
|
||||
for (NSScreen *screen in screens) {
|
||||
NSDictionary *screenInfo = [screen deviceDescription];
|
||||
NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"];
|
||||
if ([screenID unsignedIntValue] == displayID){
|
||||
if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
|
||||
ret = [screen backingScaleFactor];
|
||||
}
|
||||
break;
|
||||
}
|
||||
DECLARE_CLASS(jc_DisplayConfiguration, "sun/awt/CGraphicsDevice$DisplayConfiguration");
|
||||
DECLARE_METHOD(jc_DisplayConfiguration_addDescriptor, jc_DisplayConfiguration, "addDescriptor", "(IIIIID)V");
|
||||
|
||||
NSArray *screens = [NSScreen screens];
|
||||
for (NSScreen *screen in screens) {
|
||||
NSDictionary *screenInfo = [screen deviceDescription];
|
||||
NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"];
|
||||
|
||||
jint displayID = [screenID unsignedIntValue];
|
||||
jdouble scale = 1.0;
|
||||
if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
|
||||
scale = [screen backingScaleFactor];
|
||||
}
|
||||
}];
|
||||
NSRect frame = [screen frame];
|
||||
NSRect visibleFrame = [screen visibleFrame];
|
||||
// Convert between Cocoa's coordinate system and Java.
|
||||
jint bottom = visibleFrame.origin.y - frame.origin.y;
|
||||
jint top = frame.size.height - visibleFrame.size.height - bottom;
|
||||
jint left = visibleFrame.origin.x - frame.origin.x;
|
||||
jint right = frame.size.width - visibleFrame.size.width - left;
|
||||
|
||||
(*env)->CallVoidMethod(env, config, jc_DisplayConfiguration_addDescriptor,
|
||||
displayID, top, left, bottom, right, scale);
|
||||
CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ static void displaycb_handle
|
||||
(CGDirectDisplayID displayId, CGDisplayChangeSummaryFlags flags, void *userInfo)
|
||||
{
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
if (TRACE_DISPLAY_CALLBACKS) {
|
||||
@@ -152,7 +153,6 @@ JNI_COCOA_ENTER(env);
|
||||
block:^()
|
||||
{
|
||||
@try {
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject graphicsEnv = (*env)->NewLocalRef(env, cgeRef);
|
||||
if (graphicsEnv == NULL) return; // ref already GC'd
|
||||
DECLARE_CLASS(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
|
||||
@@ -173,7 +173,6 @@ JNI_COCOA_ENTER(env);
|
||||
|
||||
// braces to reduce variable scope
|
||||
{
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject graphicsEnv = (*env)->NewLocalRef(env, cgeRef);
|
||||
if (graphicsEnv == NULL) return; // ref already GC'd
|
||||
DECLARE_CLASS(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
|
||||
|
||||
@@ -311,11 +311,11 @@ static const struct SymbolicHotKey defaultSymbolicHotKeys[] = {
|
||||
[Shortcut_FullScreenTileRight] = { "FullScreenTileRight", "Windows: Full-Screen Tile Right", YES, 65535, 65535, 0, 15, 4 },
|
||||
};
|
||||
|
||||
static const int numSymbolicHotkeys = sizeof(defaultSymbolicHotKeys) / sizeof(defaultSymbolicHotKeys[0]);
|
||||
#define NUM_SYMBOLIC_HOTKEYS (sizeof(defaultSymbolicHotKeys) / sizeof(defaultSymbolicHotKeys[0]))
|
||||
|
||||
static struct SystemHotkeyState {
|
||||
bool symbolicHotkeysFilled;
|
||||
struct SymbolicHotKey currentSymbolicHotkeys[numSymbolicHotkeys];
|
||||
struct SymbolicHotKey currentSymbolicHotkeys[NUM_SYMBOLIC_HOTKEYS];
|
||||
|
||||
bool initialized;
|
||||
bool enabled;
|
||||
@@ -398,7 +398,7 @@ static void visitServicesShortcut(Visitor visitorBlock, NSString * key_equivalen
|
||||
visitorBlock(-1, keyChar.UTF8String, modifiers, desc.UTF8String, -1, NULL);
|
||||
}
|
||||
|
||||
static void readAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[numSymbolicHotkeys]) {
|
||||
static void readAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[NUM_SYMBOLIC_HOTKEYS]) {
|
||||
// Called from the main thread
|
||||
|
||||
@try {
|
||||
@@ -425,7 +425,7 @@ static void readAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[numSymbolicHo
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(hotkeys, defaultSymbolicHotKeys, numSymbolicHotkeys * sizeof(struct SymbolicHotKey));
|
||||
memcpy(hotkeys, defaultSymbolicHotKeys, NUM_SYMBOLIC_HOTKEYS * sizeof(struct SymbolicHotKey));
|
||||
|
||||
for (id keyObj in hkObj) {
|
||||
if (![keyObj isKindOfClass:[NSString class]]) {
|
||||
@@ -438,7 +438,7 @@ static void readAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[numSymbolicHo
|
||||
int uid = [hkNumber intValue];
|
||||
|
||||
// Ignore hotkeys out of range, as well as 0, which is the "invalid value" for intValue
|
||||
if (uid <= 0 || uid >= numSymbolicHotkeys) {
|
||||
if (uid <= 0 || uid >= NUM_SYMBOLIC_HOTKEYS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ static void readAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[numSymbolicHo
|
||||
}
|
||||
|
||||
static void updateAppleSymbolicHotkeysCache() {
|
||||
struct SymbolicHotKey hotkeys[numSymbolicHotkeys];
|
||||
struct SymbolicHotKey hotkeys[NUM_SYMBOLIC_HOTKEYS];
|
||||
readAppleSymbolicHotkeys(hotkeys);
|
||||
|
||||
pthread_mutex_lock(&state.mutex);
|
||||
@@ -521,10 +521,10 @@ static void updateAppleSymbolicHotkeysCache() {
|
||||
pthread_mutex_unlock(&state.mutex);
|
||||
}
|
||||
|
||||
static void iterateAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[numSymbolicHotkeys], Visitor visitorBlock) {
|
||||
static void iterateAppleSymbolicHotkeys(struct SymbolicHotKey hotkeys[NUM_SYMBOLIC_HOTKEYS], Visitor visitorBlock) {
|
||||
const NSOperatingSystemVersion macOSVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
|
||||
for (int uid = 0; uid < numSymbolicHotkeys; ++uid) {
|
||||
for (int uid = 0; uid < NUM_SYMBOLIC_HOTKEYS; ++uid) {
|
||||
struct SymbolicHotKey* hotkey = &hotkeys[uid];
|
||||
|
||||
if (!hotkey->enabled) {
|
||||
@@ -646,12 +646,12 @@ static bool ensureInitializedAndEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void readAppleSymbolicHotkeysCached(struct SymbolicHotKey hotkeys[numSymbolicHotkeys]) {
|
||||
memset(hotkeys, 0, sizeof(struct SymbolicHotKey) * numSymbolicHotkeys);
|
||||
static void readAppleSymbolicHotkeysCached(struct SymbolicHotKey hotkeys[NUM_SYMBOLIC_HOTKEYS]) {
|
||||
memset(hotkeys, 0, sizeof(struct SymbolicHotKey) * NUM_SYMBOLIC_HOTKEYS);
|
||||
|
||||
pthread_mutex_lock(&state.mutex);
|
||||
if (state.symbolicHotkeysFilled) {
|
||||
memcpy(hotkeys, state.currentSymbolicHotkeys, sizeof(struct SymbolicHotKey) * numSymbolicHotkeys);
|
||||
memcpy(hotkeys, state.currentSymbolicHotkeys, sizeof(struct SymbolicHotKey) * NUM_SYMBOLIC_HOTKEYS);
|
||||
}
|
||||
pthread_mutex_unlock(&state.mutex);
|
||||
}
|
||||
@@ -661,7 +661,7 @@ static void readSystemHotkeysImpl(Visitor visitorBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct SymbolicHotKey hotkeys[numSymbolicHotkeys];
|
||||
struct SymbolicHotKey hotkeys[NUM_SYMBOLIC_HOTKEYS];
|
||||
readAppleSymbolicHotkeysCached(hotkeys);
|
||||
|
||||
iterateAppleSymbolicHotkeys(hotkeys, visitorBlock);
|
||||
|
||||
@@ -67,9 +67,17 @@ static jclass sjc_CAccessibility = NULL;
|
||||
jobject axComponent = (*env)->CallStaticObjectMethod(env, sjc_CAccessibility,
|
||||
sjm_getCurrentAccessiblePopupMenu,
|
||||
fAccessible, fComponent);
|
||||
CHECK_EXCEPTION();
|
||||
if (axComponent == NULL) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
CommonComponentAccessibility *currentElement = [CommonComponentAccessibility createWithAccessible:axComponent
|
||||
withEnv:env withView:self->fView isCurrent:YES];
|
||||
(*env)->DeleteLocalRef(env, axComponent);
|
||||
if (currentElement == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray *children = [CommonComponentAccessibility childrenOfParent:currentElement
|
||||
withEnv:env
|
||||
|
||||
@@ -71,6 +71,8 @@
|
||||
- (void) stopRedraw:(MTLContext*)mtlc displayID:(jint)displayID force:(BOOL)force;
|
||||
- (void) flushBuffer;
|
||||
- (void) commitCommandBuffer:(MTLContext*)mtlc wait:(BOOL)waitUntilCompleted display:(BOOL)updateDisplay;
|
||||
|
||||
- (void) addStatCallback:(int)type value:(double)value;
|
||||
- (void) countFramePresentedCallback;
|
||||
- (void) countFrameDroppedCallback;
|
||||
@end
|
||||
|
||||
@@ -112,6 +112,13 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
NSLock* _lock;
|
||||
}
|
||||
|
||||
+ (NSUInteger) getDrawableId:(id<MTLDrawable>)mtlDrawable {
|
||||
if (@available(macOS 10.15.4, *)) {
|
||||
return [mtlDrawable drawableID];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (id) initWithJavaLayer:(jobject)layer usePerfCounters:(jboolean)perfCountersEnabled
|
||||
{
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
@@ -129,6 +136,7 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
[NSNull null], @"anchorPoint",
|
||||
[NSNull null], @"bounds",
|
||||
[NSNull null], @"contents",
|
||||
[NSNull null], @"cornerRadius",
|
||||
[NSNull null], @"contentsScale",
|
||||
[NSNull null], @"onOrderIn",
|
||||
[NSNull null], @"onOrderOut",
|
||||
@@ -226,29 +234,33 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
}
|
||||
|
||||
// Acquire CAMetalDrawable without blocking:
|
||||
const CFTimeInterval beforeDrawableTime = (TRACE_DISPLAY) ? CACurrentMediaTime() : 0.0;
|
||||
const CFTimeInterval beforeDrawableTime = CACurrentMediaTime();
|
||||
const id<CAMetalDrawable> mtlDrawable = [self nextDrawable];
|
||||
if (mtlDrawable == nil) {
|
||||
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: nextDrawable is null");
|
||||
return;
|
||||
}
|
||||
const CFTimeInterval nextDrawableTime = (TRACE_DISPLAY) ? CACurrentMediaTime() : 0.0;
|
||||
const CFTimeInterval nextDrawableTime = CACurrentMediaTime();
|
||||
const CFTimeInterval nextDrawableLatency = (nextDrawableTime - beforeDrawableTime);
|
||||
|
||||
// rolling mean weight (lerp):
|
||||
static const NSTimeInterval a = 0.25;
|
||||
|
||||
#if TRACE_DISPLAY_ON
|
||||
const CFTimeInterval nextDrawableLatency = (nextDrawableTime - beforeDrawableTime);
|
||||
if (nextDrawableLatency > 0.0) {
|
||||
if (self.perfCountersEnabled) {
|
||||
[self addStatCallback:1 value:1000.0 * nextDrawableLatency]; // See MTLLayer.STAT_NAMES[1]
|
||||
}
|
||||
#if TRACE_DISPLAY_ON
|
||||
self.avgNextDrawableTime = nextDrawableLatency * a + self.avgNextDrawableTime * (1.0 - a);
|
||||
}
|
||||
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"[%.6lf] MTLLayer_blitTexture: drawable(%d) presented"
|
||||
" - nextDrawableLatency = %.3lf ms - average = %.3lf ms",
|
||||
CACurrentMediaTime(), mtlDrawable.drawableID,
|
||||
CACurrentMediaTime(), [MTLLayer getDrawableId:mtlDrawable],
|
||||
1000.0 * nextDrawableLatency, 1000.0 * self.avgNextDrawableTime
|
||||
);
|
||||
#endif
|
||||
}
|
||||
// Keep Fence from now:
|
||||
releaseFence = NO;
|
||||
|
||||
@@ -279,7 +291,7 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"[%.6lf] MTLLayer_blitTexture_PresentedHandler: drawable(%d) presented"
|
||||
" - presentedHandlerLatency = %.3lf ms frameInterval = %.3lf ms",
|
||||
CACurrentMediaTime(), drawable.drawableID,
|
||||
CACurrentMediaTime(), [MTLLayer getDrawableId:drawable],
|
||||
1000.0 * presentedHandlerLatency, 1000.0 * frameInterval
|
||||
);
|
||||
self.lastPresentedTime = presentedTime;
|
||||
@@ -294,7 +306,8 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"[%.6lf] MTLLayer_blitTexture_PresentedHandler: drawable(%d) skipped"
|
||||
" - presentedHandlerLatency = %.3lf ms",
|
||||
CACurrentMediaTime(), drawable.drawableID, 1000.0 * presentedHandlerLatency
|
||||
CACurrentMediaTime(), [MTLLayer getDrawableId:drawable],
|
||||
1000.0 * presentedHandlerLatency
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -304,7 +317,7 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
// Present drawable:
|
||||
NSUInteger drawableId = -1;
|
||||
if (TRACE_DISPLAY) {
|
||||
drawableId = mtlDrawable.drawableID;
|
||||
drawableId = [MTLLayer getDrawableId:mtlDrawable];
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO,
|
||||
"[%.6lf] MTLLayer.blitTexture: layer[%p] present drawable(%d)",
|
||||
CACurrentMediaTime(), self, drawableId);
|
||||
@@ -389,8 +402,17 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
return;
|
||||
}
|
||||
|
||||
const CFTimeInterval beforeMethod = CACurrentMediaTime();
|
||||
|
||||
(*env)->CallVoidMethod(env, javaLayerLocalRef, jm_drawInMTLContext);
|
||||
CHECK_EXCEPTION();
|
||||
|
||||
const CFTimeInterval drawInMTLContextLatency = (CACurrentMediaTime() - beforeMethod);
|
||||
if (drawInMTLContextLatency > 0.0) {
|
||||
if (self.perfCountersEnabled) {
|
||||
[self addStatCallback:0 value:1000.0 * drawInMTLContextLatency]; // See MTLLayer.STAT_NAMES[0]
|
||||
}
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, javaLayerLocalRef);
|
||||
}
|
||||
|
||||
@@ -516,6 +538,20 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addStatCallback:(int)type value:(double)value {
|
||||
// attach the current thread to the JVM if necessary, and get an env
|
||||
JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
|
||||
GET_MTL_LAYER_CLASS();
|
||||
DECLARE_METHOD(jm_addStatFrame, jc_JavaLayer, "addStat", "(ID)V");
|
||||
|
||||
jobject javaLayerLocalRef = (*env)->NewLocalRef(env, self.javaLayer);
|
||||
if (javaLayerLocalRef != NULL) {
|
||||
(*env)->CallVoidMethod(env, javaLayerLocalRef, jm_addStatFrame, (jint)type, (jdouble)value);
|
||||
CHECK_EXCEPTION();
|
||||
(*env)->DeleteLocalRef(env, javaLayerLocalRef);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) countFrameDroppedCallback {
|
||||
// attach the current thread to the JVM if necessary, and get an env
|
||||
JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
|
||||
|
||||
@@ -107,81 +107,6 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque
|
||||
}
|
||||
}
|
||||
|
||||
static jboolean MTLSurfaceData_initWithTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque, void* pTexture) {
|
||||
@autoreleasepool {
|
||||
if (bmtlsdo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: ops are null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (pTexture == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: texture is null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
id <MTLTexture> texture = (__bridge id <MTLTexture>) pTexture;
|
||||
if (texture == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: failed to cast texture to MTLTexture");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (texture.width >= MTL_GPU_FAMILY_MAC_TXT_SIZE || texture.height >= MTL_GPU_FAMILY_MAC_TXT_SIZE ||
|
||||
texture.width == 0 || texture.height == 0) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: wrong texture size %d x %d",
|
||||
texture.width, texture.height);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (texture.pixelFormat != MTLPixelFormatBGRA8Unorm) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: unsupported pixel format: %d",
|
||||
texture.pixelFormat);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
bmtlsdo->pTexture = texture;
|
||||
bmtlsdo->pOutTexture = NULL;
|
||||
|
||||
MTLSDOps *mtlsdo = (MTLSDOps *)bmtlsdo->privOps;
|
||||
if (mtlsdo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: MTLSDOps are null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (mtlsdo->configInfo == NULL || mtlsdo->configInfo->context == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: MTLSDOps wasn't initialized (context is null)");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
MTLContext* ctx = mtlsdo->configInfo->context;
|
||||
MTLTextureDescriptor *stencilDataDescriptor =
|
||||
[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatR8Uint
|
||||
width:texture.width
|
||||
height:texture.height
|
||||
mipmapped:NO];
|
||||
stencilDataDescriptor.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
|
||||
stencilDataDescriptor.storageMode = MTLStorageModePrivate;
|
||||
bmtlsdo->pStencilData = [ctx.device newTextureWithDescriptor:stencilDataDescriptor];
|
||||
|
||||
MTLTextureDescriptor *stencilTextureDescriptor =
|
||||
[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatStencil8
|
||||
width:texture.width
|
||||
height:texture.height
|
||||
mipmapped:NO];
|
||||
stencilTextureDescriptor.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead | MTLTextureUsageShaderWrite;
|
||||
stencilTextureDescriptor.storageMode = MTLStorageModePrivate;
|
||||
bmtlsdo->pStencilTexture = [ctx.device newTextureWithDescriptor:stencilTextureDescriptor];
|
||||
|
||||
bmtlsdo->isOpaque = isOpaque;
|
||||
bmtlsdo->width = texture.width;
|
||||
bmtlsdo->height = texture.height;
|
||||
bmtlsdo->drawableType = MTLSD_RT_TEXTURE;
|
||||
|
||||
[texture retain];
|
||||
|
||||
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLSurfaceData_initTexture: w=%d h=%d bp=%p [tex=%p] opaque=%d sfType=%d",
|
||||
bmtlsdo->width, bmtlsdo->height, bmtlsdo, bmtlsdo->pTexture, isOpaque, bmtlsdo->drawableType);
|
||||
return JNI_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an MTL texture, using the given width and height as
|
||||
* a guide.
|
||||
@@ -198,19 +123,6 @@ Java_sun_java2d_metal_MTLSurfaceData_initTexture(
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_java2d_metal_MTLSurfaceData_initWithTexture(
|
||||
JNIEnv *env, jobject mtlds,
|
||||
jlong pData, jboolean isOpaque,
|
||||
jlong pTexture) {
|
||||
BMTLSDOps *bmtlsdops = (BMTLSDOps *) pData;
|
||||
if (!MTLSurfaceData_initWithTexture(bmtlsdops, isOpaque, jlong_to_ptr(pTexture))) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
MTLSD_SetNativeDimensions(env, (BMTLSDOps *) pData, bmtlsdops->width, bmtlsdops->height);
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a framebuffer object, using the given width and height as
|
||||
* a guide. See MTLSD_InitTextureObject() and MTLSD_initRTexture()
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
#import "MTLSurfaceData.h"
|
||||
|
||||
#import "jni_util.h"
|
||||
|
||||
// From MTLSurfaceData.m
|
||||
extern void MTLSD_SetNativeDimensions(JNIEnv *env, BMTLSDOps *bmtlsdo, jint w, jint h);
|
||||
|
||||
static jboolean MTLSurfaceData_initWithTexture(
|
||||
BMTLSDOps *bmtlsdo,
|
||||
jboolean isOpaque,
|
||||
void* pTexture
|
||||
) {
|
||||
@autoreleasepool {
|
||||
if (bmtlsdo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: ops are null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (pTexture == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: texture is null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
id <MTLTexture> texture = (__bridge id <MTLTexture>) pTexture;
|
||||
if (texture == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: failed to cast texture to MTLTexture");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (texture.width >= MTL_GPU_FAMILY_MAC_TXT_SIZE || texture.height >= MTL_GPU_FAMILY_MAC_TXT_SIZE ||
|
||||
texture.width == 0 || texture.height == 0) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: wrong texture size %d x %d",
|
||||
texture.width, texture.height);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
if (texture.pixelFormat != MTLPixelFormatBGRA8Unorm) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: unsupported pixel format: %d",
|
||||
texture.pixelFormat);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
bmtlsdo->pTexture = texture;
|
||||
bmtlsdo->pOutTexture = NULL;
|
||||
|
||||
MTLSDOps *mtlsdo = (MTLSDOps *)bmtlsdo->privOps;
|
||||
if (mtlsdo == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: MTLSDOps are null");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (mtlsdo->configInfo == NULL || mtlsdo->configInfo->context == NULL) {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLSurfaceData_initWithTexture: MTLSDOps wasn't initialized (context is null)");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
MTLContext* ctx = mtlsdo->configInfo->context;
|
||||
MTLTextureDescriptor *stencilDataDescriptor =
|
||||
[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatR8Uint
|
||||
width:texture.width
|
||||
height:texture.height
|
||||
mipmapped:NO];
|
||||
stencilDataDescriptor.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
|
||||
stencilDataDescriptor.storageMode = MTLStorageModePrivate;
|
||||
bmtlsdo->pStencilData = [ctx.device newTextureWithDescriptor:stencilDataDescriptor];
|
||||
|
||||
MTLTextureDescriptor *stencilTextureDescriptor =
|
||||
[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatStencil8
|
||||
width:texture.width
|
||||
height:texture.height
|
||||
mipmapped:NO];
|
||||
stencilTextureDescriptor.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead | MTLTextureUsageShaderWrite;
|
||||
stencilTextureDescriptor.storageMode = MTLStorageModePrivate;
|
||||
bmtlsdo->pStencilTexture = [ctx.device newTextureWithDescriptor:stencilTextureDescriptor];
|
||||
|
||||
bmtlsdo->isOpaque = isOpaque;
|
||||
bmtlsdo->width = texture.width;
|
||||
bmtlsdo->height = texture.height;
|
||||
bmtlsdo->drawableType = MTLSD_RT_TEXTURE;
|
||||
|
||||
[texture retain];
|
||||
|
||||
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLSurfaceData_initTexture: w=%d h=%d bp=%p [tex=%p] opaque=%d sfType=%d",
|
||||
bmtlsdo->width, bmtlsdo->height, bmtlsdo, bmtlsdo->pTexture, isOpaque, bmtlsdo->drawableType);
|
||||
return JNI_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_java2d_metal_MTLSurfaceDataExt_initWithTexture(
|
||||
JNIEnv *env,
|
||||
jclass cls,
|
||||
jlong pData,
|
||||
jboolean isOpaque,
|
||||
jlong pTexture
|
||||
) {
|
||||
BMTLSDOps *bmtlsdops = (BMTLSDOps *) pData;
|
||||
if (!MTLSurfaceData_initWithTexture(bmtlsdops, isOpaque, jlong_to_ptr(pTexture))) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
MTLSD_SetNativeDimensions(env, (BMTLSDOps *) pData, bmtlsdops->width, bmtlsdops->height);
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
[NSNull null], @"anchorPoint",
|
||||
[NSNull null], @"bounds",
|
||||
[NSNull null], @"contents",
|
||||
[NSNull null], @"cornerRadius",
|
||||
[NSNull null], @"contentsScale",
|
||||
[NSNull null], @"onOrderIn",
|
||||
[NSNull null], @"onOrderOut",
|
||||
|
||||
@@ -254,8 +254,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
* Note : if waiting cross-thread, possibly the stack allocated copy is accessible ?
|
||||
*/
|
||||
+ (void)invokeBlockCopy:(void (^)(void))blockCopy {
|
||||
blockCopy();
|
||||
Block_release(blockCopy);
|
||||
@try {
|
||||
blockCopy();
|
||||
} @finally {
|
||||
Block_release(blockCopy);
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSString*)getCaller:(NSString*)prefixSymbol {
|
||||
@@ -780,9 +783,18 @@ JNIEXPORT void lwc_plog(JNIEnv* env, const char *formatMsg, ...) {
|
||||
const NSUInteger count = [self.queue count];
|
||||
if (count != 0) {
|
||||
for (NSUInteger i = 0; i < count; i++) {
|
||||
void (^blockCopy)(void) = (void (^)())[self.queue objectAtIndex: i];
|
||||
// invoke callback:
|
||||
[ThreadUtilities invokeBlockCopy:blockCopy];
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
@try {
|
||||
void (^blockCopy)(void) = (void (^)())[self.queue objectAtIndex: i];
|
||||
// invoke callback:
|
||||
[ThreadUtilities invokeBlockCopy:blockCopy];
|
||||
} @catch (NSException *exception) {
|
||||
// handle any exception to avoid crashing the main run loop:
|
||||
NSLog(@"Apple AWT Cocoa Exception: %@", [exception description]);
|
||||
NSLog(@"Apple AWT Cocoa Exception callstack: %@", [exception callStackSymbols]);
|
||||
} @finally {
|
||||
[pool drain];
|
||||
}
|
||||
}
|
||||
// reset queue anyway:
|
||||
[self reset];
|
||||
|
||||
@@ -26,52 +26,19 @@
|
||||
package com.jetbrains.desktop;
|
||||
|
||||
import com.jetbrains.desktop.image.TextureWrapperImage;
|
||||
import com.jetbrains.exported.JBRApi;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
import java.awt.*;
|
||||
|
||||
@JBRApi.Service
|
||||
@JBRApi.Provides("SharedTextures")
|
||||
public class SharedTextures {
|
||||
public abstract class SharedTextures {
|
||||
public final static int UNDEFINED_TEXTURE_TYPE = 0;
|
||||
public final static int METAL_TEXTURE_TYPE = 1;
|
||||
|
||||
private final int textureType;
|
||||
public abstract int getTextureType();
|
||||
|
||||
public static SharedTextures create() {
|
||||
return new SharedTextures();
|
||||
public final Image wrapTexture(GraphicsConfiguration gc, long texture) {
|
||||
return new TextureWrapperImage((img) -> createSurfaceManager(gc, img, texture));
|
||||
}
|
||||
|
||||
private SharedTextures() {
|
||||
textureType = getTextureTypeImpl();
|
||||
if (textureType == 0) {
|
||||
throw new JBRApi.ServiceNotAvailableException();
|
||||
}
|
||||
}
|
||||
|
||||
public int getTextureType() {
|
||||
return textureType;
|
||||
}
|
||||
|
||||
public Image wrapTexture(GraphicsConfiguration gc, long texture) {
|
||||
return new TextureWrapperImage(gc, texture);
|
||||
}
|
||||
|
||||
private static int getTextureTypeImpl() {
|
||||
GraphicsConfiguration gc = GraphicsEnvironment
|
||||
.getLocalGraphicsEnvironment()
|
||||
.getDefaultScreenDevice()
|
||||
.getDefaultConfiguration();
|
||||
try {
|
||||
if (SunToolkit.isInstanceOf(gc, "sun.java2d.metal.MTLGraphicsConfig")) {
|
||||
return METAL_TEXTURE_TYPE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new InternalError("Unexpected exception during reflection", e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
protected abstract SurfaceManager createSurfaceManager(GraphicsConfiguration gc, Image image, long texture);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2025 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.jetbrains.desktop;
|
||||
|
||||
import com.jetbrains.exported.JBRApi;
|
||||
import sun.java2d.vulkan.VKEnv;
|
||||
import sun.java2d.vulkan.VKGPU;
|
||||
|
||||
@JBRApi.Service
|
||||
@JBRApi.Provides("Vulkan")
|
||||
public class Vulkan {
|
||||
|
||||
Vulkan() {
|
||||
if (!VKEnv.isVulkanEnabled()) throw new JBRApi.ServiceNotAvailableException("Vulkan is not enabled");
|
||||
}
|
||||
|
||||
boolean isPresentationEnabled() {
|
||||
return VKEnv.isPresentationEnabled();
|
||||
}
|
||||
|
||||
Device[] getDevices() {
|
||||
return VKEnv.getDevices().map(Device::new).toArray(Device[]::new);
|
||||
}
|
||||
|
||||
@JBRApi.Provides("Vulkan.Device")
|
||||
static class Device {
|
||||
private final VKGPU device;
|
||||
|
||||
Device(VKGPU device) {
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return device.getName();
|
||||
}
|
||||
|
||||
String getTypeString() {
|
||||
return device.getType().toString();
|
||||
}
|
||||
|
||||
int getCapabilities() {
|
||||
return device.getCaps();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import java.awt.ImageCapabilities;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.ImageProducer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* This class is a wrapper for a GPU texture-based image.
|
||||
@@ -51,31 +52,14 @@ import java.awt.image.ImageProducer;
|
||||
* the surface flushing.
|
||||
*/
|
||||
public class TextureWrapperImage extends Image {
|
||||
final GraphicsConfiguration gc;
|
||||
final SurfaceData sd;
|
||||
final static ImageCapabilities capabilities = new ImageCapabilities(true);
|
||||
|
||||
/**
|
||||
* Constructs a TextureWrapperImage instance with the specified graphics configuration
|
||||
* and a texture.
|
||||
*
|
||||
* @param gc the graphics configuration
|
||||
* @param texture the texture that will be wrapped by this instance.
|
||||
* Platform-specific details:
|
||||
* macOS (with the Metal rendering pipeline) - a pointer to an MTLTexture object is expected
|
||||
*
|
||||
* @throws UnsupportedOperationException if the current pipeline is not supported
|
||||
* @throws IllegalArgumentException if the texture cannot be wrapped
|
||||
*/
|
||||
public TextureWrapperImage(GraphicsConfiguration gc, long texture)
|
||||
public TextureWrapperImage(Function<Image, SurfaceManager> surfaceManagerFactory)
|
||||
throws UnsupportedOperationException, IllegalArgumentException {
|
||||
this.gc = gc;
|
||||
SurfaceManager surfaceManager;
|
||||
if (gc instanceof SurfaceManager.TextureWrapperFactory factory) {
|
||||
surfaceManager = factory.createTextureWrapperSurfaceManager(gc, this, texture);
|
||||
} else throw new UnsupportedOperationException();
|
||||
sd = surfaceManager.getPrimarySurfaceData();
|
||||
SurfaceManager.setManager(this, surfaceManager);
|
||||
SurfaceManager sm = surfaceManagerFactory.apply(this);
|
||||
sd = sm.getPrimarySurfaceData();
|
||||
SurfaceManager.setManager(this, sm);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.awt.image;
|
||||
package com.jetbrains.desktop.image;
|
||||
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.java2d.SurfaceData;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
@@ -34,7 +34,6 @@ import java.awt.event.WindowFocusListener;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.awt.event.WindowStateListener;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.im.InputContext;
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
@@ -44,6 +43,7 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OptionalDataException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.Native;
|
||||
@@ -53,12 +53,15 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EventListener;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -69,11 +72,14 @@ import javax.accessibility.AccessibleState;
|
||||
import javax.accessibility.AccessibleStateSet;
|
||||
|
||||
import com.jetbrains.exported.JBRApi;
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.DebugSettings;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.util.IdentityArrayList;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.java2d.marlin.stats.StatDouble;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
@@ -1153,45 +1159,51 @@ public class Window extends Container implements Accessible {
|
||||
}
|
||||
|
||||
void doDispose() {
|
||||
class DisposeAction implements Runnable {
|
||||
public void run() {
|
||||
disposing = true;
|
||||
try {
|
||||
// Check if this window is the fullscreen window for the
|
||||
// device. Exit the fullscreen mode prior to disposing
|
||||
// of the window if that's the case.
|
||||
GraphicsDevice gd = getGraphicsConfiguration().getDevice();
|
||||
if (gd.getFullScreenWindow() == Window.this) {
|
||||
gd.setFullScreenWindow(null);
|
||||
}
|
||||
final class DisposeAction implements Runnable {
|
||||
public void run() {
|
||||
final Window window = Window.this;
|
||||
|
||||
Object[] ownedWindowArray;
|
||||
synchronized(ownedWindowList) {
|
||||
ownedWindowArray = new Object[ownedWindowList.size()];
|
||||
ownedWindowList.copyInto(ownedWindowArray);
|
||||
}
|
||||
for (int i = 0; i < ownedWindowArray.length; i++) {
|
||||
Window child = (Window) (((WeakReference)
|
||||
(ownedWindowArray[i])).get());
|
||||
if (child != null) {
|
||||
child.disposeImpl();
|
||||
// dump stats if needed:
|
||||
AWTAccessor.getWindowAccessor().dumpStats(window, true, null);
|
||||
|
||||
disposing = true;
|
||||
try {
|
||||
// Check if this window is the fullscreen window for the
|
||||
// device. Exit the fullscreen mode prior to disposing
|
||||
// of the window if that's the case.
|
||||
GraphicsDevice gd = getGraphicsConfiguration().getDevice();
|
||||
if (gd.getFullScreenWindow() == window) {
|
||||
gd.setFullScreenWindow(null);
|
||||
}
|
||||
}
|
||||
hide();
|
||||
beforeFirstShow = true;
|
||||
removeNotify();
|
||||
synchronized (inputContextLock) {
|
||||
if (inputContext != null) {
|
||||
inputContext.dispose();
|
||||
inputContext = null;
|
||||
|
||||
Object[] ownedWindowArray;
|
||||
synchronized(ownedWindowList) {
|
||||
ownedWindowArray = new Object[ownedWindowList.size()];
|
||||
ownedWindowList.copyInto(ownedWindowArray);
|
||||
}
|
||||
for (int i = 0; i < ownedWindowArray.length; i++) {
|
||||
Window child = (Window) (((WeakReference)
|
||||
(ownedWindowArray[i])).get());
|
||||
if (child != null) {
|
||||
child.disposeImpl();
|
||||
}
|
||||
}
|
||||
hide();
|
||||
beforeFirstShow = true;
|
||||
removeNotify();
|
||||
synchronized (inputContextLock) {
|
||||
if (inputContext != null) {
|
||||
inputContext.dispose();
|
||||
inputContext = null;
|
||||
}
|
||||
}
|
||||
clearCurrentFocusCycleRootOnHide();
|
||||
} finally {
|
||||
disposing = false;
|
||||
}
|
||||
clearCurrentFocusCycleRootOnHide();
|
||||
} finally {
|
||||
disposing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean fireWindowClosedEvent = isDisplayable();
|
||||
DisposeAction action = new DisposeAction();
|
||||
if (EventQueue.isDispatchThread()) {
|
||||
@@ -4164,8 +4176,36 @@ public class Window extends Container implements Accessible {
|
||||
return value;
|
||||
}
|
||||
|
||||
private final static String STATS_ALL_SUFFIX = ".all";
|
||||
private final static String SYSTEM_PROPERTY_COUNTERS;
|
||||
|
||||
private final static boolean USE_COUNTERS;
|
||||
private final static boolean TRACE_ALL_COUNTERS;
|
||||
private final static boolean TRACE_STD_ERR;
|
||||
|
||||
private final static int TRACE_CAPACITY;
|
||||
|
||||
private final static boolean TRACE_COUNTERS = true;
|
||||
private final static boolean DUMP_STATS = true;
|
||||
|
||||
// thread dump interval (ms)
|
||||
static final long DUMP_INTERVAL = 10 * 1000L;
|
||||
|
||||
private static PrintStream getTraceStdStream() {
|
||||
// get live std stream:
|
||||
return TRACE_STD_ERR ? System.err : System.out;
|
||||
}
|
||||
|
||||
static {
|
||||
String counters = System.getProperty("awt.window.counters");
|
||||
SYSTEM_PROPERTY_COUNTERS = System.getProperty("awt.window.counters");
|
||||
USE_COUNTERS = (SYSTEM_PROPERTY_COUNTERS != null);
|
||||
|
||||
TRACE_ALL_COUNTERS = USE_COUNTERS && (Objects.equals(SYSTEM_PROPERTY_COUNTERS, "")
|
||||
|| Objects.equals(SYSTEM_PROPERTY_COUNTERS, "stderr")
|
||||
|| Objects.equals(SYSTEM_PROPERTY_COUNTERS, "stdout"));
|
||||
|
||||
TRACE_STD_ERR = USE_COUNTERS && SYSTEM_PROPERTY_COUNTERS.contains("stderr");
|
||||
TRACE_CAPACITY = USE_COUNTERS ? 8 : 0;
|
||||
|
||||
AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
|
||||
public void updateWindow(Window window) {
|
||||
@@ -4202,100 +4242,201 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
public boolean countersEnabled(Window w) {
|
||||
// May want to selectively enable or disable counters per window
|
||||
return counters != null;
|
||||
return USE_COUNTERS;
|
||||
}
|
||||
|
||||
public void bumpCounter(Window w, String counterName) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
private final static long NANO_IN_SEC = java.util.concurrent.TimeUnit.SECONDS.toNanos(1);
|
||||
|
||||
PerfCounter newCounter;
|
||||
long curTimeNanos = System.nanoTime();
|
||||
synchronized (w.perfCounters) {
|
||||
newCounter = w.perfCounters.compute(counterName, (k, v) ->
|
||||
v == null
|
||||
? new PerfCounter(curTimeNanos, 1L)
|
||||
: new PerfCounter(curTimeNanos, v.value + 1));
|
||||
}
|
||||
PerfCounter prevCounter;
|
||||
synchronized (w.perfCountersPrev) {
|
||||
prevCounter = w.perfCountersPrev.putIfAbsent(counterName, newCounter);
|
||||
}
|
||||
if (prevCounter != null) {
|
||||
long nanosInSecond = java.util.concurrent.TimeUnit.SECONDS.toNanos(1);
|
||||
long timeDeltaNanos = curTimeNanos - prevCounter.updateTimeNanos;
|
||||
if (timeDeltaNanos > nanosInSecond) {
|
||||
long valPerSecond = (long) ((double) (newCounter.value - prevCounter.value)
|
||||
* nanosInSecond / timeDeltaNanos);
|
||||
boolean traceAllCounters = Objects.equals(counters, "")
|
||||
|| Objects.equals(counters, "stdout")
|
||||
|| Objects.equals(counters, "stderr");
|
||||
boolean traceEnabled = traceAllCounters || (counters != null && counters.contains(counterName));
|
||||
if (traceEnabled) {
|
||||
if (counters.contains("stderr")) {
|
||||
System.err.println(counterName + " per second: " + valPerSecond);
|
||||
} else {
|
||||
System.out.println(counterName + " per second: " + valPerSecond);
|
||||
}
|
||||
}
|
||||
if (perfLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
perfLog.fine(counterName + " per second: " + valPerSecond);
|
||||
public void incrementCounter(final Window w, final String counterName) {
|
||||
if (USE_COUNTERS) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
|
||||
final long curTimeNanos = System.nanoTime();
|
||||
// use try-catch to avoid throwing runtime exception to native JNI callers!
|
||||
try {
|
||||
PerfCounter newCounter, prevCounter;
|
||||
synchronized (w.perfCounters) {
|
||||
newCounter = w.perfCounters.compute(counterName, (_, v) ->
|
||||
v == null
|
||||
? new PerfCounter(curTimeNanos, 1L)
|
||||
: new PerfCounter(curTimeNanos, v.value + 1));
|
||||
}
|
||||
synchronized (w.perfCountersPrev) {
|
||||
w.perfCountersPrev.put(counterName, newCounter);
|
||||
prevCounter = w.perfCountersPrev.putIfAbsent(counterName, newCounter);
|
||||
}
|
||||
if (prevCounter != null) {
|
||||
final long timeDeltaNanos = curTimeNanos - prevCounter.updateTimeNanos;
|
||||
if (timeDeltaNanos > NANO_IN_SEC) {
|
||||
final double valPerSecond = (double) (newCounter.value - prevCounter.value)
|
||||
* NANO_IN_SEC / timeDeltaNanos;
|
||||
|
||||
synchronized (w.perfCountersPrev) {
|
||||
w.perfCountersPrev.put(counterName, newCounter);
|
||||
}
|
||||
addStat(w, counterName, valPerSecond);
|
||||
if (TRACE_COUNTERS) {
|
||||
dumpCounter(counterName, valPerSecond);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
perfLog.severe("incrementCounter: failed", re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addStat(final Window w, final String statName, final double value) {
|
||||
if (USE_COUNTERS && Double.isFinite(value)) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(statName);
|
||||
|
||||
// use try-catch to avoid throwing runtime exception to native JNI callers!
|
||||
try {
|
||||
synchronized (w.perfStats) {
|
||||
StatDouble stat = w.perfStats.computeIfAbsent(statName, StatDouble::new);
|
||||
stat.add(value);
|
||||
stat = w.perfStats.computeIfAbsent(statName + STATS_ALL_SUFFIX, StatDouble::new);
|
||||
stat.add(value);
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
perfLog.severe("addStat: failed", re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getCounter(final Window w, final String counterName) {
|
||||
if (USE_COUNTERS) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
|
||||
synchronized (w.perfCounters) {
|
||||
PerfCounter counter = w.perfCounters.get(counterName);
|
||||
return counter != null ? counter.value : -1L;
|
||||
}
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
public double getCounterPerSecond(final Window w, final String counterName) {
|
||||
if (USE_COUNTERS) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
|
||||
PerfCounter newCounter, prevCounter;
|
||||
synchronized (w.perfCounters) {
|
||||
newCounter = w.perfCounters.get(counterName);
|
||||
}
|
||||
synchronized (w.perfCountersPrev) {
|
||||
prevCounter = w.perfCountersPrev.get(counterName);
|
||||
}
|
||||
|
||||
if (newCounter != null && prevCounter != null) {
|
||||
final long timeDeltaNanos = newCounter.updateTimeNanos - prevCounter.updateTimeNanos;
|
||||
// Note that this time delta will usually be above one second.
|
||||
if (timeDeltaNanos > 0L) {
|
||||
return (double) (newCounter.value - prevCounter.value) * NANO_IN_SEC / timeDeltaNanos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Double.NaN;
|
||||
}
|
||||
|
||||
public void dumpStats(final Window w, final boolean reset, StringBuilder sb) {
|
||||
if (USE_COUNTERS) {
|
||||
synchronized (w.perfStats) {
|
||||
boolean header = false;
|
||||
|
||||
for (final StatDouble stat : w.perfStats.values()) {
|
||||
if (stat.shouldLog()) {
|
||||
final boolean traceEnabled = TRACE_ALL_COUNTERS || SYSTEM_PROPERTY_COUNTERS.contains(stat.name);
|
||||
if (!header) {
|
||||
header = true;
|
||||
doLog(String.format("* Window['%s'@%s]:",
|
||||
(w instanceof Frame ? ((Frame) w).getTitle() : ""),
|
||||
Integer.toHexString(System.identityHashCode(w))),
|
||||
traceEnabled);
|
||||
}
|
||||
// format:
|
||||
if (sb == null) {
|
||||
sb = new StringBuilder(128);
|
||||
}
|
||||
sb.setLength(0);
|
||||
sb.append(" - ");
|
||||
stat.toString(sb);
|
||||
doLog(sb.toString(), traceEnabled);
|
||||
|
||||
if (reset && !stat.name.endsWith(STATS_ALL_SUFFIX)) {
|
||||
stat.reset();
|
||||
} else {
|
||||
stat.updateLastLogCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getCounter(Window w, String counterName) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
|
||||
synchronized (w.perfCounters) {
|
||||
PerfCounter counter = w.perfCounters.get(counterName);
|
||||
return counter != null ? counter.value : -1L;
|
||||
private static void dumpCounter(final String counterName, final double valPerSecond) {
|
||||
if (USE_COUNTERS) {
|
||||
doLog(String.format("%s per second: %.2f", counterName, valPerSecond),
|
||||
TRACE_ALL_COUNTERS || SYSTEM_PROPERTY_COUNTERS.contains(counterName));
|
||||
}
|
||||
}
|
||||
|
||||
public long getCounterPerSecond(Window w, String counterName) {
|
||||
Objects.requireNonNull(w);
|
||||
Objects.requireNonNull(counterName);
|
||||
|
||||
PerfCounter newCounter;
|
||||
PerfCounter prevCounter;
|
||||
|
||||
synchronized (w.perfCounters) {
|
||||
newCounter = w.perfCounters.get(counterName);
|
||||
private static void doLog(final String msg, final boolean traceEnabled) {
|
||||
if (traceEnabled) {
|
||||
getTraceStdStream().println(msg);
|
||||
}
|
||||
|
||||
synchronized (w.perfCountersPrev) {
|
||||
prevCounter = w.perfCountersPrev.get(counterName);
|
||||
if (perfLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
perfLog.fine(msg);
|
||||
}
|
||||
|
||||
if (newCounter != null && prevCounter != null) {
|
||||
long timeDeltaNanos = newCounter.updateTimeNanos - prevCounter.updateTimeNanos;
|
||||
// Note that this time delta will usually be above one second.
|
||||
if (timeDeltaNanos > 0) {
|
||||
long nanosInSecond = java.util.concurrent.TimeUnit.SECONDS.toNanos(1);
|
||||
long valPerSecond = (long) ((double) (newCounter.value - prevCounter.value)
|
||||
* nanosInSecond / timeDeltaNanos);
|
||||
return valPerSecond;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}); // WindowAccessor
|
||||
|
||||
if (USE_COUNTERS) {
|
||||
final Runnable dumper = new Runnable() {
|
||||
private final static StringBuilder sb = new StringBuilder(128);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
getTraceStdStream().printf("--- WindowStats dump at: %s ---\n", new java.util.Date());
|
||||
|
||||
final AWTAccessor.WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
|
||||
|
||||
for (Window window : Window.getWindows()) {
|
||||
// dump stats if needed:
|
||||
windowAccessor.dumpStats(window, true, sb);
|
||||
}
|
||||
getTraceStdStream().println("-----");
|
||||
}
|
||||
};
|
||||
final Thread hook = InnocuousThread.newSystemThread("WindowStatsHook", dumper);
|
||||
hook.setDaemon(true);
|
||||
hook.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
|
||||
if (DUMP_STATS) {
|
||||
final Timer statTimer = new Timer("WindowStats", true);
|
||||
statTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
dumper.run();
|
||||
}
|
||||
}, DUMP_INTERVAL, DUMP_INTERVAL);
|
||||
}
|
||||
}
|
||||
} // static
|
||||
|
||||
// a window doesn't need to be updated in the Z-order.
|
||||
@Override
|
||||
void updateZOrder() {}
|
||||
|
||||
private record PerfCounter(Long updateTimeNanos, Long value) {}
|
||||
private record PerfCounter(long updateTimeNanos, long value) {}
|
||||
|
||||
private transient final Map<String, PerfCounter> perfCounters = new HashMap<>(4);
|
||||
private transient final Map<String, PerfCounter> perfCountersPrev = new HashMap<>(4);
|
||||
private transient final HashMap<String, PerfCounter> perfCounters = (USE_COUNTERS) ? new HashMap<>(TRACE_CAPACITY) : null;
|
||||
private transient final HashMap<String, PerfCounter> perfCountersPrev = (USE_COUNTERS) ? new HashMap<>(TRACE_CAPACITY) : null;
|
||||
private transient final LinkedHashMap<String, StatDouble> perfStats = (USE_COUNTERS) ? new LinkedHashMap<>(TRACE_CAPACITY) : null;
|
||||
|
||||
} // class Window
|
||||
|
||||
|
||||
@@ -27,10 +27,7 @@ package javax.swing;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.awt.peer.WindowPeer;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.applet.*;
|
||||
@@ -43,14 +40,12 @@ import sun.java2d.SunGraphicsEnvironment;
|
||||
|
||||
import com.sun.java.swing.SwingUtilities3;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import sun.java2d.SunGraphics2D;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.swing.SwingAccessor;
|
||||
import sun.swing.SwingUtilities2;
|
||||
import sun.swing.SwingUtilities2.RepaintListener;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* This class manages repaint requests, allowing the number
|
||||
@@ -755,7 +750,7 @@ public class RepaintManager
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.forEach(w -> AWTAccessor.getWindowAccessor()
|
||||
.bumpCounter(w, "swing.RepaintManager.updateWindows"));
|
||||
.incrementCounter(w, "swing.RepaintManager.updateWindows"));
|
||||
|
||||
if (Toolkit.getDefaultToolkit() instanceof SunToolkit sunToolkit &&
|
||||
sunToolkit.needUpdateWindow()) {
|
||||
@@ -774,14 +769,14 @@ public class RepaintManager
|
||||
|
||||
for (Window window : windows) {
|
||||
AWTAccessor.getWindowAccessor().updateWindow(window);
|
||||
AWTAccessor.getWindowAccessor().bumpCounter(window, "swing.RepaintManager.updateWindows");
|
||||
AWTAccessor.getWindowAccessor().incrementCounter(window, "swing.RepaintManager.updateWindows");
|
||||
}
|
||||
} else {
|
||||
dirtyComponents.keySet().stream()
|
||||
.map(c -> c instanceof Window w ? w : SwingUtilities.getWindowAncestor(c))
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(w -> AWTAccessor.getWindowAccessor()
|
||||
.bumpCounter(w, "swing.RepaintManager.updateWindows"));
|
||||
.incrementCounter(w, "swing.RepaintManager.updateWindows"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -748,6 +748,27 @@ public class BasicTreeUI extends TreeUI
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* A potentially faster version of {@link #getPathBounds(JTree, TreePath)}
|
||||
* which calculates only {@code y} and {@code height}
|
||||
* of the bounding {@code Rectangle}
|
||||
*/
|
||||
private Rectangle getVerticalPathBounds(TreePath path) {
|
||||
if (tree == null || treeState == null) {
|
||||
return null;
|
||||
}
|
||||
int rowHeight = treeState.getRowHeight();
|
||||
if (rowHeight <= 0) {
|
||||
return getPathBounds(tree, path);
|
||||
}
|
||||
int row = treeState.getRowForPath(path);
|
||||
if (row < 0) {
|
||||
return null;
|
||||
}
|
||||
return new Rectangle(0, tree.getInsets().top + row * rowHeight,
|
||||
0, rowHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path for passed in row. If row is not visible
|
||||
* null is returned.
|
||||
@@ -4381,17 +4402,21 @@ public class BasicTreeUI extends TreeUI
|
||||
updateSize();
|
||||
}
|
||||
else if (treeState.isExpanded(parentPath)) {
|
||||
// Changed nodes are visible
|
||||
// Find the minimum index, we only need paint from there
|
||||
// down.
|
||||
int minIndex = indices[0];
|
||||
for (int i = indices.length - 1; i > 0; i--) {
|
||||
minIndex = Math.min(indices[i], minIndex);
|
||||
TreePath minPath = null;
|
||||
Rectangle minBounds = null;
|
||||
if (tree.isShowing()) {
|
||||
// Changed nodes are visible
|
||||
// Find the minimum index, we only need paint from there
|
||||
// down.
|
||||
int minIndex = indices[0];
|
||||
for (int i = indices.length - 1; i > 0; i--) {
|
||||
minIndex = Math.min(indices[i], minIndex);
|
||||
}
|
||||
Object minChild = treeModel.getChild(
|
||||
parentPath.getLastPathComponent(), minIndex);
|
||||
minPath = parentPath.pathByAddingChild(minChild);
|
||||
minBounds = getVerticalPathBounds(minPath);
|
||||
}
|
||||
Object minChild = treeModel.getChild(
|
||||
parentPath.getLastPathComponent(), minIndex);
|
||||
TreePath minPath = parentPath.pathByAddingChild(minChild);
|
||||
Rectangle minBounds = getPathBounds(tree, minPath);
|
||||
|
||||
// Forward to the treestate
|
||||
treeState.treeNodesChanged(e);
|
||||
@@ -4399,20 +4424,19 @@ public class BasicTreeUI extends TreeUI
|
||||
// Mark preferred size as bogus.
|
||||
updateSize0();
|
||||
|
||||
// And repaint
|
||||
Rectangle newMinBounds = getPathBounds(tree, minPath);
|
||||
if (minBounds == null || newMinBounds == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (indices.length == 1 &&
|
||||
newMinBounds.height == minBounds.height) {
|
||||
tree.repaint(0, minBounds.y, tree.getWidth(),
|
||||
minBounds.height);
|
||||
}
|
||||
else {
|
||||
tree.repaint(0, minBounds.y, tree.getWidth(),
|
||||
tree.getHeight() - minBounds.y);
|
||||
if (minBounds != null) {
|
||||
// And repaint
|
||||
Rectangle newMinBounds = getVerticalPathBounds(minPath);
|
||||
if (newMinBounds != null) {
|
||||
if (indices.length == 1 &&
|
||||
newMinBounds.height == minBounds.height) {
|
||||
tree.repaint(0, minBounds.y, tree.getWidth(),
|
||||
minBounds.height);
|
||||
} else {
|
||||
tree.repaint(0, minBounds.y, tree.getWidth(),
|
||||
tree.getHeight() - minBounds.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -37,7 +37,6 @@ import java.awt.event.InputEvent;
|
||||
import java.awt.event.InvocationEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
|
||||
@@ -329,10 +328,15 @@ public final class AWTAccessor {
|
||||
*/
|
||||
Window[] getOwnedWindows(Window w);
|
||||
|
||||
/* JBR Window counters API */
|
||||
boolean countersEnabled(Window w);
|
||||
void bumpCounter(Window w, String counterName);
|
||||
void incrementCounter(Window w, String counterName);
|
||||
void addStat(Window w, String statName, double value);
|
||||
|
||||
long getCounter(Window w, String counterName);
|
||||
long getCounterPerSecond(Window w, String counterName);
|
||||
double getCounterPerSecond(Window w, String counterName);
|
||||
|
||||
void dumpStats(Window w, boolean reset, StringBuilder sb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,7 @@ import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Label;
|
||||
import java.awt.MenuComponent;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Point;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.ScrollPane;
|
||||
import java.awt.Scrollbar;
|
||||
@@ -90,6 +91,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import com.jetbrains.exported.JBRApi;
|
||||
import sun.awt.im.InputContext;
|
||||
import sun.awt.image.ByteArrayImageSource;
|
||||
import sun.awt.image.FileImageSource;
|
||||
@@ -2084,6 +2086,23 @@ public abstract class SunToolkit extends Toolkit
|
||||
return AWTAccessor.getAWTEventAccessor().isSystemGenerated(e);
|
||||
}
|
||||
|
||||
@JBRApi.Service
|
||||
@JBRApi.Provides("RelativePointerMovement")
|
||||
public interface RelativePointerMovementInfoProvider {
|
||||
private static RelativePointerMovementInfoProvider create() {
|
||||
var tk = Toolkit.getDefaultToolkit();
|
||||
if (tk instanceof ComponentFactory cf) {
|
||||
var mouseInfoPeer = cf.getMouseInfoPeer();
|
||||
if (mouseInfoPeer instanceof RelativePointerMovementInfoProvider p){
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
throw new JBRApi.ServiceNotAvailableException("Service not supported for toolkit " + tk.getClass().getName());
|
||||
}
|
||||
|
||||
Point getAccumulatedMouseDeltaAndReset();
|
||||
}
|
||||
} // class SunToolkit
|
||||
|
||||
|
||||
|
||||
@@ -184,14 +184,6 @@ public abstract class SurfaceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See TextureWrapperImage.
|
||||
*/
|
||||
public interface TextureWrapperFactory {
|
||||
SurfaceManager createTextureWrapperSurfaceManager(
|
||||
GraphicsConfiguration gc, Image image, long texture);
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface for GraphicsConfiguration objects to implement if
|
||||
* they create their own VolatileSurfaceManager implementations.
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.Locale;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.DisplayParametersChangedListener;
|
||||
import sun.awt.SunDisplayChanger;
|
||||
import sun.font.FontManager;
|
||||
import sun.font.FontManagerFactory;
|
||||
@@ -60,7 +59,7 @@ import sun.java2d.pipe.Region;
|
||||
* @see GraphicsConfiguration
|
||||
*/
|
||||
public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
|
||||
implements DisplayChangedListener, DisplayParametersChangedListener {
|
||||
implements DisplayChangedListener {
|
||||
|
||||
/** Establish the default font to be used by SG2D. */
|
||||
private final Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
|
||||
@@ -276,15 +275,6 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
|
||||
displayChanger.notifyListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayParametersChanged() {
|
||||
for (GraphicsDevice gd : getScreenDevices()) {
|
||||
if (gd instanceof DisplayParametersChangedListener) {
|
||||
((DisplayParametersChangedListener) gd).displayParametersChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Part of the DisplayChangedListener interface:
|
||||
* propagate this event to listeners
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, 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
|
||||
@@ -144,7 +144,9 @@ final class Curve {
|
||||
// finds points where the first and second derivative are
|
||||
// perpendicular. This happens when g(t) = f'(t)*f''(t) == 0 (where
|
||||
// * is a dot product). Unfortunately, we have to solve a cubic.
|
||||
private int perpendiculardfddf(final double[] pts, final int off) {
|
||||
private int perpendiculardfddf(final double[] pts, final int off,
|
||||
final double A, final double B)
|
||||
{
|
||||
assert pts.length >= off + 4;
|
||||
|
||||
// these are the coefficients of some multiple of g(t) (not g(t),
|
||||
@@ -155,7 +157,7 @@ final class Curve {
|
||||
final double c = 2.0d * (dax * cx + day * cy) + dbx * dbx + dby * dby;
|
||||
final double d = dbx * cx + dby * cy;
|
||||
|
||||
return Helpers.cubicRootsInAB(a, b, c, d, pts, off, 0.0d, 1.0d);
|
||||
return Helpers.cubicRootsInAB(a, b, c, d, pts, off, A, B);
|
||||
}
|
||||
|
||||
// Tries to find the roots of the function ROC(t)-w in [0, 1). It uses
|
||||
@@ -171,35 +173,43 @@ final class Curve {
|
||||
// at most 4 sub-intervals of (0,1). ROC has asymptotes at inflection
|
||||
// points, so roc-w can have at least 6 roots. This shouldn't be a
|
||||
// problem for what we're trying to do (draw a nice looking curve).
|
||||
int rootsOfROCMinusW(final double[] roots, final int off, final double w2, final double err) {
|
||||
int rootsOfROCMinusW(final double[] roots, final int off, final double w2,
|
||||
final double A, final double B)
|
||||
{
|
||||
// no OOB exception, because by now off<=6, and roots.length >= 10
|
||||
assert off <= 6 && roots.length >= 10;
|
||||
|
||||
int ret = off;
|
||||
final int end = off + perpendiculardfddf(roots, off);
|
||||
final int end = off + perpendiculardfddf(roots, off, A, B);
|
||||
Helpers.isort(roots, off, end);
|
||||
roots[end] = 1.0d; // always check interval end points
|
||||
|
||||
double t0 = 0.0d, ft0 = ROCsq(t0) - w2;
|
||||
double t0 = 0.0d;
|
||||
double ft0 = eliminateInf(ROCsq(t0) - w2);
|
||||
double t1, ft1;
|
||||
|
||||
for (int i = off; i <= end; i++) {
|
||||
double t1 = roots[i], ft1 = ROCsq(t1) - w2;
|
||||
t1 = roots[i];
|
||||
ft1 = eliminateInf(ROCsq(t1) - w2);
|
||||
if (ft0 == 0.0d) {
|
||||
roots[ret++] = t0;
|
||||
} else if (ft1 * ft0 < 0.0d) { // have opposite signs
|
||||
// (ROC(t)^2 == w^2) == (ROC(t) == w) is true because
|
||||
// ROC(t) >= 0 for all t.
|
||||
roots[ret++] = falsePositionROCsqMinusX(t0, t1, w2, err);
|
||||
roots[ret++] = falsePositionROCsqMinusX(t0, t1, ft0, ft1, w2, A); // A = err
|
||||
}
|
||||
t0 = t1;
|
||||
ft0 = ft1;
|
||||
}
|
||||
|
||||
return ret - off;
|
||||
}
|
||||
|
||||
private static double eliminateInf(final double x) {
|
||||
return (x == Double.POSITIVE_INFINITY ? Double.MAX_VALUE :
|
||||
(x == Double.NEGATIVE_INFINITY ? Double.MIN_VALUE : x));
|
||||
private final static double MAX_ROC_SQ = 1e20;
|
||||
|
||||
private static double eliminateInf(final double x2) {
|
||||
// limit the value of x to avoid numerical problems (smaller step):
|
||||
// must handle NaN and +Infinity:
|
||||
return (x2 <= MAX_ROC_SQ) ? x2 : MAX_ROC_SQ;
|
||||
}
|
||||
|
||||
// A slight modification of the false position algorithm on wikipedia.
|
||||
@@ -210,17 +220,18 @@ final class Curve {
|
||||
// and turn out. Same goes for the newton's method
|
||||
// algorithm in Helpers.java
|
||||
private double falsePositionROCsqMinusX(final double t0, final double t1,
|
||||
final double ft0, final double ft1,
|
||||
final double w2, final double err)
|
||||
{
|
||||
final int iterLimit = 100;
|
||||
int side = 0;
|
||||
double t = t1, ft = eliminateInf(ROCsq(t) - w2);
|
||||
double s = t0, fs = eliminateInf(ROCsq(s) - w2);
|
||||
double s = t0, fs = eliminateInf(ft0);
|
||||
double t = t1, ft = eliminateInf(ft1);
|
||||
double r = s, fr;
|
||||
|
||||
for (int i = 0; i < iterLimit && Math.abs(t - s) > err * Math.abs(t + s); i++) {
|
||||
for (int i = 0; i < iterLimit && Math.abs(t - s) > err; i++) {
|
||||
r = (fs * t - ft * s) / (fs - ft);
|
||||
fr = ROCsq(r) - w2;
|
||||
fr = eliminateInf(ROCsq(r) - w2);
|
||||
if (sameSign(fr, ft)) {
|
||||
ft = fr; t = r;
|
||||
if (side < 0) {
|
||||
@@ -241,7 +252,7 @@ final class Curve {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return (Math.abs(ft) <= Math.abs(fs)) ? t : s;
|
||||
}
|
||||
|
||||
private static boolean sameSign(final double x, final double y) {
|
||||
@@ -256,9 +267,9 @@ final class Curve {
|
||||
final double dy = t * (t * day + dby) + cy;
|
||||
final double ddx = 2.0d * dax * t + dbx;
|
||||
final double ddy = 2.0d * day * t + dby;
|
||||
final double dx2dy2 = dx * dx + dy * dy;
|
||||
final double ddx2ddy2 = ddx * ddx + ddy * ddy;
|
||||
final double ddxdxddydy = ddx * dx + ddy * dy;
|
||||
return dx2dy2 * ((dx2dy2 * dx2dy2) / (dx2dy2 * ddx2ddy2 - ddxdxddydy * ddxdxddydy));
|
||||
final double dx2dy2 = dx * dx + dy * dy; // positive
|
||||
final double dxddyddxdy = dx * ddy - dy * ddx;
|
||||
// may return +Infinity if dxddyddxdy = 0 or NaN if 0/0:
|
||||
return (dx2dy2 * dx2dy2 * dx2dy2) / (dxddyddxdy * dxddyddxdy); // both positive
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, 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
|
||||
@@ -564,7 +564,7 @@ public final class DMarlinRenderingEngine extends RenderingEngine
|
||||
}
|
||||
|
||||
private static boolean nearZero(final double num) {
|
||||
return Math.abs(num) < 2.0d * Math.ulp(num);
|
||||
return Math.abs(num) < 2.0d * Helpers.ulp(num);
|
||||
}
|
||||
|
||||
abstract static class NormalizingPathIterator implements PathIterator {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, 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
|
||||
@@ -31,12 +31,19 @@ import sun.java2d.marlin.stats.StatLong;
|
||||
|
||||
final class Helpers implements MarlinConst {
|
||||
|
||||
private final static double T_ERR = 1e-4;
|
||||
private final static double T_A = T_ERR;
|
||||
private final static double T_B = 1.0 - T_ERR;
|
||||
|
||||
private static final double EPS = 1e-9d;
|
||||
|
||||
private Helpers() {
|
||||
throw new Error("This is a non instantiable class");
|
||||
}
|
||||
|
||||
/** use lower precision like former Pisces and Marlin (float-precision) */
|
||||
static double ulp(final double value) { return Math.ulp((float)value); }
|
||||
|
||||
static boolean within(final double x, final double y) {
|
||||
return within(x, y, EPS);
|
||||
}
|
||||
@@ -322,10 +329,10 @@ final class Helpers implements MarlinConst {
|
||||
|
||||
// now we must subdivide at points where one of the offset curves will have
|
||||
// a cusp. This happens at ts where the radius of curvature is equal to w.
|
||||
ret += c.rootsOfROCMinusW(ts, ret, w2, 0.0001d);
|
||||
ret += c.rootsOfROCMinusW(ts, ret, w2, T_A, T_B);
|
||||
|
||||
ret = filterOutNotInAB(ts, 0, ret, 0.0001d, 0.9999d);
|
||||
isort(ts, ret);
|
||||
ret = filterOutNotInAB(ts, 0, ret, T_A, T_B);
|
||||
isort(ts, 0, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -354,7 +361,7 @@ final class Helpers implements MarlinConst {
|
||||
if ((outCodeOR & OUTCODE_BOTTOM) != 0) {
|
||||
ret += curve.yPoints(ts, ret, clipRect[1]);
|
||||
}
|
||||
isort(ts, ret);
|
||||
isort(ts, 0, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -374,11 +381,11 @@ final class Helpers implements MarlinConst {
|
||||
}
|
||||
}
|
||||
|
||||
static void isort(final double[] a, final int len) {
|
||||
for (int i = 1, j; i < len; i++) {
|
||||
static void isort(final double[] a, final int off, final int len) {
|
||||
for (int i = off + 1, j; i < len; i++) {
|
||||
final double ai = a[i];
|
||||
j = i - 1;
|
||||
for (; j >= 0 && a[j] > ai; j--) {
|
||||
for (; j >= off && a[j] > ai; j--) {
|
||||
a[j + 1] = a[j];
|
||||
}
|
||||
a[j + 1] = ai;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, 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
|
||||
@@ -28,6 +28,8 @@ package sun.java2d.marlin;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
import jdk.internal.ref.CleanerFactory;
|
||||
import sun.java2d.marlin.ArrayCacheConst.CacheStats;
|
||||
import static sun.java2d.marlin.MarlinUtils.logInfo;
|
||||
@@ -383,21 +385,13 @@ public final class RendererStats implements MarlinConst {
|
||||
= new ConcurrentLinkedQueue<>();
|
||||
|
||||
private RendererStatsHolder() {
|
||||
final Thread hook = new Thread(
|
||||
MarlinUtils.getRootThreadGroup(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dump();
|
||||
}
|
||||
},
|
||||
"MarlinStatsHook"
|
||||
);
|
||||
final Thread hook = InnocuousThread.newSystemThread("MarlinStatsHook", () -> dump());
|
||||
hook.setDaemon(true);
|
||||
hook.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
|
||||
if (USE_DUMP_THREAD) {
|
||||
final Timer statTimer = new Timer("RendererStats");
|
||||
final Timer statTimer = new Timer("RendererStats", true);
|
||||
statTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user