Compare commits

...

24 Commits
956 ... 989

Author SHA1 Message Date
Vitaly Provodin
4f17e1b965 dcevm: G1 Heap parallel iterate method "object_par_iterate" + dcevm timers 2020-07-10 12:19:35 +07:00
Vitaly Provodin
ab97d74692 updated JTreg exclude list 2020-07-09 18:10:36 +07:00
Anton Tarasov
e30a309f92 JBR-2557 use com.jetbrains.cef.JCefAppConfig in JCEF tests 2020-07-07 12:06:12 +03:00
Denis Konoplev
703d77a927 JBR-2554: Proper unicode values in KeyEvent.keyCode 2020-07-03 15:58:33 +03:00
Dmitry Batrak
2f1d317d87 JBR-2533 Popup is not focused on click when switching from another application on macOS
more reliable jtreg test
2020-07-03 10:55:31 +03:00
Vitaly Provodin
f7b4c42e1d JBR-2545 Clean up the list of ignored Render tests 2020-07-03 07:36:07 +07:00
Dmitry Batrak
21af1eba85 JBR-2533 Popup is not focused on click when switching from another application on macOS
makes sure jtreg test cleans up properly
2020-07-02 16:15:39 +03:00
Dmitry Batrak
72b0add80c JBR-2533 Popup is not focused on click when switching from another application on macOS
fix NPE
2020-07-02 15:43:52 +03:00
Dmitry Batrak
67b174dc8c JBR-2533 Popup is not focused on click when switching from another application on macOS
fix main menu activation logic
2020-07-01 19:33:41 +03:00
Anton Tarasov
a41a59a57b [followup] 8238676: jni crashes on accessing it from process exit hook 2020-06-30 20:29:13 +03:00
Anton Tarasov
9c8cffee50 8238676: jni crashes on accessing it from process exit hook 2020-06-30 18:54:09 +03:00
Dmitry Batrak
d9ff151211 JBR-2533 Popup is not focused on click when switching from another application on macOS 2020-06-30 12:37:22 +03:00
Anton Tarasov
0917d89523 JBR-2377 Native crash IU-202.3855 macOS 2020-06-29 17:41:17 +03:00
Konstantin Bulenkov
71e2a8d8ad Update FiraCode to 5.2 2020-06-28 22:20:58 +02:00
Denis Fokin
7d5ac56b6c IDEA-215477 Cursor disappears when PhpStorm loses focus (probably related to Synergy)
Revert of JDK-7150349. The fix was intended to fight popup/applet activation issues.
2020-06-26 18:12:45 +03:00
Dmitry Batrak
2ca834c18e Revert fix for JBR-2533
it causes failure of 6406264 regression test and wrong behaviour in IDEA ('Open Class' popup isn't closed on Esc)
2020-06-26 17:49:56 +03:00
Anton Tarasov
78bd1bbeae JBR-2489 Git branch operations (switch to another branch, rebase) sometimes crash WebStorm 202.5428.27 2020-06-26 15:54:48 +03:00
Denis Fokin
82e6ed7c0b IDEA-215477 Cursor disappears when PhpStorm loses focus (probably related to Synergy)
A flag to workaround Synergy issue. It is only part of the fix. The second part of the fix conflicts with a fix for "JBR-2533 Popup is not focused on click when switching from another application on macOS".
2020-06-26 15:54:11 +03:00
Vitaly Provodin
4c6aa2945a JBR-2531 return release debug level for dcevm bilds 2020-06-26 08:24:42 +07:00
Dmitry Batrak
dc85bb1eab JBR-2533 Popup is not focused on click when switching from another application on macOS
added jtreg test case
2020-06-25 19:16:52 +03:00
Dmitry Batrak
89c80c157c JBR-2533 Popup is not focused on click when switching from another application on macOS 2020-06-25 13:47:02 +03:00
Vitaly Provodin
b8e86892f2 dcevm: add support for G1 gc 2020-06-25 11:02:15 +07:00
Vitaly Provodin
5d97e2253c JBR-2531 add fastdebug level for dcevm bilds 2020-06-24 06:16:18 +07:00
Elena Sayapina
9c3912fe1f JBR-2475 Latency when accepting auto-completion
Revert "8223158: Docked MacBook cannot start any Java Swing applications Reviewed-by: prr, serb"

This reverts commit 7c870c0c from 11.0.7 merge
2020-06-23 12:38:23 +07:00
80 changed files with 2064 additions and 465 deletions

View File

@@ -68,8 +68,9 @@ function create_jbr {
}
JBRSDK_BASE_NAME=jbrsdk-$JBSDK_VERSION
WITH_DEBUG_LEVEL="--with-debug-level=release"
WITH_IMPORT_MODULES="--with-import-modules=./modular-sdk"
RELEASE_NAME=linux-x86_64-normal-server-release
git checkout -- modules.list src/java.desktop/share/classes/module-info.java
case "$bundle_type" in
"jfx")
@@ -90,7 +91,7 @@ esac
sh configure \
--disable-warnings-as-errors \
--with-debug-level=release \
$WITH_DEBUG_LEVEL \
--with-vendor-name="${VENDOR_NAME}" \
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
--with-version-pre= \
@@ -99,15 +100,15 @@ sh configure \
$WITH_IMPORT_MODULES \
--enable-cds=yes || exit $?
make images CONF=linux-x86_64-normal-server-release || exit $?
make images CONF=$RELEASE_NAME || exit $?
JSDK=build/linux-x86_64-normal-server-release/images/jdk
JSDK=build/$RELEASE_NAME/images/jdk
JBSDK=$JBRSDK_BASE_NAME-linux-x64-b$build_number
echo Fixing permissions
chmod -R a+r $JSDK
BASE_DIR=build/linux-x86_64-normal-server-release/images
BASE_DIR=build/$RELEASE_NAME/images
JBRSDK_BUNDLE=jbrsdk
rm -rf $BASE_DIR/$JBRSDK_BUNDLE

View File

@@ -75,8 +75,9 @@ function create_jbr {
}
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
WITH_DEBUG_LEVEL="--with-debug-level=release"
WITH_IMPORT_MODULES="--with-import-modules=./modular-sdk"
RELEASE_NAME=macosx-x86_64-normal-server-release
git checkout -- modules.list src/java.desktop/share/classes/module-info.java
case "$bundle_type" in
"jfx")
@@ -97,7 +98,7 @@ esac
sh configure \
--disable-warnings-as-errors \
--with-debug-level=release \
$WITH_DEBUG_LEVEL \
--with-vendor-name="${VENDOR_NAME}" \
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
--with-version-pre= \
@@ -107,9 +108,9 @@ sh configure \
--with-boot-jdk=`/usr/libexec/java_home -v 11` \
--enable-cds=yes || exit $?
make clean images CONF=macosx-x86_64-normal-server-release || exit $?
make clean images CONF=$RELEASE_NAME || exit $?
JSDK=build/macosx-x86_64-normal-server-release/images/jdk-bundle
JSDK=build/$RELEASE_NAME/images/jdk-bundle
JBSDK=${JBRSDK_BASE_NAME}-osx-x64-b${build_number}
BASE_DIR=jre

View File

@@ -1,7 +1,7 @@
From 7efd979183409db33e965cf80adf60c9a970c762 Mon Sep 17 00:00:00 2001
From 4f9a0ded48f51bdfb3ed7cc18df812c456d48a8c Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Wed, 14 Nov 2018 21:09:39 +0100
Subject: [PATCH 01/48] Apply basic dcevm11 patch
Subject: [PATCH 01/50] Apply basic dcevm11 patch
---
src/hotspot/share/ci/ciObjectFactory.cpp | 25 +
@@ -2207,7 +2207,7 @@ index 18c706187df..4533476ff8f 100644
Symbol* signature() const { return constants()->symbol_at(signature_index()); }
int signature_index() const { return constMethod()->signature_index(); }
diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp
index aed6075b52a..8b0ae584cf4 100644
index f9a69ef0c8b..231ada3f0ab 100644
--- a/src/hotspot/share/prims/jni.cpp
+++ b/src/hotspot/share/prims/jni.cpp
@@ -353,6 +353,7 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR

View File

@@ -1,7 +1,7 @@
From 095315ce3f66bcf14ae1d06d84bbeb24bb068ae8 Mon Sep 17 00:00:00 2001
From a4b2a34a6c9d477ce339bece718abe992cdd5002 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Wed, 14 Nov 2018 21:18:22 +0100
Subject: [PATCH 02/48] We need to set classRedefinitionCount on new class, not
Subject: [PATCH 02/50] We need to set classRedefinitionCount on new class, not
old class.
---

View File

@@ -1,7 +1,7 @@
From 9ddbbcdc73e653af7807ead68705c1c9267c9192 Mon Sep 17 00:00:00 2001
From e5c0b2d69ab024ec0469f5c105f13f889b598815 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Wed, 14 Nov 2018 21:22:01 +0100
Subject: [PATCH 03/48] Fix crashes in MetadataOnStackMark::~MetadataOnSta
Subject: [PATCH 03/50] Fix crashes in MetadataOnStackMark::~MetadataOnSta
MetadataOnStackMark shoukld not remove dcevm stuff. It was added
accidentaly in dcevm9,

View File

@@ -1,7 +1,7 @@
From bb3eb4931818c3ef43c48d0781d73b8e2eb6dea9 Mon Sep 17 00:00:00 2001
From 360fbbd15357fb3cb19abc6ffb40320efadce616 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Mon, 3 Dec 2018 19:34:53 +0100
Subject: [PATCH 04/48] Fix problem with nested members
Subject: [PATCH 04/50] Fix problem with nested members
Reported at : https://stackoverflow.com/questions/53370380/hotswapagent-incompatibleclasschangeerror-type-headerpanel1-is-not-a-nest-mem
---

View File

@@ -1,7 +1,7 @@
From 90746a0267b2de4063667f5423093115f814bf08 Mon Sep 17 00:00:00 2001
From 4e2aef4c3b201e9639acdd39aa9e7ecdc9fb6a86 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Mon, 10 Dec 2018 20:12:07 +0100
Subject: [PATCH 05/48] Use init_mark_raw()
Subject: [PATCH 05/50] Use init_mark_raw()
method changed since j8 - it used init_mark()
---

View File

@@ -1,7 +1,7 @@
From 026346bfb72eaaae53e8998900d9f520da5ef74d Mon Sep 17 00:00:00 2001
From 15194627b2573f109aef2cacc6ebfb600d0a20f0 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Thu, 13 Dec 2018 20:51:09 +0100
Subject: [PATCH 06/48] Fix methodHandles
Subject: [PATCH 06/50] Fix methodHandles
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 2 +-

View File

@@ -1,7 +1,7 @@
From b99ebb71bce6119cd800d69848f84281f2fd2b16 Mon Sep 17 00:00:00 2001
From 23a83be457df96d519db8de59a49dd65731efcc4 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 15 Dec 2018 18:23:30 +0100
Subject: [PATCH 07/48] Fix field method
Subject: [PATCH 07/50] Fix field method
---
.../prims/jvmtiEnhancedRedefineClasses.cpp | 19 ++++++++++++-------

View File

@@ -1,7 +1,7 @@
From dd57a1b40a83f7691c0fb9aa960f77c4428c0eec Mon Sep 17 00:00:00 2001
From 1fe56253f7e63d69f9a12963316889c5e87111eb Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 15 Dec 2018 20:16:37 +0100
Subject: [PATCH 08/48] Fix nonstatic field handles
Subject: [PATCH 08/50] Fix nonstatic field handles
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 7 ++++++-

View File

@@ -1,7 +1,7 @@
From 333c0c639e12296d05a547b015c948516c8c504e Mon Sep 17 00:00:00 2001
From cbe52ffcde1851f2c3527825f37145428aeedc67 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Wed, 12 Dec 2018 19:38:28 +0100
Subject: [PATCH 09/48] Support for Concurrent Mark Sweep (CMS) collector
Subject: [PATCH 09/50] Support for Concurrent Mark Sweep (CMS) collector
---
.../share/gc/cms/compactibleFreeListSpace.cpp | 139 ++++++++++++------

View File

@@ -1,7 +1,7 @@
From b9ceda6f7c230750a87e8a686d833ce853d84712 Mon Sep 17 00:00:00 2001
From 11d10158d77512795b1b8ab8378620b95b67f175 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 29 Dec 2018 13:22:29 +0100
Subject: [PATCH 10/48] Code cleanup
Subject: [PATCH 10/50] Code cleanup
---
.../prims/jvmtiEnhancedRedefineClasses.cpp | 125 ++++++------------

View File

@@ -1,7 +1,7 @@
From 1d147a5db94b531fa027d5e13e4dd5cbaef62952 Mon Sep 17 00:00:00 2001
From 1765f4c1b2e8958b458fa17d329be98ad025069c Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 29 Dec 2018 16:05:25 +0100
Subject: [PATCH 11/48] Fix check_class
Subject: [PATCH 11/50] Fix check_class
---
.../prims/jvmtiEnhancedRedefineClasses.cpp | 39 +++++++------------

View File

@@ -1,7 +1,7 @@
From 84777c09ddbbbbd6a90de5b1f17a4101c8f076b8 Mon Sep 17 00:00:00 2001
From 0851d437a65dc9ac6d8355b54689d36e77e104b3 Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 29 Dec 2018 17:58:39 +0100
Subject: [PATCH 12/48] Fix force_forward in dead space
Subject: [PATCH 12/50] Fix force_forward in dead space
---
src/hotspot/share/gc/shared/space.inline.hpp | 1 +

View File

@@ -1,7 +1,7 @@
From 4d973861fbcd13dc50bd603f731c75d2013034c6 Mon Sep 17 00:00:00 2001
From 35aba247d8a3e25f5d19403ba5f293bfdaf6539c Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Fri, 1 Mar 2019 18:45:13 +0100
Subject: [PATCH 13/48] Cleanup
Subject: [PATCH 13/50] Cleanup
---
src/hotspot/share/gc/shared/space.cpp | 2 +-

View File

@@ -1,7 +1,7 @@
From 5f31460556d86fa0233e7998112a65483034fd45 Mon Sep 17 00:00:00 2001
From 26a5079eb61a2e23328fbd8ca59ffc2ab6b6193b Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sat, 29 Dec 2018 17:38:27 +0100
Subject: [PATCH 14/48] Add codecache flush optimization, but just flush all
Subject: [PATCH 14/50] Add codecache flush optimization, but just flush all
cache.
Redefined class can define a new method that overrides

View File

@@ -1,7 +1,7 @@
From d457702275bc47f3f9ea416dc794be403bc6eb94 Mon Sep 17 00:00:00 2001
From 24a60477aef7098ea23ab50a573332957741ea7b Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Wed, 14 Nov 2018 21:20:08 +0100
Subject: [PATCH 15/48] HotswapAgent integration
Subject: [PATCH 15/50] HotswapAgent integration
It include:

View File

@@ -1,7 +1,7 @@
From 603b446449aa715aa3f409fb49ed00169b89fd91 Mon Sep 17 00:00:00 2001
From dc397b652d9810f6f261070afbb8519f1c2964ee Mon Sep 17 00:00:00 2001
From: skybber <lada.dvorak7@gmail.com>
Date: Sun, 16 Dec 2018 09:55:31 +0100
Subject: [PATCH 16/48] Add dcevm distro name
Subject: [PATCH 16/50] Add dcevm distro name
---
make/autoconf/version-numbers | 2 +-

View File

@@ -1,7 +1,7 @@
From 6869b6f67f8c8db57d91ea0ef9f33aaf44def1db Mon Sep 17 00:00:00 2001
From 987645d54a6682f28a733731965d6b377e892974 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 Nov 2019 19:58:27 +0100
Subject: [PATCH 17/48] java.desktop/com.sun.beans=ALL-UNNAMED
Subject: [PATCH 17/50] java.desktop/com.sun.beans=ALL-UNNAMED
---
src/hotspot/share/runtime/arguments.cpp | 2 ++

View File

@@ -1,7 +1,7 @@
From bbcbaa9d5814017565b8f7f0d86844e9f64905c1 Mon Sep 17 00:00:00 2001
From 60569257636a2d0b31b04ab2638d81f840d75e58 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 Nov 2019 21:07:59 +0100
Subject: [PATCH 18/48] increment_class_counter() using orig dcevm code
Subject: [PATCH 18/50] increment_class_counter() using orig dcevm code
Probably it is cause of SISEGV on:
_

View File

@@ -1,7 +1,7 @@
From 62c65c226bbc4fadbc598db1a2ac7d05d17ae731 Mon Sep 17 00:00:00 2001
From 41d2963b54490601e22cf5309ed73f78566d35ae Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Thu, 21 Nov 2019 19:30:07 +0100
Subject: [PATCH 19/48] Allow 11715ha class initializer calls
Subject: [PATCH 19/50] Allow 11715ha class initializer calls
---
src/hotspot/share/classfile/vmSymbols.hpp | 1 +

View File

@@ -1,7 +1,7 @@
From 88b6f7a27e35d9ed3b82418b82c1cb1fe14f61e6 Mon Sep 17 00:00:00 2001
From 09799f079ef1148248ca60c917205003d2a565b3 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 26 Nov 2019 22:13:07 +0100
Subject: [PATCH 20/48] Disable HA in keytool
Subject: [PATCH 20/50] Disable HA in keytool
---
make/launcher/Launcher-java.base.gmk | 1 +

View File

@@ -1,7 +1,7 @@
From 7fb12fc40a76a37ce67b051276a7ef582de1b04a Mon Sep 17 00:00:00 2001
From e1d8f42f428d7d18f09f1a7098f56fdce808c3fe Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Thu, 28 Nov 2019 18:53:11 +0100
Subject: [PATCH 21/48] Open jdk module to access ClassInfo.CACHE
Subject: [PATCH 21/50] Open jdk module to access ClassInfo.CACHE
---
src/hotspot/share/runtime/arguments.cpp | 2 ++

View File

@@ -1,7 +1,7 @@
From d3d53f242337bd3bc79917f922ff569c0a112f3b Mon Sep 17 00:00:00 2001
From 8b7323c57ee07c03a02ba951ce6d453ec4cc1a54 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 8 Dec 2019 17:55:01 +0100
Subject: [PATCH 22/48] Open java.base/java.io module
Subject: [PATCH 22/50] Open java.base/java.io module
---
src/hotspot/share/runtime/arguments.cpp | 2 ++

View File

@@ -1,7 +1,7 @@
From 833ef503677e066b3639e7418a22587992df1829 Mon Sep 17 00:00:00 2001
From 14c82a29cbf8254f8da626753ea34086d38e71b4 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@mailprofiler.com>
Date: Fri, 6 Mar 2020 09:28:24 +0100
Subject: [PATCH 23/48] Fix fieldDescriptor.inline.hpp
Subject: [PATCH 23/50] Fix fieldDescriptor.inline.hpp
---
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 10 ++++++----

View File

@@ -1,7 +1,7 @@
From 1af8b1f3f891388a37cc71076c324d3905ab2a46 Mon Sep 17 00:00:00 2001
From 5a56f2278c0a79f4a26f369a55f4c1c4dab2621e Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@mailprofiler.com>
Date: Fri, 6 Mar 2020 15:46:51 +0100
Subject: [PATCH 24/48] Fix clear_cpool_cache
Subject: [PATCH 24/50] Fix clear_cpool_cache
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 8 +++-----

View File

@@ -1,7 +1,7 @@
From def550828411b677ed2d7807e51cc5ffe70331fc Mon Sep 17 00:00:00 2001
From c1aafaafaf15780d6bca1312162d551da4f63036 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@mailprofiler.com>
Date: Mon, 9 Mar 2020 09:54:04 +0100
Subject: [PATCH 25/48] Refactor ClearCpoolCacheAndUnpatch
Subject: [PATCH 25/50] Refactor ClearCpoolCacheAndUnpatch
Call it after redefinition of all classes
---

View File

@@ -1,7 +1,7 @@
From 5f416d7a25bd23399b9189cc94ab5d5887e6b4d4 Mon Sep 17 00:00:00 2001
From d6a3286b9b57df4c09d859e38833f2e3dc1574d9 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@mailprofiler.com>
Date: Wed, 11 Mar 2020 14:19:34 +0100
Subject: [PATCH 26/48] Fix class cast exception on redefinition of class A,
Subject: [PATCH 26/50] Fix class cast exception on redefinition of class A,
that is superclass of B that has anonymous class C
---

View File

@@ -1,7 +1,7 @@
From 9a7abdf08bf207f5265a552500446c3178bf5794 Mon Sep 17 00:00:00 2001
From a4ab453f532839ea3b09027736bb6e74d288bf1d Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 10 Apr 2020 23:28:07 +0200
Subject: [PATCH 27/48] Update klass reference in Klass.implementor()
Subject: [PATCH 27/50] Update klass reference in Klass.implementor()
If interface X is removed from class Y then old reference to Y could be
stored in X.implementor()

View File

@@ -1,7 +1,7 @@
From 8f13d3b4ba9aecd847b7da306055ba53ee2e29d0 Mon Sep 17 00:00:00 2001
From 015c9c88e63f2dde4b8b2a09d2832a8c2a3caf25 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 10 Apr 2020 23:30:21 +0200
Subject: [PATCH 28/48] Fix DirectMethodHandle accessors klasses
Subject: [PATCH 28/50] Fix DirectMethodHandle accessors klasses
---
src/hotspot/share/classfile/javaClasses.cpp | 28 +++++++++++++++------

View File

@@ -1,7 +1,7 @@
From cbad9c34bf8920d772c646d041d4fc04fea203cc Mon Sep 17 00:00:00 2001
From 14005f6176420c16fa1d152c78a3dacd26ecb647 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 11 Apr 2020 12:07:43 +0200
Subject: [PATCH 29/48] cleanup direct method handles code
Subject: [PATCH 29/50] cleanup direct method handles code
---
src/hotspot/share/classfile/javaClasses.hpp | 10 ++++------

View File

@@ -1,7 +1,7 @@
From e3b94671ce5108a91e3a3e92b01eea07731c7639 Mon Sep 17 00:00:00 2001
From 990ffe4111fe73c3a183f8d35402cbf9e81bd587 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 11 Apr 2020 17:52:13 +0200
Subject: [PATCH 30/48] Add init_implementor_from_redefine, that skips compiler
Subject: [PATCH 30/50] Add init_implementor_from_redefine, that skips compiler
lock assert
---

View File

@@ -1,7 +1,7 @@
From a95c3daf0a1db23e2dcc977f427faa7be41007c9 Mon Sep 17 00:00:00 2001
From 9dcddc7c2573c34579161e3ad1240b029dda1e96 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Mon, 13 Apr 2020 20:59:35 +0200
Subject: [PATCH 31/48] not nullable oop_store_not_null() method+handle NULL in
Subject: [PATCH 31/50] not nullable oop_store_not_null() method+handle NULL in
mem_name in dmh
---

View File

@@ -1,7 +1,7 @@
From 15690197a276a86054e1ec9724c877d6d871ca01 Mon Sep 17 00:00:00 2001
From 800b44f545c7b99026d203690def30ec4b9ed08e Mon Sep 17 00:00:00 2001
From: Artem Khvastunov <artem.khvastunov@jetbrains.com>
Date: Tue, 14 Apr 2020 19:11:35 +0200
Subject: [PATCH 32/48] add jvmtiEnhancedRedefineClasses.* to CMakeLists.txt
Subject: [PATCH 32/50] add jvmtiEnhancedRedefineClasses.* to CMakeLists.txt
---
jb/project/hotspot-cmake/CMakeLists.txt | 2 ++

View File

@@ -1,7 +1,7 @@
From dab6a53de4c25aae95667c78b8e1f1097ab47130 Mon Sep 17 00:00:00 2001
From e009b4fcc48e9719b5b896f7f3838fbc7c579ba7 Mon Sep 17 00:00:00 2001
From: Artem Khvastunov <artem.khvastunov@jetbrains.com>
Date: Sun, 19 Apr 2020 11:36:12 +0200
Subject: [PATCH 33/48] migrate DCEVM to 11.0.7
Subject: [PATCH 33/50] migrate DCEVM to 11.0.7
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp | 2 +-

View File

@@ -1,7 +1,7 @@
From 70d53ce28f9df75d9e50819d2b6654855da0d533 Mon Sep 17 00:00:00 2001
From 5653e2a5f05a9693f934b0f9c4d9286c01576807 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 8 May 2020 21:07:50 +0200
Subject: [PATCH 34/48] Fix 11.0.7 compilation issues
Subject: [PATCH 34/50] Fix 11.0.7 compilation issues
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp | 3 ++-

View File

@@ -1,7 +1,7 @@
From 805b588bc4bd45e61b81c90e23b71337072e9549 Mon Sep 17 00:00:00 2001
From 0b9b021f889ec001d579d192f1bd9a7a43f63871 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 9 May 2020 10:08:17 +0200
Subject: [PATCH 35/48] Use INCLUDE_CDS condition on "UseSharedSpaces" block
Subject: [PATCH 35/50] Use INCLUDE_CDS condition on "UseSharedSpaces" block
from master
---

View File

@@ -1,7 +1,7 @@
From 78619004206d224b319d68493672bee2c97f0946 Mon Sep 17 00:00:00 2001
From 9f4b84339b55187b742682bd84fdb0e6e121917c Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 16 May 2020 15:11:40 +0200
Subject: [PATCH 36/48] Access com.sun.beans.util - HotswapAgent patch
Subject: [PATCH 36/50] Access com.sun.beans.util - HotswapAgent patch
---
src/hotspot/share/runtime/arguments.cpp | 2 ++

View File

@@ -1,7 +1,7 @@
From baf26456579eb0e560471d3bcb150005492f69f4 Mon Sep 17 00:00:00 2001
From 9a662b1367860920095efe79116ef9a2d53fc2c6 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 17 May 2020 12:19:18 +0200
Subject: [PATCH 37/48] Skip verifier only in AllowEnhancedClassRedefinition
Subject: [PATCH 37/50] Skip verifier only in AllowEnhancedClassRedefinition
---
src/hotspot/share/oops/instanceKlass.cpp | 4 ++--

View File

@@ -1,7 +1,7 @@
From 46dc38a58ac8afafab4e04ee47a1ed2b9e65c1e1 Mon Sep 17 00:00:00 2001
From a58ed678218bfb80af164cfe98cdf4a3ab74a682 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 17 May 2020 18:18:52 +0200
Subject: [PATCH 38/48] Use original code for adjust_method_entries in standard
Subject: [PATCH 38/50] Use original code for adjust_method_entries in standard
redefinition
---

View File

@@ -1,7 +1,7 @@
From 6ac099d1b07fcc0d3c17ebd5d3335bcb6ceaedc9 Mon Sep 17 00:00:00 2001
From c1e814f2f7d4f2b37abd667d0bec516474f2a119 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 May 2020 09:41:36 +0200
Subject: [PATCH 39/48] Revert code for !AllowEnhancedClassRedefinition
Subject: [PATCH 39/50] Revert code for !AllowEnhancedClassRedefinition
---
.../share/classfile/classLoaderData.cpp | 23 ++++++++++---------

View File

@@ -1,7 +1,7 @@
From de04154ee21d33c1ac1b74b2740f2fda117c0430 Mon Sep 17 00:00:00 2001
From 5b36c4798869c5cd4d65f7765a8447b9cf09d76b Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 May 2020 09:29:39 +0200
Subject: [PATCH 40/48] Code cleanup
Subject: [PATCH 40/50] Code cleanup
---
src/hotspot/share/classfile/classFileParser.cpp | 4 +++-

View File

@@ -1,7 +1,7 @@
From ab8888737eaed76776b41b28af93a0c47826b8d6 Mon Sep 17 00:00:00 2001
From 71f35c41b569f72a1674ccd57118c4fe76ba3d68 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 May 2020 10:31:15 +0200
Subject: [PATCH 41/48] Activate cpCache definition asserts for !dcevm
Subject: [PATCH 41/50] Activate cpCache definition asserts for !dcevm
---
src/hotspot/share/oops/cpCache.cpp | 6 ++----

View File

@@ -1,7 +1,7 @@
From 8596cf8b677eadcd18b527dd61c891475758bbaa Mon Sep 17 00:00:00 2001
From 961018a29ddb7eba96aca7fbc385f3c4f29e3a03 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Tue, 19 May 2020 10:54:38 +0200
Subject: [PATCH 42/48] iterate old method version only in dcevm
Subject: [PATCH 42/50] iterate old method version only in dcevm
---
src/hotspot/share/prims/jvmtiImpl.cpp | 6 ++++--

View File

@@ -1,7 +1,7 @@
From f3c1667fc04abdd9aa556b2c00a23239eba14287 Mon Sep 17 00:00:00 2001
From 2ab70b495c43c4699ad402a714710566400de99d Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 22 May 2020 21:23:01 +0200
Subject: [PATCH 43/48] Support for Lambda class redefinition
Subject: [PATCH 43/50] Support for Lambda class redefinition
---
.../share/classfile/classLoaderData.cpp | 9 +++

View File

@@ -1,7 +1,7 @@
From b8a3d4249eb97613f796edc709e414900c9a0828 Mon Sep 17 00:00:00 2001
From 3f53bb48682b17cfbf4781d4fa47055be88baea0 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 22 May 2020 21:43:22 +0200
Subject: [PATCH 44/48] Skip GC runs for redefinitions without instance size
Subject: [PATCH 44/50] Skip GC runs for redefinitions without instance size
change
---

View File

@@ -1,7 +1,7 @@
From 77bdf6253c457ed88436fb4da6a53c7c0c361a1c Mon Sep 17 00:00:00 2001
From d0d6602fe3d664cb2322d7066bf46fa7e20d5d4e Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 23 May 2020 10:02:15 +0200
Subject: [PATCH 45/48] Fix "no original bytecode found" error if method with
Subject: [PATCH 45/50] Fix "no original bytecode found" error if method with
bkp is missing
Sometimes IDE can deploy class with erroneous method, such method has

View File

@@ -1,7 +1,7 @@
From d3371d7d52bd4dc66efd4f6a946d5045b8bc8b2b Mon Sep 17 00:00:00 2001
From 585f1cb56766be837a34114b1ee5c743aa4e6801 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 23 May 2020 10:17:56 +0200
Subject: [PATCH 46/48] Fix comments according hotspot formatting conventions
Subject: [PATCH 46/50] Fix comments according hotspot formatting conventions
---
.../prims/jvmtiEnhancedRedefineClasses.cpp | 191 +++++++-----------

View File

@@ -1,7 +1,7 @@
From 2ad306a4cce06cfccf95a1193daf5b968ec1fa87 Mon Sep 17 00:00:00 2001
From 79c80c48da4d52f4616f1c6ef37e838d29be9be1 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 24 May 2020 12:07:09 +0200
Subject: [PATCH 47/48] Review threads, cleanup
Subject: [PATCH 47/50] Review threads, cleanup
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 9 ++++-----

View File

@@ -1,7 +1,7 @@
From a5586aff03fde654102e2c2e1fc19fdea406b31e Mon Sep 17 00:00:00 2001
From 8b79e673a3a9d12c97b8b7dd2f4d79c2d4cdd1d6 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 24 May 2020 12:07:42 +0200
Subject: [PATCH 48/48] Replace deleted method with
Subject: [PATCH 48/50] Replace deleted method with
Universe::throw_no_such_method_error
---

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,214 @@
From 55e30de9a54b2f3bec995a2df42fe14b09d16f06 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sun, 21 Jun 2020 13:38:45 +0200
Subject: [PATCH 50/50] G1 Heap parallel iterate method "object_par_iterate" +
dcevm timers
G1 Heap does not have parallel iterate method, that is usefull in dcevm
iterate phase. According performance tests the parallel iteration is up
~25% faster then serial iteration, ratio depends on the size of heap.
Dcevm's timers did not make sense. Now, there are timers fo prologue,
doit, gc itarate and full gc phases. Iterate+fullgc time make up most
the total doit time.
---
src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 20 ++++++++
src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 2 +
.../prims/jvmtiEnhancedRedefineClasses.cpp | 46 +++++++++++++------
.../prims/jvmtiEnhancedRedefineClasses.hpp | 5 +-
4 files changed, 58 insertions(+), 15 deletions(-)
diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
index dea8d9fdb0e..33664a30519 100644
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
@@ -2108,6 +2108,21 @@ public:
}
};
+class G1IterateObjectClosureTask : public AbstractGangTask {
+ private:
+ ObjectClosure* _cl;
+ G1CollectedHeap* _g1h;
+ HeapRegionClaimer _hrclaimer;
+ public:
+ G1IterateObjectClosureTask(ObjectClosure* cl, G1CollectedHeap* g1h) : AbstractGangTask("IterateObject Closure"),
+ _cl(cl), _g1h(g1h), _hrclaimer(g1h->workers()->active_workers()) { }
+
+ virtual void work(uint worker_id) {
+ IterateObjectClosureRegionClosure blk(_cl);
+ _g1h->heap_region_par_iterate_from_worker_offset(&blk, &_hrclaimer, worker_id);
+ }
+};
+
void G1CollectedHeap::object_iterate(ObjectClosure* cl) {
IterateObjectClosureRegionClosure blk(cl);
heap_region_iterate(&blk);
@@ -2117,6 +2132,11 @@ void G1CollectedHeap::heap_region_iterate(HeapRegionClosure* cl) const {
_hrm.iterate(cl);
}
+void G1CollectedHeap::object_par_iterate(ObjectClosure* cl) {
+ G1IterateObjectClosureTask iocl_task(cl, this);
+ workers()->run_task(&iocl_task);
+}
+
void G1CollectedHeap::heap_region_par_iterate_from_worker_offset(HeapRegionClosure* cl,
HeapRegionClaimer *hrclaimer,
uint worker_id) const {
diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
index 0735eef0da8..05a068bb2e0 100644
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
@@ -1117,6 +1117,8 @@ public:
// Iteration functions.
+ void object_par_iterate(ObjectClosure* cl);
+
// Iterate over all objects, calling "cl.do_object" on each.
virtual void object_iterate(ObjectClosure* cl);
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
index 32929b3d7a0..5be9bb74305 100644
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
@@ -54,6 +54,7 @@
#include "utilities/events.hpp"
#include "oops/constantPool.inline.hpp"
#include "gc/cms/cmsHeap.hpp"
+#include "gc/g1/g1CollectedHeap.hpp"
#include "gc/shared/dcevmSharedGC.hpp"
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
@@ -459,6 +460,10 @@ public:
void VM_EnhancedRedefineClasses::doit() {
Thread *thread = Thread::current();
+ if (log_is_enabled(Info, redefine, class, timer)) {
+ _timer_vm_op_doit.start();
+ }
+
#if INCLUDE_CDS
if (UseSharedSpaces) {
// Sharing is enabled so we remap the shared readonly space to
@@ -523,8 +528,22 @@ void VM_EnhancedRedefineClasses::doit() {
}
Universe::heap()->ensure_parsability(false);
- Universe::heap()->object_iterate(&objectClosure);
+ if (UseG1GC) {
+ if (log_is_enabled(Info, redefine, class, timer)) {
+ _timer_heap_iterate.start();
+ }
+ G1CollectedHeap::heap()->object_par_iterate(&objectClosure);
+ _timer_heap_iterate.stop();
+ } else {
+ if (log_is_enabled(Info, redefine, class, timer)) {
+ _timer_heap_iterate.start();
+ }
+ Universe::heap()->object_iterate(&objectClosure);
+ _timer_heap_iterate.stop();
+ }
+
Universe::root_oops_do(&oopClosureNoBarrier);
+
}
log_trace(redefine, class, obsolete, metadata)("After updating instances");
@@ -577,12 +596,19 @@ void VM_EnhancedRedefineClasses::doit() {
if (objectClosure.needs_instance_update()) {
// Do a full garbage collection to update the instance sizes accordingly
+
+ if (log_is_enabled(Info, redefine, class, timer)) {
+ _timer_heap_full_gc.start();
+ }
+
Universe::set_redefining_gc_run(true);
notify_gc_begin(true);
// TODO: check _metadata_GC_clear_soft_refs with ScavengeRootsInCode
Universe::heap()->collect_as_vm_thread(GCCause::_heap_inspection);
notify_gc_end();
Universe::set_redefining_gc_run(false);
+
+ _timer_heap_full_gc.stop();
}
// Unmark Klass*s as "redefining"
@@ -630,6 +656,7 @@ void VM_EnhancedRedefineClasses::doit() {
}
#endif
+ _timer_vm_op_doit.stop();
}
// Cleanup - runs in JVM thread
@@ -653,16 +680,14 @@ void VM_EnhancedRedefineClasses::doit_epilogue() {
if (log_is_enabled(Info, redefine, class, timer)) {
// Used to have separate timers for "doit" and "all", but the timer
// overhead skewed the measurements.
- jlong doit_time = _timer_rsc_phase1.milliseconds() +
- _timer_rsc_phase2.milliseconds();
- jlong all_time = _timer_vm_op_prologue.milliseconds() + doit_time;
+ jlong all_time = _timer_vm_op_prologue.milliseconds() + _timer_vm_op_doit.milliseconds();
log_info(redefine, class, timer)
("vm_op: all=" JLONG_FORMAT " prologue=" JLONG_FORMAT " doit=" JLONG_FORMAT,
- all_time, _timer_vm_op_prologue.milliseconds(), doit_time);
+ all_time, _timer_vm_op_prologue.milliseconds(), _timer_vm_op_doit.milliseconds());
log_info(redefine, class, timer)
- ("redefine_single_class: phase1=" JLONG_FORMAT " phase2=" JLONG_FORMAT,
- _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds());
+ ("doit: heap iterate=" JLONG_FORMAT " fullgc=" JLONG_FORMAT,
+ _timer_heap_iterate.milliseconds(), _timer_heap_full_gc.milliseconds());
}
}
@@ -1411,7 +1436,7 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
// arrayKlassOops. See Open Issues in jvmtiRedefineClasses.hpp.
void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
if (!k->is_instance_klass()) {
- return;
+ return;
}
HandleMark hm(_thread);
@@ -1829,10 +1854,6 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
HandleMark hm(THREAD); // make sure handles from this call are freed
- if (log_is_enabled(Info, redefine, class, timer)) {
- _timer_rsc_phase1.start();
- }
-
InstanceKlass* new_class = new_class_oop;
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
assert(the_class != NULL, "must have old version");
@@ -1887,7 +1908,6 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
new_class->external_name(),
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
}
- _timer_rsc_phase2.stop();
} // end redefine_single_class()
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
index 030852b160a..9755944d70b 100644
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
@@ -86,9 +86,10 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
// Performance measurement support. These timers do not cover all
// the work done for JVM/TI RedefineClasses() but they do cover
// the heavy lifting.
- elapsedTimer _timer_rsc_phase1;
- elapsedTimer _timer_rsc_phase2;
+ elapsedTimer _timer_vm_op_doit;
elapsedTimer _timer_vm_op_prologue;
+ elapsedTimer _timer_heap_iterate;
+ elapsedTimer _timer_heap_full_gc;
// These routines are roughly in call order unless otherwise noted.
--
2.24.3 (Apple Git-128)

View File

@@ -54,7 +54,9 @@ function create_jbr {
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
WORK_DIR=$(pwd)
WITH_DEBUG_LEVEL="--with-debug-level=release"
WITH_IMPORT_MODULES="--with-import-modules=${WORK_DIR}/modular-sdk"
RELEASE_NAME=windows-x86_64-normal-server-release
git checkout -- modules.list src/java.desktop/share/classes/module-info.java
case "$bundle_type" in
"jfx")
@@ -79,7 +81,7 @@ esac
PATH="/usr/local/bin:/usr/bin:${PATH}"
./configure \
--disable-warnings-as-errors \
--disable-debug-symbols \
$WITH_DEBUG_LEVEL \
--with-target-bits=64 \
--with-vendor-name="${VENDOR_NAME}" \
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
@@ -93,16 +95,16 @@ PATH="/usr/local/bin:/usr/bin:${PATH}"
--enable-cds=yes || exit 1
if [ "$bundle_type" == "jfx_jcef" ]; then
make LOG=info clean images CONF=windows-x86_64-normal-server-release test-image || exit 1
make LOG=info clean images CONF=$RELEASE_NAME test-image || exit 1
else
make LOG=info clean images CONF=windows-x86_64-normal-server-release || exit 1
make LOG=info clean images CONF=$RELEASE_NAME || exit 1
fi
JSDK=build/windows-x86_64-normal-server-release/images/jdk
JSDK=build/$RELEASE_NAME/images/jdk
if [[ "$bundle_type" == *jcef* ]]; then
JBSDK=${JBRSDK_BASE_NAME}-windows-x64-b${build_number}
fi
BASE_DIR=build/windows-x86_64-normal-server-release/images
BASE_DIR=build/$RELEASE_NAME/images
JBRSDK_BUNDLE=jbrsdk
rm -rf ${BASE_DIR}/${JBRSDK_BUNDLE} && rsync -a --exclude demo --exclude sample ${JSDK}/ ${JBRSDK_BUNDLE} || exit 1

View File

@@ -48,10 +48,12 @@ function pack_jbr {
#rm -rf ${BASE_DIR}/${JBR_BUNDLE}
}
RELEASE_NAME=windows-x86_64-normal-server-release
JBRSDK_BASE_NAME=jbrsdk-$JBSDK_VERSION
JBR_BASE_NAME=jbr-$JBSDK_VERSION
IMAGES_DIR=build/windows-x86_64-normal-server-release/images
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JBSDK=$JBRSDK_BASE_NAME-windows-x64-b$build_number
BASE_DIR=.

View File

@@ -878,7 +878,7 @@ endif
ifeq ($(OPENJDK_TARGET_OS), windows)
BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit := jvm.lib
else
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libsystemclssearch_agent += -lpthread
@@ -1512,6 +1512,7 @@ else
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase001 += -lpthread
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase002 += -lpthread
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libterminatedThread += -lpthread
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit += -ljvm
endif
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \

View File

@@ -47,15 +47,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class RenderPerfTest {
private static HashSet<String> ignoredTests = new HashSet<>();
static {
ignoredTests.add("testWhiteTextBubblesNoAA");
ignoredTests.add("testWhiteTextBubblesLCD");
ignoredTests.add("testWhiteTextBubblesGray");
ignoredTests.add("testLinGradOvalRotBubblesAA");
ignoredTests.add("testWiredBoxBubblesAA");
ignoredTests.add("testLinesAA");
}
private final static int N = 1000;
private final static float WIDTH = 800;
private final static float HEIGHT = 800;

View File

@@ -3861,7 +3861,8 @@ extern const struct JNIInvokeInterface_ jni_InvokeInterface;
// Global invocation API vars
volatile int vm_created = 0;
// Indicate whether it is safe to recreate VM
// Indicate whether it is safe to recreate VM. Recreation is only
// possible after a failed initial creation attempt in some cases.
volatile int safe_to_recreate_vm = 1;
struct JavaVM_ main_vm = {&jni_InvokeInterface};
@@ -3948,8 +3949,14 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
if (Atomic::xchg(1, &vm_created) == 1) {
return JNI_EEXIST; // already created, or create attempt in progress
}
// If a previous creation attempt failed but can be retried safely,
// then safe_to_recreate_vm will have been reset to 1 after being
// cleared here. If a previous creation attempt succeeded and we then
// destroyed that VM, we will be prevented from trying to recreate
// the VM in the same process, as the value will still be 0.
if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) {
return JNI_ERR; // someone tried and failed and retry not allowed.
return JNI_ERR;
}
assert(vm_created == 1, "vm_created is true during the creation");
@@ -4154,9 +4161,14 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae
Thread* t = Thread::current_or_null();
if (t != NULL) {
// If the thread has been attached this operation is a no-op
*(JNIEnv**)penv = ((JavaThread*) t)->jni_environment();
return JNI_OK;
// If executing from an atexit hook we may be in the VMThread.
if (t->is_Java_thread()) {
// If the thread has been attached this operation is a no-op
*(JNIEnv**)penv = ((JavaThread*) t)->jni_environment();
return JNI_OK;
} else {
return JNI_ERR;
}
}
// Create a thread and mark it as attaching so it will be skipped by the
@@ -4255,7 +4267,7 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae
jint JNICALL jni_AttachCurrentThread(JavaVM *vm, void **penv, void *_args) {
HOTSPOT_JNI_ATTACHCURRENTTHREAD_ENTRY(vm, penv, _args);
if (vm_created == 0) {
HOTSPOT_JNI_ATTACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
HOTSPOT_JNI_ATTACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
return JNI_ERR;
}
@@ -4268,18 +4280,30 @@ jint JNICALL jni_AttachCurrentThread(JavaVM *vm, void **penv, void *_args) {
jint JNICALL jni_DetachCurrentThread(JavaVM *vm) {
HOTSPOT_JNI_DETACHCURRENTTHREAD_ENTRY(vm);
if (vm_created == 0) {
HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_ERR);
return JNI_ERR;
}
JNIWrapper("DetachCurrentThread");
Thread* current = Thread::current_or_null();
// If the thread has already been detached the operation is a no-op
if (Thread::current_or_null() == NULL) {
if (current == NULL) {
HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK);
return JNI_OK;
}
// If executing from an atexit hook we may be in the VMThread.
if (!current->is_Java_thread()) {
HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
return JNI_ERR;
}
VM_Exit::block_if_vm_exited();
JavaThread* thread = JavaThread::current();
JavaThread* thread = (JavaThread*) current;
if (thread->has_last_Java_frame()) {
HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
// Can't detach a thread that's running java, that can't work.

View File

@@ -131,27 +131,31 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
*/
@SuppressWarnings("unused")
void _displayReconfiguration(final int displayId, final boolean removed) {
synchronized (this) {
// We don't need to switch to AppKit, we're already there
mainDisplayID = getMainDisplayID();
if (removed && devices.containsKey(displayId)) {
final CGraphicsDevice gd = devices.remove(displayId);
oldDevices.add(new WeakReference<>(gd));
try {
synchronized (this) {
// We don't need to switch to AppKit, we're already there
mainDisplayID = getMainDisplayID();
if (removed && devices.containsKey(displayId)) {
final CGraphicsDevice gd = devices.remove(displayId);
oldDevices.add(new WeakReference<>(gd));
}
}
}
initDevices(mainDisplayID);
initDevices(mainDisplayID);
// Need to notify old devices, in case the user hold the reference to it
for (ListIterator<WeakReference<CGraphicsDevice>> it =
oldDevices.listIterator(); it.hasNext(); ) {
CGraphicsDevice gd = it.next().get();
if (gd != null) {
gd.invalidate(mainDisplayID);
gd.displayChanged();
} else {
// no more references to this device, remove it
it.remove();
// Need to notify old devices, in case the user hold the reference to it
for (ListIterator<WeakReference<CGraphicsDevice>> it =
oldDevices.listIterator(); it.hasNext(); ) {
CGraphicsDevice gd = it.next().get();
if (gd != null) {
gd.invalidate(mainDisplayID);
gd.displayChanged();
} else {
// no more references to this device, remove it
it.remove();
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}

View File

@@ -959,18 +959,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
// however that is the shared code and this particular problem's reproducibility has
// platform specifics. So, it was decided to narrow down the fix to lwawt (OSX) in
// current release. TODO: consider fixing it in the shared code.
if (!focusedWindowChangeAllowed) {
LWWindowPeer decoratedPeer = parentPeer.isSimpleWindow() ?
LWWindowPeer.getOwnerFrameDialog(parentPeer) : parentPeer;
if (decoratedPeer == null || !decoratedPeer.getPlatformWindow().isActive()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " +
"decoratedPeer is inactive: " + decoratedPeer);
}
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
if (!focusedWindowChangeAllowed && !parentPeer.getPlatformWindow().isActive()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " +
"parentPeer is inactive: " + parentPeer);
}
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
return parentPeer.requestWindowFocus(cause, () -> {

View File

@@ -1151,16 +1151,21 @@ public class LWWindowPeer
@Override
public final void displayChanged() {
if (updateGraphicsDevice()) {
updateMinimumSize();
if (!isMaximizedBoundsSet()) {
setPlatformMaximizedBounds(getDefaultMaximizedBounds());
try {
if (updateGraphicsDevice()) {
updateMinimumSize();
if (!isMaximizedBoundsSet()) {
setPlatformMaximizedBounds(getDefaultMaximizedBounds());
}
}
// Replace surface unconditionally, because internal state of the
// GraphicsDevice could be changed.
replaceSurfaceData();
repaintPeer();
} catch (Throwable t) {
System.err.println(t + " on " + this);
t.printStackTrace();
}
// Replace surface unconditionally, because internal state of the
// GraphicsDevice could be changed.
replaceSurfaceData();
repaintPeer();
}
@Override
@@ -1277,39 +1282,9 @@ public class LWWindowPeer
Window opposite = LWKeyboardFocusManagerPeer.getInstance().
getCurrentFocusedWindow();
// Make the owner active window.
if (isSimpleWindow()) {
LWWindowPeer owner = getOwnerFrameDialog(this);
// If owner is not natively active, request native
// activation on it w/o sending events up to java.
if (owner != null && !owner.platformWindow.isActive()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("requesting native focus to the owner " + owner);
}
LWWindowPeer currentActivePeer = currentActive == null ? null :
(LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(
currentActive);
// Ensure the opposite is natively active and suppress sending events.
if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("the opposite is " + currentActivePeer);
}
currentActivePeer.skipNextFocusChange = true;
}
owner.skipNextFocusChange = true;
owner.platformWindow.requestWindowFocus();
}
// DKFM will synthesize all the focus/activation events correctly.
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
} else if (getTarget() == currentActive && !getTarget().isFocused()) {
if (getTarget() == currentActive && !getTarget().isFocused()) {
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
}
@@ -1396,7 +1371,8 @@ public class LWWindowPeer
// - when the opposite (gaining focus) window is an owned/owner window.
// - for a simple window in any case.
if (!becomesFocused &&
(isGrabbing() || this.isOneOfOwnersOf(grabbingWindow)))
(isGrabbing() || this.isOneOfOwnersOf(grabbingWindow)) &&
(opposite == null || getOwnerFrameDialog(AWTAccessor.getComponentAccessor().getPeer(opposite)) != this))
{
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("ungrabbing on " + grabbingWindow);

View File

@@ -603,47 +603,47 @@ public class CInputMethod extends InputMethodAdapter {
private synchronized String attributedSubstringFromRange(final int locationIn, final int lengthIn) {
final String[] retString = new String[1];
try {
if (fIMContext != null && fAwtFocussedComponent != null)
LWCToolkit.invokeAndWait(new Runnable() {
public void run() { synchronized(retString) {
int location = locationIn;
int length = lengthIn;
if (fIMContext != null && fAwtFocussedComponent != null) {
invokeAndWaitNoThrow(new Runnable() {
public void run() {
synchronized (retString) {
int location = locationIn;
int length = lengthIn;
if ((location + length) > (fIMContext.getCommittedTextLength() + fCurrentTextLength)) {
length = fIMContext.getCommittedTextLength() - location;
}
AttributedCharacterIterator theIterator = null;
if (fCurrentText == null) {
theIterator = fIMContext.getCommittedText(location, location + length, null);
} else {
int insertSpot = fIMContext.getInsertPositionOffset();
if (location < insertSpot) {
theIterator = fIMContext.getCommittedText(location, location + length, null);
} else if (location >= insertSpot && location < insertSpot + fCurrentTextLength) {
theIterator = fCurrentText.getIterator(null, location - insertSpot, location - insertSpot +length);
} else {
theIterator = fIMContext.getCommittedText(location - fCurrentTextLength, location - fCurrentTextLength + length, null);
if ((location + length) > (fIMContext.getCommittedTextLength() + fCurrentTextLength)) {
length = fIMContext.getCommittedTextLength() - location;
}
}
// Get the characters from the iterator
char selectedText[] = new char[theIterator.getEndIndex() - theIterator.getBeginIndex()];
char current = theIterator.first();
int index = 0;
while (current != CharacterIterator.DONE) {
selectedText[index++] = current;
current = theIterator.next();
}
AttributedCharacterIterator theIterator = null;
retString[0] = new String(selectedText);
}}
if (fCurrentText == null) {
theIterator = fIMContext.getCommittedText(location, location + length, null);
} else {
int insertSpot = fIMContext.getInsertPositionOffset();
if (location < insertSpot) {
theIterator = fIMContext.getCommittedText(location, location + length, null);
} else if (location >= insertSpot && location < insertSpot + fCurrentTextLength) {
theIterator = fCurrentText.getIterator(null, location - insertSpot, location - insertSpot + length);
} else {
theIterator = fIMContext.getCommittedText(location - fCurrentTextLength, location - fCurrentTextLength + length, null);
}
}
// Get the characters from the iterator
char selectedText[] = new char[theIterator.getEndIndex() - theIterator.getBeginIndex()];
char current = theIterator.first();
int index = 0;
while (current != CharacterIterator.DONE) {
selectedText[index++] = current;
current = theIterator.next();
}
retString[0] = new String(selectedText);
}
}
}, fAwtFocussedComponent);
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
}
synchronized(retString) { return retString[0]; }
}
@@ -656,9 +656,8 @@ public class CInputMethod extends InputMethodAdapter {
private synchronized int[] selectedRange() {
final int[] returnValue = new int[2];
try {
if (fIMContext != null && fAwtFocussedComponent != null)
LWCToolkit.invokeAndWait(new Runnable() {
if (fIMContext != null && fAwtFocussedComponent != null) {
invokeAndWaitNoThrow(new Runnable() {
public void run() { synchronized(returnValue) {
AttributedCharacterIterator theIterator = fIMContext.getSelectedText(null);
if (theIterator == null) {
@@ -691,7 +690,7 @@ public class CInputMethod extends InputMethodAdapter {
}}
}, fAwtFocussedComponent);
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
}
synchronized(returnValue) { return returnValue; }
}
@@ -707,15 +706,13 @@ public class CInputMethod extends InputMethodAdapter {
final int[] returnValue = new int[2];
try {
LWCToolkit.invokeAndWait(new Runnable() {
public void run() { synchronized(returnValue) {
// The insert position is always after the composed text, so the range start is the
// insert spot less the length of the composed text.
returnValue[0] = fIMContext.getInsertPositionOffset();
}}
}, fAwtFocussedComponent);
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
invokeAndWaitNoThrow(new Runnable() {
public void run() { synchronized(returnValue) {
// The insert position is always after the composed text, so the range start is the
// insert spot less the length of the composed text.
returnValue[0] = fIMContext.getInsertPositionOffset();
}}
}, fAwtFocussedComponent);
returnValue[1] = fCurrentTextLength;
synchronized(returnValue) { return returnValue; }
@@ -882,7 +879,7 @@ public class CInputMethod extends InputMethodAdapter {
// 1) Do not run secondary msg loop in this case.
// 2) Delegate runnable back to FX when applicable.
LWCToolkit.invokeAndWait(() -> {
invokeAndWaitNoThrow(() -> {
runOnAppKit.set(instanceofJFXPanel(getClientComponent(inputContext)));
if (!runOnAppKit.get()) {
runnable.run();
@@ -894,4 +891,12 @@ public class CInputMethod extends InputMethodAdapter {
}
}
}
static void invokeAndWaitNoThrow(Runnable runnable, Component component) {
try {
LWCToolkit.invokeAndWait(runnable, component, false);
} catch (Throwable e) {
e.printStackTrace();
}
}
}

View File

@@ -73,7 +73,21 @@ import sun.lwawt.LWWindowPeer.PeerType;
import sun.lwawt.PlatformWindow;
import sun.util.logging.PlatformLogger;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.security.action.GetPropertyAction;
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
static final boolean synergyWorkaroundEnabled;
static {
synergyWorkaroundEnabled = Boolean.parseBoolean(
AccessController.doPrivileged(
new GetPropertyAction("com.jetbrains.synergyWorkaroundEnabled", "false")
));
}
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
@@ -154,7 +168,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int DARK = 1 << 28;
static final int LIGHT = 1 << 29;
static final int TRANSPARENT_TITLEBAR = 1 << 30;
static final int NONACTIVATING = 1 << 24;
static final int IS_DIALOG = 1 << 25;
static final int IS_MODAL = 1 << 26;
static final int IS_POPUP = 1 << 27;
@@ -173,6 +186,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE;
static final int POPUP = 1 << 14;
// corresponds to callback-based properties
static final int SHOULD_BECOME_KEY = 1 << 12;
static final int SHOULD_BECOME_MAIN = 1 << 13;
@@ -393,14 +408,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// defaults style bits
int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
if (isNativelyFocusableWindow()) {
styleBits = SET(styleBits, SHOULD_BECOME_KEY, true);
styleBits = SET(styleBits, SHOULD_BECOME_MAIN, true);
if (target.getName() == "###overrideRedirect###") {
styleBits = SET(styleBits, POPUP, true);
}
styleBits |= getFocusableStyleBits();
final boolean isFrame = (target instanceof Frame);
final boolean isDialog = (target instanceof Dialog);
final boolean isPopup = (target.getType() == Window.Type.POPUP);
if (isDialog) {
styleBits = SET(styleBits, MINIMIZABLE, false);
}
@@ -429,11 +444,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
// If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
if (isPopup) {
styleBits = SET(styleBits, TEXTURED, false);
// Popups in applets don't activate applet's process
styleBits = SET(styleBits, NONACTIVATING, true);
styleBits = SET(styleBits, IS_POPUP, true);
if (!isDialog && IS(styleBits, POPUP)) {
styleBits = SET(styleBits, TEXTURED, true);
}
if (Window.Type.UTILITY.equals(target.getType())) {
@@ -535,9 +547,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
return styleBits;
}
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
private void setStyleBits(final int mask, final boolean value) {
execute(ptr -> nativeSetNSWindowStyleBits(ptr, mask, value ? mask : 0));
setStyleBits(mask, value ? mask : 0);
}
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
private void setStyleBits(final int mask, final int value) {
execute(ptr -> nativeSetNSWindowStyleBits(ptr, mask, value));
}
private native void _toggleFullScreenMode(final long model);
@@ -681,23 +697,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
if (blocker == null || !visible) {
// If it ain't blocked, or is being hidden, go regular way
if (visible) {
contentView.execute(viewPtr -> {
execute(ptr -> CWrapper.NSWindow.makeFirstResponder(ptr,
viewPtr));
});
boolean isPopup = (target.getType() == Window.Type.POPUP);
execute(ptr -> {
if (isPopup) {
// Popups in applets don't activate applet's process
CWrapper.NSWindow.orderFrontRegardless(ptr);
} else {
CWrapper.NSWindow.orderFront(ptr);
}
boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(ptr);
if (!isKeyWindow) {
CWrapper.NSWindow.makeKeyWindow(ptr);
CWrapper.NSWindow.makeKeyAndOrderFront(ptr);
} else {
CWrapper.NSWindow.orderFront(ptr);
}
if (owner != null
@@ -890,8 +897,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public boolean rejectFocusRequest(FocusEvent.Cause cause) {
// Cross-app activation requests are not allowed.
if (cause != FocusEvent.Cause.MOUSE_EVENT &&
!((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
if (!synergyWorkaroundEnabled &&
(cause != FocusEvent.Cause.MOUSE_EVENT &&
!((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()))
{
focusLogger.fine("the app is inactive, so the request is rejected");
return true;
@@ -921,8 +929,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void updateFocusableWindowState() {
final boolean isFocusable = isNativelyFocusableWindow();
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, getFocusableStyleBits()); // set both bits at once
}
@Override
@@ -1124,13 +1131,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
/*************************************************************
* Callbacks from the AWTWindow and AWTView objc classes.
*************************************************************/
private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
// Fix for 7150349: ingore "gained" notifications when the app is inactive.
if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
focusLogger.fine("the app is inactive, so the notification is ignored");
return;
}
private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
responder.handleWindowFocusEvent(gained, oppositePeer);
}
@@ -1194,16 +1196,23 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
}
/*
* Our focus model is synthetic and only non-simple window
* may become natively focusable window.
*/
private boolean isNativelyFocusableWindow() {
if (peer == null) {
return false;
// returns a combination of SHOULD_BECOME_KEY/SHOULD_BECOME_MAIN relevant for the current window
private int getFocusableStyleBits() {
if (target == null || !target.getFocusableWindowState()) {
return 0;
}
return !peer.isSimpleWindow() && target.getFocusableWindowState();
boolean isDecoratedWindow = true;
Window window = target;
do {
if (window instanceof Frame || window instanceof Dialog) {
return isDecoratedWindow ? SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN : SHOULD_BECOME_KEY;
}
window = window.getOwner();
isDecoratedWindow = false;
} while (window != null);
return 0;
}
private boolean isBlocked() {
@@ -1217,8 +1226,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
* circumstances.
*/
private void updateFocusabilityForAutoRequestFocus(boolean isFocusable) {
if (target.isAutoRequestFocus() || !isNativelyFocusableWindow()) return;
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once
if (target.isAutoRequestFocus()) return;
int focusableStyleBits = getFocusableStyleBits();
if (focusableStyleBits == 0) return;
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN,
isFocusable ? focusableStyleBits : 0); // set both bits at once
}
private boolean checkBlockingAndOrder() {

View File

@@ -46,7 +46,6 @@ final class CWrapper {
static native void setLevel(long window, int level);
static native void makeKeyAndOrderFront(long window);
static native void makeKeyWindow(long window);
static native void makeMainWindow(long window);
static native boolean canBecomeMainWindow(long window);
static native boolean isKeyWindow(long window);

View File

@@ -1296,10 +1296,16 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
fprintf(stderr, "AWTView InputMethod Selector Called : [attributedSubstringFromRange] location=%lu, length=%lu\n", (unsigned long)theRange.location, (unsigned long)theRange.length);
#endif // IM_DEBUG
if (!fInputMethodLOCKABLE) {
return NULL;
}
static JNF_MEMBER_CACHE(jm_substringFromRange, jc_CInputMethod, "attributedSubstringFromRange", "(II)Ljava/lang/String;");
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject theString = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_substringFromRange, theRange.location, theRange.length); // AWT_THREADING Safe (AWTRunLoopMode)
if (!theString) {
return NULL;
}
id result = [[[NSAttributedString alloc] initWithString:JNFJavaToNSString(env, theString)] autorelease];
#ifdef IM_DEBUG
NSLog(@"attributedSubstringFromRange returning \"%@\"", result);

View File

@@ -233,7 +233,6 @@ AWT_NS_WINDOW_IMPLEMENTATION
if (IS(styleBits, UTILITY)) type |= NSUtilityWindowMask;
if (IS(styleBits, HUD)) type |= NSHUDWindowMask;
if (IS(styleBits, SHEET)) type |= NSDocModalWindowMask;
if (IS(styleBits, NONACTIVATING)) type |= NSNonactivatingPanelMask;
return type;
}
@@ -312,7 +311,6 @@ AWT_ASSERT_APPKIT_THREAD;
if (self == nil) return nil; // no hope
if (IS(bits, UTILITY) ||
IS(bits, NONACTIVATING) ||
IS(bits, HUD) ||
IS(bits, HIDES_ON_DEACTIVATE))
{
@@ -723,9 +721,7 @@ AWT_ASSERT_APPKIT_THREAD;
NSLog(@"became main: %d %@ %@", [self.nsWindow isKeyWindow], [self.nsWindow title], [self menuBarForWindow]);
#endif
if (![self.nsWindow isKeyWindow]) {
[self activateWindowMenuBar];
}
[self activateWindowMenuBar];
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
@@ -734,6 +730,18 @@ AWT_ASSERT_APPKIT_THREAD;
JNFCallVoidMethod(env, platformWindow, jm_windowDidBecomeMain);
(*env)->DeleteLocalRef(env, platformWindow);
}
[self orderChildWindows:YES];
}
- (void) windowDidResignMain: (NSNotification *) notification {
AWT_ASSERT_APPKIT_THREAD;
#ifdef DEBUG
NSLog(@"resigned main: %d %@ %@", [self.nsWindow isKeyWindow], [self.nsWindow title], [self menuBarForWindow]);
#endif
[self.javaMenuBar deactivate];
[self orderChildWindows:NO];
}
- (void) windowDidBecomeKey: (NSNotification *) notification {
@@ -745,13 +753,26 @@ AWT_ASSERT_APPKIT_THREAD;
AWTWindow *opposite = [AWTWindow lastKeyWindow];
if (![self.nsWindow isMainWindow]) {
[self activateWindowMenuBar];
[self makeRelevantAncestorMain];
}
[AWTWindow setLastKeyWindow:nil];
[self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
[self orderChildWindows:YES];
}
- (void) makeRelevantAncestorMain {
NSWindow *nativeWindow;
AWTWindow *awtWindow = self;
do {
nativeWindow = awtWindow.nsWindow;
if ([nativeWindow canBecomeMainWindow]) {
[nativeWindow makeMainWindow];
break;
}
awtWindow = awtWindow.ownerWindow;
} while (awtWindow);
}
- (void) activateWindowMenuBar {
@@ -795,15 +816,6 @@ AWT_ASSERT_APPKIT_THREAD;
#ifdef DEBUG
NSLog(@"resigned key: %d %@ %@", [self.nsWindow isMainWindow], [self.nsWindow title], [self menuBarForWindow]);
#endif
[self deactivateWindow];
}
- (void) deactivateWindow {
AWT_ASSERT_APPKIT_THREAD;
#ifdef DEBUG
NSLog(@"deactivating window: %@", [self.nsWindow title]);
#endif
[self.javaMenuBar deactivate];
// the new key window
NSWindow *keyWindow = [NSApp keyWindow];
@@ -812,7 +824,6 @@ AWT_ASSERT_APPKIT_THREAD;
[AWTWindow setLastKeyWindow: self];
[self _deliverWindowFocusEvent:NO oppositeWindow: opposite];
[self orderChildWindows:NO];
}
- (BOOL)windowShouldClose:(id)sender {
@@ -1090,7 +1101,7 @@ JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
if ([nsWindow isKeyWindow] || [nsWindow isMainWindow]) {
if ([nsWindow isMainWindow]) {
[window.javaMenuBar deactivate];
}
@@ -1101,7 +1112,7 @@ JNF_COCOA_ENTER(env);
actualMenuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
}
if ([nsWindow isKeyWindow] || [nsWindow isMainWindow]) {
if ([nsWindow isMainWindow]) {
[CMenuBar activate:actualMenuBar modallyDisabled:NO];
}
}];

View File

@@ -47,26 +47,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeKeyWindow
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow
(JNIEnv *env, jclass cls, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThread:@selector(makeKeyWindow)
on:window
withObject:nil
waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeMainWindow

View File

@@ -650,17 +650,18 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isCapsLockOn
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
(JNIEnv *env, jclass clazz)
{
__block jboolean active = JNI_FALSE;
__block jboolean active = JNI_FALSE;
AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:YES block:^() {
active = (jboolean)[NSRunningApplication currentApplication].active;
}];
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
active = (jboolean)[NSRunningApplication currentApplication].active;
}];
JNF_COCOA_EXIT(env);
return active;
return active;
}
/*

View File

@@ -217,6 +217,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
AWT_ASSERT_APPKIT_THREAD;
jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
[argValue removeAllObjects];
@@ -225,7 +226,11 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
if (sharedContext == NULL) {
if (glMask == 0) {
glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
}
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFAAllowOfflineRenderers,
@@ -236,17 +241,16 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize, 16,
NSOpenGLPFAScreenMask, glMask,
0
};
sharedPixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
if (sharedPixelFormat == nil) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
[argValue addObject: [NSNumber numberWithLong: 0L]];
return;
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
[argValue addObject: [NSNumber numberWithLong: 0L]];
return;
}
sharedContext =

View File

@@ -1368,10 +1368,6 @@ public class KeyEvent extends InputEvent {
return String.valueOf((char)keyCode);
}
if (keyCode > 0x0300 && keyCode < 0x0400) {
return sun.awt.event.KeyEvent.asciiCodeToString.get(keyCode);
}
switch(keyCode) {
case VK_ENTER: return Toolkit.getProperty("AWT.enter", "Enter");
case VK_BACK_SPACE: return Toolkit.getProperty("AWT.backSpace", "Backspace");

View File

@@ -1,12 +1,11 @@
package sun.awt.event;
import java.lang.annotation.Native;
import java.util.HashMap;
public class KeyEvent {
/** */
@Native
public static final int START_OF_LATIN_DIACRITIC_LETTERS = 0x0300;
public static final int START_OF_LATIN_DIACRITIC_LETTERS = 0x01000000;
/** */
public static final int VK_ESZETT = START_OF_LATIN_DIACRITIC_LETTERS + 0xDF;
@@ -74,42 +73,4 @@ public class KeyEvent {
public static final int VK_THORN = START_OF_LATIN_DIACRITIC_LETTERS + 0xFE;
/** */
public static final int VK_Y_WITH_DIAERESIS = START_OF_LATIN_DIACRITIC_LETTERS + 0xFF;
public static final HashMap<Integer, String> asciiCodeToString = new HashMap<Integer, String>() {
{
put(VK_ESZETT, "\u00DF");
put(VK_A_WITH_GRAVE, "\u00e0");
put(VK_A_WITH_ACUTE, "\u00e1");
put(VK_A_WITH_CIRCUMFLEX, "\u00e2");
put(VK_A_WITH_TILDE, "\u00e3");
put(VK_A_WITH_DIAERESIS, "\u00e4");
put(VK_A_WITH_RING_ABOVE, "\u00e5");
put(VK_AE, "\u00e6");
put(VK_C_WITH_CEDILLA, "\u00e7");
put(VK_E_WITH_GRAVE, "\u00e8");
put(VK_E_WITH_ACUTE, "\u00e9");
put(VK_E_WITH_CIRCUMFLEX, "\u00ea");
put(VK_E_WITH_DIAERESIS, "\u00eb");
put(VK_I_WITH_GRAVE, "\u00ec");
put(VK_I_WITH_ACUTE, "\u00ed");
put(VK_I_WITH_CIRCUMFLEX, "\u00ee");
put(VK_I_WITH_DIAERESIS, "\u00ef");
put(VK_ETH, "\u00f0");
put(VK_N_WITH_TILDE, "\u00f1");
put(VK_O_WITH_GRAVE, "\u00f2");
put(VK_O_WITH_ACUTE, "\u00f3");
put(VK_O_WITH_CIRCUMFLEX, "\u00f4");
put(VK_O_WITH_TILDE, "\u00f5");
put(VK_O_WITH_DIAERESIS, "\u00f6");
put(VK_DIVISION_SIGN, "\u00f7");
put(VK_O_WITH_SLASH, "\u00f8");
put(VK_U_WITH_GRAVE, "\u00f9");
put(VK_U_WITH_ACUTE, "\u00fa");
put(VK_U_WITH_CIRCUMFLEX, "\u00fb");
put(VK_U_WITH_DIAERESIS, "\u00fc");
put(VK_Y_WITH_ACUTE, "\u00fd");
put(VK_THORN, "\u00fe");
put(VK_Y_WITH_DIAERESIS, "\u00ff");
}
};
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (c) 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/*
* @test
* @bug 8238676
* @summary Check that attempting to use the JNI invocation API from an
* atexit handler fails as expected without crashing.
*
* @library /test/lib
* @run main/othervm/native TestAtExit
*/
public class TestAtExit {
// Using a nested class that invokes an enclosing method makes it
// easier to setup and use the native library.
static class Tester {
static {
System.loadLibrary("atExit");
}
// Record the fact we are using System.exit for termination
static native void setUsingSystemExit();
public static void main(String[] args) throws Exception {
if (args.length > 0) {
setUsingSystemExit();
System.exit(0);
}
}
}
public static void main(String[] args) throws Exception {
// We mustn't load Tester in this VM so we exec by name.
String main = "TestAtExit$Tester";
String jlp = "-Djava.library.path=" + System.getProperty("test.nativepath");
// First run will terminate via DestroyJavaVM
OutputAnalyzer output = ProcessTools.executeTestJvm(jlp, main);
output.shouldNotContain("Unexpected");
output.shouldHaveExitValue(0);
output.reportDiagnosticSummary();
// Second run will terminate via System.exit()
output = ProcessTools.executeTestJvm(jlp, main, "doExit");
output.shouldNotContain("Unexpected");
output.shouldHaveExitValue(0);
output.reportDiagnosticSummary();
}
}

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include "jni.h"
static JavaVM *jvm;
static const char* jni_error_code(int ret) {
switch(ret) {
case JNI_OK: return "JNI_OK";
case JNI_ERR: return "JNI_ERR";
case JNI_EDETACHED: return "JNI_EDETACHED";
case JNI_EVERSION: return "JNI_EVERSION";
case JNI_ENOMEM: return "JNI_ENOMEM";
case JNI_EEXIST: return "JNI_EEXIST";
case JNI_EINVAL: return "JNI_EINVAL";
default: return "Invalid JNI error code";
}
}
static void report(const char* func, int ret_actual, int ret_expected) {
const char* ret = jni_error_code(ret_actual);
if (ret_actual == ret_expected) {
printf("%s returned %s as expected\n", func, ret);
} else {
printf("Unexpected JNI return code %s from %s\n", ret, func);
}
}
static int using_system_exit = 0; // Not System.exit by default
JNIEXPORT
void JNICALL Java_TestAtExit_00024Tester_setUsingSystemExit(JNIEnv* env, jclass c) {
using_system_exit = 1;
}
void at_exit_handler(void) {
printf("In at_exit_handler\n");
// We've saved the JavaVM from OnLoad time so we first try to
// get a JNIEnv for the current thread.
JNIEnv *env;
jint res = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_2);
report("GetEnv", res, JNI_EDETACHED);
if (res == JNI_EDETACHED) {
// Test all of the Invocation API functions
res = (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, NULL);
report("AttachCurrentThreadAsDaemon", res, JNI_ERR);
res = (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);
report("AttachCurrentThread", res, JNI_ERR);
res = (*jvm)->DetachCurrentThread(jvm);
report("DetachCurrentThread", res, JNI_ERR);
JavaVMInitArgs args;
args.version = JNI_VERSION_1_2;
res = JNI_GetDefaultJavaVMInitArgs(&args);
report("JNI_GetDefaultJavaVMInitArgs", res, JNI_OK);
JavaVM* jvm_p[1];
int nVMs;
res = JNI_GetCreatedJavaVMs(jvm_p, 1, &nVMs);
report("JNI_GetCreatedJavaVMs", res, JNI_OK);
// Whether nVMs is 0 or 1 depends on the termination path
if (nVMs == 0 && !using_system_exit) {
printf("Found 0 created VMs as expected\n");
} else if (nVMs == 1 && using_system_exit) {
printf("Found 1 created VM as expected\n");
} else {
printf("Unexpected number of created VMs: %d\n", nVMs);
}
res = (*jvm)->DestroyJavaVM(jvm);
report("DestroyJavaVM", res, JNI_ERR);
// Failure mode depends on the termination path
res = JNI_CreateJavaVM(jvm_p, (void**)&env, &args);
report("JNI_CreateJavaVM", res, using_system_exit ? JNI_EEXIST : JNI_ERR);
}
// else test has already failed
}
JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM *vm, void *reserved) {
printf("JNI_OnLoad: registering atexit handler\n");
jvm = vm;
atexit(at_exit_handler);
return JNI_VERSION_1_1;
}

View File

@@ -0,0 +1,144 @@
/*
* Copyright 2000-2020 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.nio.file.Files;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
/**
* @test
* @summary Regression test for JBR-2533 Popup is not focused on click when switching from another application on macOS
* @key headful
*/
public class PopupIncomingFocusTest {
private static final CompletableFuture<Boolean> windowOpened = new CompletableFuture<>();
private static final CompletableFuture<Boolean> popupOpened = new CompletableFuture<>();
private static final CompletableFuture<Boolean> result = new CompletableFuture<>();
private static Robot robot;
private static Process otherProcess;
private static JFrame frame;
private static JButton button;
private static JWindow popup;
private static JTextField field;
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoWaitForIdle(true);
try {
launchProcessWithWindow();
SwingUtilities.invokeAndWait(PopupIncomingFocusTest::init);
windowOpened.get(10, TimeUnit.SECONDS);
clickAt(button);
popupOpened.get(10, TimeUnit.SECONDS);
clickAt(400, 100); // other process' window
clickAt(field);
pressEnter();
result.get(10, TimeUnit.SECONDS);
}
finally {
SwingUtilities.invokeAndWait(PopupIncomingFocusTest::shutdown);
}
}
private static void init() {
button = new JButton("Open popup");
button.addActionListener(e -> {
popup.setVisible(true);
});
frame = new JFrame();
frame.add(button);
frame.setBounds(50, 50, 200, 100);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
windowOpened.complete(Boolean.TRUE);
}
});
field = new JTextField(10);
field.getCaret().setBlinkRate(0); // prevent caret blink timer from keeping event thread running
field.addActionListener(e -> result.complete(Boolean.TRUE));
popup = new JWindow(frame);
popup.setType(Window.Type.POPUP);
popup.add(field);
popup.pack();
popup.setLocation(50, 200);
popup.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
popupOpened.complete(Boolean.TRUE);
}
});
frame.setVisible(true);
}
private static void shutdown() {
if (frame != null) frame.dispose();
if (otherProcess != null) otherProcess.destroyForcibly();
}
private static void clickAt(int x, int y) {
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
private static void clickAt(Component component) {
Point location = component.getLocationOnScreen();
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
}
private static void pressEnter() {
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
private static void launchProcessWithWindow() throws Exception {
String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
File tmpFile = File.createTempFile("PopupIncomingFocusTest", ".java");
tmpFile.deleteOnExit();
Files.writeString(tmpFile.toPath(), "import javax.swing.*;\n" +
"import java.awt.event.*;\n" +
"\n" +
"public class TestWindow {\n" +
" public static void main(String[] args) {\n" +
" SwingUtilities.invokeLater(() -> {\n" +
" JFrame f = new JFrame();\n" +
" f.addWindowListener(new WindowAdapter() {\n" +
" @Override\n" +
" public void windowOpened(WindowEvent e) {\n" +
" System.out.println();\n" +
" }\n" +
" });\n" +
" f.setBounds(300, 50, 200, 100);\n" +
" f.setVisible(true);\n" +
" });\n" +
" }\n" +
"}\n");
otherProcess = Runtime.getRuntime().exec(new String[]{javaPath, tmpFile.getAbsolutePath()});
if (otherProcess.getInputStream().read() == -1) {
throw new RuntimeException("Error starting process");
}
}
}

View File

@@ -1,20 +1,19 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
import com.jetbrains.cef.JCefAppConfig;
import org.cef.CefApp;
import org.cef.CefClient;
import org.cef.CefSettings;
import org.cef.handler.CefAppHandlerAdapter;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
/**
* @author Anton Tarasov
*/
public abstract class JBCefApp {
public class JBCefApp {
public static class OS {
public static final boolean WINDOWS;
public static final boolean LINUX;
@@ -37,15 +36,14 @@ public abstract class JBCefApp {
private static final AtomicBoolean ourInitialized = new AtomicBoolean(false);
private JBCefApp() {
private JBCefApp(JCefAppConfig config) {
if (!CefApp.startup(new String[]{})) {
throw new RuntimeException("JCEF startup failed!");
}
CefSettings settings = new CefSettings();
CefSettings settings = config.getCefSettings();
settings.windowless_rendering_enabled = false;
settings.log_severity = CefSettings.LogSeverity.LOGSEVERITY_ERROR;
String[] appArgs = applyPlatformSettings(settings);
CefApp.addAppHandler(new CefAppHandlerAdapter(appArgs) {
CefApp.addAppHandler(new CefAppHandlerAdapter(config.getAppArgs()) {
@Override
public void stateHasChanged(CefApp.CefAppState state) {
if (ourCefAppStateHandler != null) {
@@ -60,83 +58,18 @@ public abstract class JBCefApp {
public static JBCefApp getInstance() {
if (!ourInitialized.getAndSet(true)) {
if (OS.MAC) {
INSTANCE = new JBCefAppMac();
JCefAppConfig config = null;
try {
config = JCefAppConfig.getInstance();
}
else if (OS.LINUX) {
INSTANCE = new JBCefAppLinux();
}
else if (OS.WINDOWS) {
INSTANCE = new JBCefAppWindows();
}
else {
INSTANCE = null;
assert false : "JBCefApp platform initialization failed";
catch (Exception e) {
e.printStackTrace();
}
INSTANCE = config != null ? new JBCefApp(config) : null;
}
return INSTANCE;
}
protected abstract String[] applyPlatformSettings(CefSettings settings);
private static class JBCefAppMac extends JBCefApp {
@Override
protected String[] applyPlatformSettings(CefSettings settings) {
String ALT_CEF_FRAMEWORK_DIR = System.getenv("ALT_CEF_FRAMEWORK_DIR");
String ALT_CEF_HELPER_APP_DIR = System.getenv("ALT_CEF_HELPER_APP_DIR");
if (ALT_CEF_FRAMEWORK_DIR == null || ALT_CEF_HELPER_APP_DIR == null) {
String CONTENTS_PATH = System.getProperty("java.home") + "/..";
if (ALT_CEF_FRAMEWORK_DIR == null) {
ALT_CEF_FRAMEWORK_DIR = CONTENTS_PATH + "/Frameworks/Chromium Embedded Framework.framework";
}
if (ALT_CEF_HELPER_APP_DIR == null) {
ALT_CEF_HELPER_APP_DIR = CONTENTS_PATH + "/Frameworks/jcef Helper.app";
}
}
return new String[] {
"--framework-dir-path=" + normalize(ALT_CEF_FRAMEWORK_DIR),
"--browser-subprocess-path=" + normalize(ALT_CEF_HELPER_APP_DIR + "/Contents/MacOS/jcef Helper"),
"--main-bundle-path=" + normalize(ALT_CEF_HELPER_APP_DIR),
"--disable-in-process-stack-traces"
};
}
// CEF does not accept ".." in path
static String normalize(String path) {
try {
return new File(path).getCanonicalPath();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private static class JBCefAppWindows extends JBCefApp {
@Override
protected String[] applyPlatformSettings(CefSettings settings) {
String JCEF_PATH = System.getProperty("java.home") + "/bin";
settings.resources_dir_path = JCEF_PATH;
settings.locales_dir_path = JCEF_PATH + "/locales";
settings.browser_subprocess_path = JCEF_PATH + "/jcef_helper";
return null;
}
}
private static class JBCefAppLinux extends JBCefApp {
@Override
protected String[] applyPlatformSettings(CefSettings settings) {
String JCEF_PATH = System.getProperty("java.home") + "/lib";
settings.resources_dir_path = JCEF_PATH;
settings.locales_dir_path = JCEF_PATH + "/locales";
settings.browser_subprocess_path = JCEF_PATH + "/jcef_helper";
double scale = sysScale();
System.setProperty("jcef.forceDeviceScaleFactor", Double.toString(scale));
return new String[] {
"--force-device-scale-factor=" + scale
};
}
}
public CefClient createClient() {
return myCefApp.createClient();
}

View File

@@ -201,6 +201,7 @@ java/awt/Frame/DisposeParentGC/DisposeParentGC.java
java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java 8198237 macosx-all
java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all
java/awt/Frame/FrameLocation/FrameLocation.java 8019803 macosx-all
java/awt/Frame/HugeFrame/HugeFrame.java JBR-2563 linux-all
java/awt/Frame/InvisibleOwner/InvisibleOwner.java 8169111 macosx-all,windows-all
java/awt/Frame/LayoutOnMaximizeTest/LayoutOnMaximizeTest.java 8169472 windows-all
java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all