Compare commits

..

92 Commits
156 ... 236

Author SHA1 Message Date
Vitaly Provodin
b2cbcbeeef add exclude list for Scale2 test runs 2021-12-17 15:22:18 +07:00
Vitaly Provodin
aba2a258bb exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java due to 8134231 2021-12-17 15:22:15 +07:00
Vladimir Dvorak
53c9198350 JBR-3167 update os.version for tests crashing GNOME on Ubuntu-21.04 2021-12-15 10:21:54 +07:00
Prasanta Sadhukhan
e27b2fbf84 8272232: javax/swing/JTable/4275046/bug4275046.java failed with "Expected value in the cell: 'rededited' but found 'redEDITED'."
8257540: javax/swing/JFileChooser/8041694/bug8041694.java failed with "RuntimeException: The selected directory name is not the expected 'd ' but 'D '."

Reviewed-by: serb
(cherry picked from commit cec6c068b0)
2021-12-13 10:37:53 +07:00
Vitaly Provodin
a5c9a208ed enable fixed hotspot tests to regular runs 2021-12-11 08:24:07 +07:00
Leonid Mesnik
86b93a57af 8225313: serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatObjectCorrectnessTest.java failed with Unexpected high difference percentage
Reviewed-by: dholmes, kevinw

(cherry picked from commit 09e5321763)
2021-12-11 08:21:52 +07:00
Vitaly Provodin
c838f55dd9 enable fixed tests to regular runs 2021-12-11 06:52:53 +07:00
Alexander Zuev
8d188ad27f 8017175: [TESTBUG] javax/swing/JPopupMenu/4634626/bug4634626.java sometimes failed on mac
Reviewed-by: serb
(cherry picked from commit 4c3491bfa5)
2021-12-11 06:47:13 +07:00
Alexander Zuev
d87fc06c41 8268284: javax/swing/JComponent/7154030/bug7154030.java fails with "Exception: Failed to hide opaque button"
Reviewed-by: serb
(cherry picked from commit 534f00510e)
2021-12-11 06:46:08 +07:00
Naoto Sato
b17c748949 7008363: TEST_BUG: test/java/lang/StringCoding/CheckEncodings.sh does nothing and is very slow at that
Reviewed-by: iris, lancea, bpb, whuang
(cherry picked from commit 8a3e0a1fc1)
2021-12-11 06:44:15 +07:00
Alexander Zvegintsev
03783189d0 8233648: [TESTBUG] DefaultMenuBarTest.java failing on macos
Reviewed-by: pbansal, serb, psadhukhan, prr
(cherry picked from commit 46b5bfbc38)
2021-12-11 06:43:21 +07:00
Alisen Chung
05fbf8507c 8233558: [TESTBUG] WindowOwnedByEmbeddedFrameTest.java fails on macos
Reviewed-by: serb, kizune, prr
(cherry picked from commit d1e3ca4ee3)
2021-12-11 06:41:56 +07:00
Jayathirth D V
80de7efe15 8213120: java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java fails on mac10.13
Reviewed-by: psadhukhan

(cherry picked from commit 2f979ecb5b)
2021-12-11 06:40:20 +07:00
Alexander Zuev
6d1add0393 8169468: NoResizeEventOnDMChangeTest.java fails because FS Window didn't receive all resizes!
Reviewed-by: serb

(cherry picked from commit b0a463fa59)
2021-12-11 06:39:03 +07:00
Jayathirth D V
f57241bcf8 8255898: Test java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java fails on Mac OS
Reviewed-by: prr, serb
(cherry picked from commit 947d52c4c3)
2021-12-11 06:36:28 +07:00
Alexander Zuev
3fca5bee90 8202667: java/awt/Debug/DumpOnKey/DumpOnKey.java times out on Windows
Reviewed-by: prr
(cherry picked from commit cd778f5b04)
2021-12-11 06:35:00 +07:00
Jayathirth D V
60330c9b3e 8255724: [XRender] the BlitRotateClippedArea test fails on Linux in the XR pipeline
Reviewed-by: psadhukhan
(cherry picked from commit dcd6e0da24)
2021-12-11 06:30:30 +07:00
Phil Race
4a16c3b8c8 8192931: Regression test java/awt/font/TextLayout/CombiningPerf.java fails
Reviewed-by: serb, jdv, kizune
(cherry picked from commit 54a29a4470)
2021-12-11 06:26:37 +07:00
Alexander Zvegintsev
2ece56c057 8196440: Regression automated Test 'java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java' fails
Reviewed-by: serb, psadhukhan
(cherry picked from commit f610ef0dbc)
2021-12-11 06:23:54 +07:00
Alexander Zuev
c3a506172b 8196017: java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java fails
Reviewed-by: serb
(cherry picked from commit b7104ba9a9)
2021-12-11 06:23:19 +07:00
Alexander Zvegintsev
c81d4030eb 6854300: [TEST_BUG] java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java fails in jdk6u14 & jdk7
Reviewed-by: serb
(cherry picked from commit a1ec4f9618)
2021-12-11 06:21:28 +07:00
Alexander Zuev
32fb930e85 8168388: GetMousePositionTest fails with the message "Mouse position should not be null"
Reviewed-by: psadhukhan, serb
(cherry picked from commit 0c3eaea11c)
2021-12-11 06:18:53 +07:00
Pankaj Bansal
0ef1d9a4a9 8198626: java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html fails on mac
Reviewed-by: serb
(cherry picked from commit a60e91259b)
2021-12-11 06:18:21 +07:00
Vitaly Provodin
07ee0a2471 exclude javax/swing tests on mac-aarch64 due to 8277816 2021-12-11 05:48:20 +07:00
Aleksandr Veselov
c4cb87ff06 JBR-4107 A11y: macOS - wrong frame position if window is not on primary screen 2021-12-10 18:26:06 +03:00
Alexander Lobas
6b36a9227d JBR-3442 Native file dialog on OSX (for open file) doesn't allow pasting path
(cherry-picked from commit 7d8cc524ca)
2021-12-10 07:28:14 +07:00
Vitaly Provodin
83ca27f8b2 exclude javax/swing/border/TestTitledBorderLeak.java on windows due to 8213531 2021-12-10 05:23:35 +07:00
Maxim Kartashev
c539ca4ddf fixup! JBR-4061 Specify build user for the build
Specify build user via the environment variable rather than the
configure option because the latter isn't supported for OpenJDK17u.
2021-12-09 09:31:09 +03:00
Mandy Chung
51ec2c610e JBR-4062 8276650: GenGraphs does not produce deterministic output
Reviewed-by: iris
(cherry picked from commit e21b5c7b37)
2021-12-08 16:44:46 +03:00
Jaikiran Pai
2b8ee942e0 JBR-4062 8258117: jar tool sets the time stamp of module-info.class entries to the current time
Reviewed-by: lancea, ihse, alanb
(cherry picked from commit a81e4fc07b)
2021-12-08 16:31:20 +03:00
Andrew Leonard
9b17148ef4 JBR-4062 8276764: Enable deterministic file content ordering for Jar and Jmod
Reviewed-by: mchung, ihse
(cherry picked from commit 24e586a043)
2021-12-08 15:10:06 +03:00
Magnus Ihse Bursie
02289f478f JBR-4062 8277069: [REDO] JDK-8276743 Make openjdk build Zip Archive generation "reproducible"
Co-authored-by: Andrew Leonard <aleonard@openjdk.org>
Co-authored-by: Magnus Ihse Bursie <ihse@openjdk.org>
Reviewed-by: erikj
(cherry picked from commit c93552c8bb)
2021-12-08 14:55:59 +03:00
Vitaly Provodin
2f0eb2bba8 JBR-4067 fix misprint with applying obsolete exclude_jcef_module.patch 2021-12-08 15:17:32 +07:00
Vitaly Provodin
740bf2b3e5 JBR-3756 remove JNF from mac-aarch64 binaries 2021-12-08 15:17:32 +07:00
Denis Fokin
88d7361bd9 JBR-4038 [JBR17] Force Touch events are not supported on macOS
Added missing files and handlers from JBR11
2021-12-07 19:31:12 +01:00
Dmitry Batrak
87c6482c0e JBR-4084 Default font '. AppleSystemUIFont' does not have bold weight on Chinese characters
(cherry picked from commit 4fde082d53)
2021-12-06 19:22:24 +03:00
Maxim Kartashev
b2a9372d70 JBR-3899 SIGSEGV at [libjvm] _ZN23JfrNetworkInterfaceName11on_rotationEv
Prevent JfrNetworkInterfaceName::on_rotation() to dereference a
potentially NULL pointer.
2021-12-06 19:03:53 +03:00
Dmitry Batrak
d0d8a63e0b JBR-4072 Migrate font fallback implementation on macOS to cascade lists
(cherry picked from commit a155760e94)
2021-12-06 17:59:44 +03:00
Maxim Kartashev
09c200ccfd fixup! JBR-3833 ServerSocketChannel.open(StandardProtocolFamily.UNIX) fails with IAE with non-standard filesystems on JBR17
Windows implementation of PipeImpl (that is used in the
ServerSockerChannel implementation) probes for the availability of Unix
Domain Sockets by trying to bind to a unique temporary name.  That call
throws IAE when a non-default Java file system is installed while the
probing code (PipeImpl.createListener()) only expects
UnsupportedOperationException or IOException.

The fix is to re-throw UOE instead of IAE in
UnixDomainSockets.genrateTempName(). This is more consistent with the
definition of the excpetion purpose ("requested operation is not
supported"). So with this change, a loopback network socket will be used
to implement a pipe on a non-default Java file system. Also, pipes do
not rely on the default Java file system on other platforms (Linux,
MacOS) as well.
2021-12-06 11:44:54 +03:00
Vitaly Provodin
42a22e0cc4 JBR-4082 create JBR & JBRSDK installer packages 2021-12-06 05:16:12 +07:00
Artem Semenov
71d54051d2 JBR-4012 On Idea Vo often speeks selected element of tables, lists, and trees. 2021-12-03 13:57:07 +03:00
Alexey Ushakov
d4fc6bc380 JBR-4060 [JBR17+Metal] Flickering on button's shadow
Removed unnecessary global flag. Optimized mask cache texture clearing code.
2021-12-03 01:38:41 +01:00
Vitaly Provodin
1e1f71f907 exclude failing tests #198.2 cycle 2021-12-03 07:24:05 +07:00
Prasanta Sadhukhan
6d26c9353f 8273578: javax/swing/JMenu/4515762/bug4515762.java fails on macOS 12
Reviewed-by: jdv, serb

(cherry picked from commit 45adc9227a)
2021-12-03 07:24:05 +07:00
Alexander Zvegintsev
adabf8c677 8202932: java/awt/Component/NativeInLightShow/NativeInLightShow.java fails
Reviewed-by: serb
(cherry picked from commit 7cf68b1901)
2021-12-03 04:40:30 +07:00
Maxim Kartashev
5e0ec47ce9 JBR-4061 Specify build user for the build 2021-12-02 08:56:21 +03:00
Andrew Leonard
9ec9457d8b JBR-4062 8277762: Allow configuration of HOTSPOT_BUILD_USER
Reviewed-by: erikj
2021-12-02 08:29:16 +03:00
Maxim Kartashev
e1a1b6814d JBR-4063 macOS: update build scripts to produce more deterministic output
Make mkimages.sh produce more deterministic .tar.gz archives on MacOS.
NB: build notarization is not in the scope of this change.
2021-12-01 14:33:59 +03:00
Maxim Kartashev
944797005c JBR-4033 Linux: update build scripts to produce more deterministic output
This commits achieves almost the same build output with the same build
input on Linux. Exceptions are:
- class files timestamps differ in jrt-fs.jar (for all output),
- class files timestamps differ in all the jmod files (for
  jbrsdk...tar.gz).
NB: jbrsdk...test...tar.gz does not need to be deterministic.

This was achieved mainly by
- setting several environment variables (SOURCE_DATE_EPOCH, TZ),
- providing the necessary options to the configure script,
- setting the timestamp of all files that make up the resulting
  archive to SORUCE_DATE_EPOCH and normalizing the list of said
  files before archiving.
2021-12-01 14:33:59 +03:00
Ioi Lam
507f4d716a JBR-4032 8273092: Sort classlist in JDK image
NB: this commit has been adopted for version 17.

Reviewed-by: redestad, ihse, dfuchs
(based on commit 1996f649a3)
2021-12-01 14:33:59 +03:00
Ioi Lam
67c24c9b88 JBR-4032 8272113: Build compare script fails with differences in classlist
Reviewed-by: tschatzl, hseigel
(cherry picked from commit 272fcb423a)
2021-12-01 14:33:59 +03:00
Andrew Leonard
2ef4de692d JBR-4032 8276654: element-list order is non deterministic
Reviewed-by: ihse
(cherry picked from commit 14d66bd438)
2021-12-01 14:33:59 +03:00
Jaikiran Pai
f20b2dca0f JBR-4032 8231640: (prop) Canonical property storage
Reviewed-by: rriggs, smarks, dfuchs, ihse
(cherry picked from commit af50772d39)
2021-12-01 14:33:59 +03:00
Maxim Kartashev
0b9397cf4c JBR-4032 Correct reproducible builds documentation 2021-12-01 14:33:59 +03:00
Magnus Ihse Bursie
392cf1c31a JBR-4032 8275745: Reproducible copyright headers
Reviewed-by: ihse, erikj
(cherry picked from commit a0227965bb)
2021-12-01 14:33:59 +03:00
Magnus Ihse Bursie
b269750318 JBR-4032 8276746: Add section on reproducible builds in building.md
Reviewed-by: erikj, sgehwolf, aleonard
(cherry picked from commit 59c3dcc761)
2021-12-01 14:33:58 +03:00
Jaikiran Pai
0676b50884 JBR-4032 8275509: ModuleDescriptor.hashCode isn't reproducible across builds
Reviewed-by: alanb, ihse
(cherry picked from commit 396132ff1e)
2021-12-01 14:33:58 +03:00
Maxim Kartashev
4df6fbd251 JBR-4059 Create Dockerfile for building on AArch64 Linux 2021-12-01 08:27:52 +03:00
bobpengxie
006cd74964 8274293: Build failure on macOS with Xcode 13.0 as vfork is deprecated
Reviewed-by: alanb, stuefe, rriggs
(cherry picked from commit 252aaa9249)
2021-11-30 09:19:46 +01:00
Alexey Ushakov
57289a0ad5 8272392 Lanai: SwingSet2. Black background on expanding tree node
Removed creation of the separate encoder depending on destination properties as we don't use this info to customize the encoder properties
Fixed incorrect addition of the values into pipeline state cache. Refactored index initialization. Removed unused flags from MTLClip.
2021-11-26 14:02:58 +01:00
Dmitry Batrak
4916d26f47 JBR-4021 Unexpected focus event order on window showing
(cherry picked from commit 2a398ebb24)
2021-11-24 09:47:53 +03:00
Nikita Gubarkov
2daed21814 JBR-4017 Open com.jetbrains.bootstrap package only for reflection 2021-11-23 11:22:08 +03:00
Ivan Lopatin
d99872c962 IDEA-229577: Marked i3wm as GravityBuggy 2021-11-22 21:21:05 +07:00
Maxim Kartashev
ae5963a094 JBR-4020 Test ObsoleteFlagErrorMessage fails after +IgnoreUnrecognizedVMOptions has become the default 2021-11-22 11:12:32 +03:00
Maxim Kartashev
9d8433f220 JBR-3923 Internal Error in c1_Instruction.cpp
Make C1 hotspot compiler bail out during CFG construction if there's a
cycle in the graph that isn't a natural loop and that has led to an
unexpected state of stack/locals like missing a phi function.

This is a temporary measure that lets hotspot continue working
even after encountering such bytecode patterns. The full solution
will probably involve more sophisticated CFG checks.

(cherry picked from commit aa0b61cb75)
2021-11-22 10:05:53 +03:00
Artem Semenov
2f4a7f66ab JBR-3868 Combobox list is not voiced of VoiceOver 2021-11-18 20:01:34 +03:00
Jayathirth D V
28289bcf00 JBR-3908 8276905: Use appropriate macosx_version_minimum value while compiling metal shaders
Reviewed-by: ihse, kcr, erikj, prr
(cherry picked from commit 9a9a157a7d)
2021-11-17 04:25:27 +07:00
Dmitry Batrak
71597c1b0e JBR-4007 [JCK] javax.swing.text.GlyphView.calcBreakSpots method breaks public API
(cherry picked from commit 1002eff4f3)
2021-11-16 19:52:25 +03:00
Dmitry Batrak
80efac6e25 JBR-4006 [JCK] javax.swing.text.html.CSS$Attribute.OVERFLOW_WRAP field breaks public API
(cherry picked from commit f20a3d8679)
2021-11-16 19:21:32 +03:00
Dmitry Batrak
641688b88a JBR-4005 [JCK] java.awt.Font.LAYOUT_NO_PAIRED_CHARS_AT_SCRIPT_SPLIT field breaks public API
(cherry picked from commit 961e036158)
2021-11-16 16:44:50 +03:00
Vitaly Provodin
b6699ce7a2 update the link to JBR17 for IDEA 2021.3 EAP 2021-11-16 04:26:13 +07:00
Dmitry Batrak
cf7d0ecb1f JBR-3989 Broken focus state after a quick succession of activation/deactivation events on Windows
(cherry picked from commit cafb374afc)
2021-11-15 16:08:52 +03:00
Alexey Ushakov
93fe26f579 JBR-3954 Transparent text color rendering (needed for experimental UI)
Performed conversion from ARGB_PRE to ARGB in the grayscale text shader
2021-11-11 20:06:45 +01:00
Dmitry Batrak
f4ecc22b1b JBR-3979 Focus is not transferred to parent window
(cherry picked from commit 25e087d269)
2021-11-11 09:58:53 +03:00
Nikita Gubarkov
290f700127 JBR-3982 Fixed non-antialiased text rendering on macOS 2021-11-11 01:27:46 +03:00
Vitaly Provodin
acdb9fccbd update the link to JBR17 for IDEA 2021.3 EAP 2021-11-11 04:19:31 +07:00
Nikita Gubarkov
1e79cf4924 JBR-3976 fix emoji scaling on macOS 2021-11-10 15:49:48 +03:00
Nikita Gubarkov
00ce50d5d9 JBR-3957 Disable hinting when retrieving outline via freetype and fix negative bounds size for text rotated by 180 degrees. 2021-11-10 13:54:10 +03:00
Vitaly Provodin
17acd28d7c JBR-3937 Fix crashes in C1/C2 compilers &
G1 fixes, code cleanup &
JBR-3867 fix dcevm redefinition stops due the not updated weak oops
2021-11-10 06:54:16 +07:00
Nikita Gubarkov
c6f3522d16 fixup! JBR-2135 Use CoreText api to select the font with the most recent version 2021-11-09 14:11:59 +03:00
Nikita Gubarkov
8b35a7e88c JBR-2917 disable GDI rendering on Windows for colored fonts & select glyph rendering loop depending on actual glyph format instead of antialiasing mode
JBR-3951 Pass real glyph type from native code instead of guessing it by rowBytes & width
2021-11-09 14:11:58 +03:00
Pavel
6e15088b7e JBR-3926 make AwtComponent transparent for hit events by default
* JBR-3926 make AwtComponent transparent for hit events by default

* [WIP] pass hittest event to frame only if custom decoration is enabled and frame ready to handle it
(cherry picked from commit c0e26ff5d5)
2021-11-08 17:11:48 +03:00
Vitaly Provodin
3a0d06b873 update the link to JBR17 for IDEA 2021.3 EAP 2021-11-08 12:32:21 +07:00
Vitaly Provodin
531f97d905 JBR-3908 add MACOSX_VERSION_MAX parameter into cofnigure 2021-11-06 09:34:49 +07:00
Vitaly Provodin
32a8087610 exclude java/awt/Window/GetScreenLocation/GetScreenLocationTest.java & java/awt/image/multiresolution/MultiresolutionIconTest.java on linux-aarch64 2021-11-05 17:56:34 +07:00
Sergey Bylokhov
0cd0b7ff8e 8273638: javax/swing/JTable/4235420/bug4235420.java fails in GTK L&F
Reviewed-by: pbansal, psadhukhan, azvegint
(cherry picked from commit 6cf70f5f08)
2021-11-05 09:04:41 +07:00
Vitaly Provodin
4bdaf472a8 exclude java/awt/Graphics2D/CopyAreaOOB.java on linux-all due to 7001973 2021-11-04 09:08:21 +07:00
Alexey Ushakov
8ba4251ad5 JBR-3952 [bkp JBR17] JBR-3924 CMD+Tilda does not switch app windows
Introduced vm property to disable capturing of next app window shortcut
2021-11-03 15:14:15 +01:00
Nikita Gubarkov
2d029761c2 fixup! JBR-2917 Added emoji support for Windows 2021-11-03 00:03:30 +03:00
Nikita Gubarkov
91a5488284 JBR-2917 Added emoji support for Windows 2021-11-02 21:48:21 +03:00
Nikita Gubarkov
49536a0988 JBR-3915 Fix comment about subpixel glyph resolution in freetype implementation 2021-11-02 21:48:12 +03:00
Ivan Lopatin
3641a3d262 JBR-3388: Fixed wrong graphic config in Component on primary display change 2021-11-01 23:19:21 +07:00
213 changed files with 4622 additions and 2076 deletions

View File

@@ -11,7 +11,7 @@ can be found on the [releases page](https://github.com/JetBrains/JetBrainsRuntim
| IDE Version | Latest JBR | Date Released |
| --- | --- | --- |
| 2021.3 | [17-b106.1](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17b106.1) | 28-Sep-2021 |
| 2021.3 | [17_0_1-b164.8](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17_0_1b164.8) | 15-Nov-2021 |
## Contents
- [Welcome to JetBrains Runtime](#jetbrains-runtime)

View File

@@ -96,6 +96,7 @@
<li><a href="#specific-build-issues">Specific Build Issues</a></li>
<li><a href="#getting-help">Getting Help</a></li>
</ul></li>
<li><a href="#reproducible-builds">Reproducible Builds</a></li>
<li><a href="#hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</a><ul>
<li><a href="#bash-completion">Bash Completion</a></li>
<li><a href="#using-multiple-configurations">Using Multiple Configurations</a></li>
@@ -884,6 +885,32 @@ spawn failed</code></pre>
<h3 id="getting-help">Getting Help</h3>
<p>If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to <a href="mailto:build-dev@openjdk.java.net">build-dev@openjdk.java.net</a>. Please include the relevant parts of the configure and/or build log.</p>
<p>If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
<h2 id="reproducible-builds">Reproducible Builds</h2>
<p>Build reproducibility is the property of getting exactly the same bits out when building, every time, independent on who builds the product, or where. This is for many reasons a harder goal than it initially appears, but it is an important goal, for security reasons and others. Please see <a href="https://reproducible-builds.org">Reproducible Builds</a> for more information about the background and reasons for reproducible builds.</p>
<p>Currently, it is not possible to build OpenJDK fully reproducibly, but getting there is an ongoing effort. There are some things you can do to minimize non-determinism and make a larger part of the build reproducible:</p>
<ul>
<li>Turn on build system support for reproducible builds</li>
</ul>
<p>Add the flag <code>--enable-reproducible-build</code> to your <code>configure</code> command line. This will turn on support for reproducible builds where it could otherwise be lacking.</p>
<ul>
<li>Do not rely on <code>configure</code>'s default adhoc version strings</li>
</ul>
<p>Default adhoc version strings OPT segment include user name, source directory and timestamp. You can either override just the OPT segment using <code>--with-version-opt=&lt;any fixed string&gt;</code>, or you can specify the entire version string using <code>--with-version-string=&lt;your version&gt;</code>.</p>
<ul>
<li>Specify how the build sets <code>SOURCE_DATE_EPOCH</code></li>
</ul>
<p>The JDK build system will set the <code>SOURCE_DATE_EPOCH</code> environment variable during building, depending on the value of the <code>--with-source-date</code> option for <code>configure</code>. The default value is <code>updated</code>, which means that <code>SOURCE_DATE_EPOCH</code> will be set to the current time each time you are running <code>make</code>.</p>
<p>The <a href="https://reproducible-builds.org/docs/source-date-epoch/"><code>SOURCE_DATE_EPOCH</code> environment variable</a> is an industry standard, that many tools, such as gcc, recognize, and use in place of the current time when generating output.</p>
<p>For reproducible builds, you need to set this to a fixed value. You can use the special value <code>version</code> which will use the nominal release date for the current JDK version, or a value describing a date, either an epoch based timestamp as an integer, or a valid ISO-8601 date.</p>
<p><strong>Hint:</strong> If your build environment already sets <code>SOURCE_DATE_EPOCH</code>, you can propagate this using <code>--with-source-date=$SOURCE_DATE_EPOCH</code>.</p>
<ul>
<li>Specify a hotspot build time</li>
</ul>
<p>Set a fixed hotspot build time. This will be included in the hotspot library (<code>libjvm.so</code> or <code>jvm.dll</code>) and defaults to the current time when building hotspot. Use <code>--with-hotspot-build-time=&lt;any fixed string&gt;</code> for reproducible builds. It's a string so you don't need to format it specifically, so e.g. <code>n/a</code> will do. Another solution is to use the <code>SOURCE_DATE_EPOCH</code> variable, e.g. <code>--with-hotspot-build-time=$(date --date=@$SOURCE_DATE_EPOCH)</code>.</p>
<ul>
<li>Copyright year</li>
</ul>
<p>The copyright year in some generated text files are normally set to the current year. This can be overridden by <code>--with-copyright-year=&lt;year&gt;</code>. For fully reproducible builds, this needs to be set to a fixed value.</p>
<h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</h2>
<h3 id="bash-completion">Bash Completion</h3>
<p>The <code>configure</code> and <code>make</code> commands tries to play nice with bash command-line completion (using <code>&lt;tab&gt;</code> or <code>&lt;tab&gt;&lt;tab&gt;</code>). To use this functionality, make sure you enable completion in your <code>~/.bashrc</code> (see instructions for bash in your operating system).</p>

View File

@@ -1503,6 +1503,68 @@ If you need general help or advice about developing for the JDK, you can also
contact the Adoption Group. See the section on [Contributing to OpenJDK](
#contributing-to-openjdk) for more information.
## Reproducible Builds
Build reproducibility is the property of getting exactly the same bits out when
building, every time, independent on who builds the product, or where. This is
for many reasons a harder goal than it initially appears, but it is an important
goal, for security reasons and others. Please see [Reproducible Builds](
https://reproducible-builds.org) for more information about the background and
reasons for reproducible builds.
Currently, it is not possible to build OpenJDK fully reproducibly, but getting
there is an ongoing effort. There are some things you can do to minimize
non-determinism and make a larger part of the build reproducible:
* Turn on build system support for reproducible builds
Add the flag `--enable-reproducible-build` to your `configure` command line.
This will turn on support for reproducible builds where it could otherwise be
lacking.
* Do not rely on `configure`'s default adhoc version strings
Default adhoc version strings OPT segment include user name, source directory
and timestamp. You can either override just the OPT segment using
`--with-version-opt=<any fixed string>`, or you can specify the entire version
string using `--with-version-string=<your version>`.
* Specify how the build sets `SOURCE_DATE_EPOCH`
The JDK build system will set the `SOURCE_DATE_EPOCH` environment variable
during building, depending on the value of the `--with-source-date` option for
`configure`. The default value is `updated`, which means that
`SOURCE_DATE_EPOCH` will be set to the current time each time you are running
`make`.
The [`SOURCE_DATE_EPOCH` environment variable](
https://reproducible-builds.org/docs/source-date-epoch/) is an industry
standard, that many tools, such as gcc, recognize, and use in place of the
current time when generating output.
For reproducible builds, you need to set this to a fixed value. You can use the
special value `version` which will use the nominal release date for the current
JDK version, or a value describing a date, either an epoch based timestamp as an
integer, or a valid ISO-8601 date.
**Hint:** If your build environment already sets `SOURCE_DATE_EPOCH`, you can
propagate this using `--with-source-date=$SOURCE_DATE_EPOCH`.
* Specify a hotspot build time
Set a fixed hotspot build time. This will be included in the hotspot library
(`libjvm.so` or `jvm.dll`) and defaults to the current time when building
hotspot. Use `--with-hotspot-build-time=<any fixed string>` for reproducible
builds. It's a string so you don't need to format it specifically, so e.g. `n/a`
will do. Another solution is to use the `SOURCE_DATE_EPOCH` variable, e.g.
`--with-hotspot-build-time=$(date --date=@$SOURCE_DATE_EPOCH)`.
* Copyright year
The copyright year in some generated text files are normally set to the current
year. This can be overridden by `--with-copyright-year=<year>`. For fully
reproducible builds, this needs to be set to a fixed value.
## Hints and Suggestions for Advanced Users
### Bash Completion

View File

@@ -0,0 +1,47 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_aarch64.sh script.
# Pull a concrete version of Linux that does NOT recieve updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
FROM arm64v8/ubuntu:focal-20211006
# Install the necessary build tools
RUN export DEBIAN_FRONTEND=noninteractive \
export DEBCONF_NONINTERACTIVE_SEEN=true && \
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
apt-get update -qy && \
apt-get install -qy \
autoconf \
build-essential \
bzip2 \
file \
g++-10=10.3.0-1ubuntu1~20.04 \
gcc-10=10.3.0-1ubuntu1~20.04 \
git \
libasound2-dev \
libcups2-dev \
libfontconfig1-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxrender-dev \
libxt-dev \
libxtst-dev \
make \
tar \
unzip \
zip && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
apt-get clean -qy && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set up boot JDK for building
COPY boot_jdk.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk.tar.gz && rm /jdk17/boot_jdk.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -0,0 +1,26 @@
#!/bin/bash -x
# This script creates a Docker image suitable for building AArch64 variant
# of the JetBrains Runtime version 17.
BOOT_JDK_REMOTE_FILE=zulu17.30.15-ca-jdk17.0.1-linux_aarch64.tar.gz
BOOT_JDK_SHA=4d9c9116eb0cdd2d7fb220d6d27059f4bf1b7e95cc93d5512bd8ce3791af86c7
BOOT_JDK_LOCAL_FILE=boot_jdk.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jbr17buildenv -f Dockerfile.aarch64 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -6,6 +6,38 @@ do_reset_changes=0
do_reset_dcevm=0
HEAD_REVISION=0
OS_NAME=$(uname -s)
# Enable reproducible builds
TZ=UTC
export TZ
SOURCE_DATE_EPOCH="$(git log -1 --pretty=%ct)"
export SOURCE_DATE_EPOCH
USER=builduser
export USER
case "$OS_NAME" in
Linux)
COPYRIGHT_YEAR="$(date --utc --date=@$SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date --utc --date=@$SOURCE_DATE_EPOCH +%F)"
REPRODUCIBLE_TAR_OPTS="--mtime=@$SOURCE_DATE_EPOCH --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
;;
Darwin)
COPYRIGHT_YEAR="$(date -u -r $SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%F)"
TOUCH_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%Y%m%d%H%M.%S)"
REPRODUCIBLE_TAR_OPTS="--uid 0 --gid 0 --numeric-owner"
;;
*)
# TODO: Windows
;;
esac
REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build
--with-source-date=$SOURCE_DATE_EPOCH
--with-hotspot-build-time=$BUILD_TIME
--with-copyright-year=$COPYRIGHT_YEAR
--with-native-debug-symbols=none"
function do_exit() {
exit_code=$1
[ $do_reset_changes -eq 1 ] && git checkout HEAD modules.list src/java.desktop/share/classes/module-info.java

View File

@@ -24,8 +24,6 @@ source jb/project/tools/common/scripts/common.sh
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
sh configure \
--with-debug-level=release \
--with-vendor-name="${VENDOR_NAME}" \
@@ -35,7 +33,9 @@ sh configure \
--with-version-build="${JDK_BUILD_NUMBER}" \
--with-version-opt=b${build_number} \
--with-boot-jdk=${BOOT_JDK} \
--enable-cds=yes || exit $?
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
|| exit $?
make clean CONF=linux-aarch64-server-release || exit $?
make images CONF=linux-aarch64-server-release test-image || exit $?
@@ -54,9 +54,11 @@ echo Creating $JBSDK.tar.gz ...
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
tar -pcf $JBSDK.tar \
# NB: --sort=name requires tar1.28
tar $REPRODUCIBLE_TAR_OPTS --sort=name -pcf $JBSDK.tar \
--exclude=*.debuginfo --exclude=demo --exclude=sample --exclude=man \
-C $BASE_DIR ${JBRSDK_BUNDLE} || exit $?
touch -c -d @$SOURCE_DATE_EPOCH $JBRSDK.tar
gzip $JBSDK.tar || exit $?
JBR_BUNDLE=jbr
@@ -75,10 +77,11 @@ echo Modifying release info ...
grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${BASE_DIR}/${JBR_BUNDLE}/release
echo Creating $JBR.tar.gz ...
tar -pcf $JBR.tar -C $BASE_DIR ${JBR_BUNDLE} || exit $?
tar $REPRODUCIBLE_TAR_OPTS --sort=name -pcf $JBR.tar -C $BASE_DIR ${JBR_BUNDLE} || exit $?
touch -c -d @$SOURCE_DATE_EPOCH $JBR.tar
gzip $JBR.tar || exit $?
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-test-aarch64-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
tar -pcf $JBRSDK_TEST.tar -C $BASE_DIR --exclude='test/jdk/demos' test || exit $?
gzip $JBRSDK_TEST.tar || exit $?
gzip $JBRSDK_TEST.tar || exit $?

View File

@@ -50,7 +50,9 @@ function do_configure {
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes || do_exit $?
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
}
function create_image_bundle {
@@ -79,8 +81,14 @@ function create_image_bundle {
[ -f "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper
echo Creating "$JBR".tar.gz ...
tar -pcf "$JBR".tar -C "$IMAGES_DIR" "$__arch_name" || do_exit $?
(cd "$IMAGES_DIR" &&
find "$__arch_name" -print0 | LC_ALL=C sort -z | \
tar $REPRODUCIBLE_TAR_OPTS \
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
gzip "$JBR".tar || do_exit $?
rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
}
@@ -150,4 +158,4 @@ if [ -z "$bundle_type" ]; then
gzip "$JBRSDK_TEST".tar || do_exit $?
fi
do_exit 0
do_exit 0

View File

@@ -47,18 +47,14 @@ BOOT_JDK=${BOOT_JDK:=$(/usr/libexec/java_home -v 16)}
source jb/project/tools/common/scripts/common.sh
function copyJNF {
__contents_dir=$1
mkdir -p ${__contents_dir}/Frameworks
cp -Rp Frameworks/JavaNativeFoundation.framework ${__contents_dir}/Frameworks
}
function do_configure {
if [[ "${architecture}" == *aarch64* ]]; then
sh configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="${VENDOR_NAME}" \
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
--with-macosx-bundle-name-base=${VENDOR_VERSION_STRING} \
--with-macosx-bundle-id-base="com.jetbrains.jbr" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="${JDK_BUILD_NUMBER}" \
@@ -69,19 +65,25 @@ function do_configure {
--enable-cds=no \
--with-extra-cflags="-F$(pwd)/Frameworks" \
--with-extra-cxxflags="-F$(pwd)/Frameworks" \
--with-extra-ldflags="-F$(pwd)/Frameworks" || do_exit $?
--with-extra-ldflags="-F$(pwd)/Frameworks" \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
else
sh configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-macosx-bundle-name-base=${VENDOR_VERSION_STRING} \
--with-macosx-bundle-id-base="com.jetbrains.jbr" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--with-macosx-version-max="${MACOSX_VERSION_MAX:="10.12.00"}" \
--enable-cds=yes || do_exit $?
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
fi
}
@@ -115,16 +117,17 @@ function create_image_bundle {
cp -R "$JSDK"/../MacOS "$JRE_CONTENTS"
cp "$JSDK"/../Info.plist "$JRE_CONTENTS"
if [[ "${architecture}" == *aarch64* ]]; then
# we can't notarize this library as usual framework (with headers and tbd-file)
# but single library notarizes correctly
copyJNF $JRE_CONTENTS
fi
[ -n "$bundle_type" ] && (cp -a $JCEF_PATH/Frameworks "$JRE_CONTENTS" || do_exit $?)
echo Creating "$JBR".tar.gz ...
COPYFILE_DISABLE=1 tar -pczf "$JBR".tar.gz --exclude='*.dSYM' --exclude='man' -C "$tmp" "$__arch_name" || do_exit $?
# Normalize timestamp
find "$tmp"/"$__arch_name" -print0 | xargs -0 touch -c -h -t "$TOUCH_TIME"
(cd "$tmp" &&
find "$__arch_name" -print0 | LC_ALL=C sort -z | \
COPYFILE_DISABLE=1 tar $REPRODUCIBLE_TAR_OPTS --no-recursion --null -T - \
-czf "$JBR".tar.gz --exclude='*.dSYM' --exclude='man') || do_exit $?
mv "$tmp"/"$JBR".tar.gz "$JBR".tar.gz
rm -rf "$tmp"
}
@@ -198,4 +201,4 @@ if [ -z "$bundle_type" ]; then
COPYFILE_DISABLE=1 tar -pczf "$JBRSDK_TEST".tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
fi
do_exit 0
do_exit 0

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
APP_DIRECTORY=$1
APPL_USER=$2
@@ -54,17 +54,15 @@ function altool-upload() {
#immediately exit script with an error if a command fails
set -euo pipefail
file="$APP_NAME.zip"
#file="$APP_NAME.zip"
log "Zipping $file..."
rm -rf "$file"
ditto -c -k --sequesterRsrc --keepParent "$APP_DIRECTORY" "$file"
#log "Zipping $file..."
#rm -rf "$file"
#ditto -c -k --sequesterRsrc --keepParent "$APP_DIRECTORY" "$file"
log "Notarizing $file..."
log "Notarizing $APP_NAME..."
rm -rf "altool.init.out" "altool.check.out"
altool-upload "$file"
rm -rf "$file"
altool-upload "$APP_NAME"
notarization_info="$(grep -e "RequestUUID" "altool.init.out" | grep -oE '([0-9a-f-]{36})')"

View File

@@ -1,14 +1,17 @@
#!/bin/bash
#!/bin/bash -x
APP_DIRECTORY=$1
JB_CERT=$2
APPLICATION_PATH=$1
APP_NAME=$2
BUNDLE_ID=$3
JB_DEVELOPER_CERT=$4
JB_INSTALLER_CERT=$5
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$JB_CERT" ]]; then
if [[ -z "$APPLICATION_PATH" ]] || [[ -z "$JB_DEVELOPER_CERT" ]]; then
echo "Usage: $0 AppDirectory CertificateID"
exit 1
fi
if [[ ! -d "$APP_DIRECTORY" ]]; then
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
if [[ ! -d "$APPLICATION_PATH" ]]; then
echo "AppDirectory '$APPLICATION_PATH' does not exist or not a directory"
exit 1
fi
@@ -20,43 +23,30 @@ function log() {
set -euo pipefail
# Cleanup files left from previous sign attempt (if any)
find "$APP_DIRECTORY" -name '*.cstemp' -exec rm '{}' \;
find "$APPLICATION_PATH" -name '*.cstemp' -exec rm '{}' \;
log "Signing libraries and executables..."
# -perm +111 searches for executables
for f in \
"Contents/Home/bin" \
"Contents/Home/lib"; do
if [ -d "$APP_DIRECTORY/$f" ]; then
find "$APP_DIRECTORY/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
-exec codesign --timestamp --force \
-v -s "$JB_CERT" --options=runtime \
"Contents/Home/lib" "Contents/MacOS" \
"Contents/Home/Frameworks" \
"Contents/Frameworks"; do
if [ -d "$APPLICATION_PATH/$f" ]; then
find "$APPLICATION_PATH/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -name "*.node" -o -perm +111 \) \
-exec codesign --timestamp \
-v -s "$JB_DEVELOPER_CERT" --options=runtime --force \
--entitlements entitlements.xml {} \;
fi
done
if [ -d "$APP_DIRECTORY/Contents/Frameworks" ]; then
log "Signing frameworks..."
for f in $APP_DIRECTORY/Contents/Frameworks/*; do
find "$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" \) \
-exec codesign --timestamp --force \
-v -s "$JB_CERT" \
--entitlements entitlements.xml {} \;
codesign --timestamp --force \
-v -s "$JB_CERT" --options=runtime \
--entitlements entitlements.xml "$f"
done
fi
log "Signing libraries in jars in $PWD"
# todo: add set -euo pipefail; into the inner sh -c
# `-e` prevents `grep -q && printf` loginc
# with `-o pipefail` there's no input for 'while' loop
find "$APP_DIRECTORY" -name '*.jar' \
-exec sh -c "set -u; unzip -l \"\$0\" | grep -q -e '\.dylib\$' -e '\.jnilib\$' -e '\.so\$' -e '^jattach\$' && printf \"\$0\0\" " {} \; |
find "$APPLICATION_PATH" -name '*.jar' \
-exec sh -c "set -u; unzip -l \"\$0\" | grep -q -e '\.dylib\$' -e '\.jnilib\$' -e '\.so\$' -e '\.tbd\$' -e '^jattach\$' && printf \"\$0\0\" " {} \; |
while IFS= read -r -d $'\0' file; do
log "Processing libraries in $file"
@@ -67,12 +57,13 @@ find "$APP_DIRECTORY" -name '*.jar' \
cp "$file" jarfolder && (cd jarfolder && jar xf "$filename" && rm "$filename")
find jarfolder \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "jattach" \) \
-exec codesign --timestamp --force \
-v -s "$JB_CERT" --options=runtime \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -name "jattach" \) \
-exec codesign --timestamp \
--force \
-v -s "$JB_DEVELOPER_CERT" --options=runtime \
--entitlements entitlements.xml {} \;
(cd jarfolder; zip -q -r -o ../jar.jar .)
(cd jarfolder; zip -q -r -o -0 ../jar.jar .)
mv jar.jar "$file"
done
@@ -80,28 +71,41 @@ rm -rf jarfolder jar.jar
log "Signing other files..."
for f in \
"Contents/MacOS"; do
if [ -d "$APP_DIRECTORY/$f" ]; then
find "$APP_DIRECTORY/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
-exec codesign --timestamp --force \
-v -s "$JB_CERT" --options=runtime \
"Contents/Home/bin"; do
if [ -d "$APPLICATION_PATH/$f" ]; then
find "$APPLICATION_PATH/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -perm +111 \) \
-exec codesign --timestamp \
-v -s "$JB_DEVELOPER_CERT" --options=runtime --force \
--entitlements entitlements.xml {} \;
fi
done
#log "Signing executable..."
#codesign --timestamp \
# -v -s "$JB_CERT" --options=runtime \
# -v -s "$JB_DEVELOPER_CERT" --options=runtime \
# --force \
# --entitlements entitlements.xml "$APP_DIRECTORY/Contents/MacOS/idea"
# --entitlements entitlements.xml "$APPLICATION_PATH/Contents/MacOS/idea"
log "Signing whole app..."
codesign --timestamp \
-v -s "$JB_CERT" --options=runtime \
-v -s "$JB_DEVELOPER_CERT" --options=runtime \
--force \
--entitlements entitlements.xml "$APP_DIRECTORY"
--entitlements entitlements.xml "$APPLICATION_PATH"
BUILD_NAME=$(echo $APPLICATION_PATH | awk -F"/" '{ print $2 }')
log "Creating $APP_NAME.pkg..."
rm -rf "$APP_NAME.pkg"
pkgbuild --identifier $BUNDLE_ID --sign "$JB_INSTALLER_CERT" --root $APPLICATION_PATH \
--install-location /Library/Java/JavaVirtualMachines/${BUILD_NAME} ${APP_NAME}.pkg
#log "Signing whole app..."
#codesign --timestamp \
# -v -s "$JB_DEVELOPER_CERT" --options=runtime \
# --force \
# --entitlements entitlements.xml $APP_NAME.pkg
log "Verifying java is not broken"
find "$APP_DIRECTORY" \
find "$APPLICATION_PATH" \
-type f -name 'java' -perm +111 -exec {} -version \;

View File

@@ -12,8 +12,9 @@ BACKUP_JMODS=$2.backup
USERNAME=$3
PASSWORD=$4
CODESIGN_STRING=$5
NOTARIZE=$6
BUNDLE_ID=$7
JB_INSTALLER_CERT=$6
NOTARIZE=$7
BUNDLE_ID=$8
cd "$(dirname "$0")"
@@ -33,7 +34,7 @@ mkdir "$BACKUP_JMODS"
log "Unzipping $INPUT_FILE to $EXPLODED ..."
tar -xzvf "$INPUT_FILE" --directory $EXPLODED
BUILD_NAME="$(ls "$EXPLODED")"
sed -i '' s/BNDL/APPL/ $EXPLODED/$BUILD_NAME/Contents/Info.plist
#sed -i '' s/BNDL/APPL/ $EXPLODED/$BUILD_NAME/Contents/Info.plist
rm -f $EXPLODED/$BUILD_NAME/Contents/CodeResources
rm "$INPUT_FILE"
if test -d $EXPLODED/$BUILD_NAME/Contents/Home/jmods; then
@@ -42,7 +43,9 @@ fi
log "$INPUT_FILE extracted and removed"
APPLICATION_PATH="$EXPLODED/$BUILD_NAME"
APP_NAME=$(echo ${INPUT_FILE} | awk -F".tar" '{ print $1 }')
APPLICATION_PATH=$(sed "s/osx-//" <<< "$EXPLODED/$APP_NAME")
mv $EXPLODED/$BUILD_NAME $APPLICATION_PATH
find "$APPLICATION_PATH/Contents/Home/bin" \
-maxdepth 1 -type f -name '*.jnilib' -print0 |
@@ -79,7 +82,7 @@ limit=3
set +e
while [[ $attempt -le $limit ]]; do
log "Signing (attempt $attempt) $APPLICATION_PATH ..."
./sign.sh "$APPLICATION_PATH" "$CODESIGN_STRING"
./sign.sh "$APPLICATION_PATH" "$APP_NAME" "$BUNDLE_ID" "$CODESIGN_STRING" "$JB_INSTALLER_CERT"
ec=$?
if [[ $ec -ne 0 ]]; then
((attempt += 1))
@@ -92,6 +95,7 @@ while [[ $attempt -le $limit ]]; do
log "Signing done"
codesign -v "$APPLICATION_PATH" -vvvvv
log "Check sign done"
spctl -a -v $APPLICATION_PATH
((attempt += limit))
fi
done
@@ -102,13 +106,12 @@ if [ "$NOTARIZE" = "yes" ]; then
log "Notarizing..."
# shellcheck disable=SC1090
source "$HOME/.notarize_token"
APP_NAME=$(echo ${INPUT_FILE} | awk -F"." '{ print $1 }')
# Since notarization tool uses same file for upload token we have to trick it into using different folders, hence fake root
# Also it leaves copy of zip file in TMPDIR, so notarize.sh overrides it and uses FAKE_ROOT as location for temp TMPDIR
FAKE_ROOT="$(pwd)/fake-root"
mkdir -p "$FAKE_ROOT"
echo "Notarization will use fake root: $FAKE_ROOT"
./notarize.sh "$APPLICATION_PATH" "$APPLE_USERNAME" "$APPLE_PASSWORD" "$APP_NAME" "$BUNDLE_ID" "$FAKE_ROOT"
./notarize.sh "$APPLICATION_PATH" "$APPLE_USERNAME" "$APPLE_PASSWORD" "$APP_NAME.pkg" "$BUNDLE_ID" "$FAKE_ROOT"
rm -rf "$FAKE_ROOT"
set +e
@@ -124,10 +127,11 @@ log "Zipping $BUILD_NAME to $INPUT_FILE ..."
#cd "$EXPLODED"
#ditto -c -k --sequesterRsrc --keepParent "$BUILD_NAME" "../$INPUT_FILE"
if test -d $BACKUP_JMODS/jmods; then
mv $BACKUP_JMODS/jmods $EXPLODED/$BUILD_NAME/Contents/Home
mv $BACKUP_JMODS/jmods $APPLICATION_PATH/Contents/Home
fi
mv $APPLICATION_PATH $EXPLODED/$BUILD_NAME
tar -pczvf $INPUT_FILE --exclude='*.dSYM' --exclude='man' -C $EXPLODED $BUILD_NAME
tar -pczvf $INPUT_FILE --exclude='man' -C $EXPLODED $BUILD_NAME
log "Finished zipping"
)
rm -rf "$EXPLODED"

View File

@@ -1,7 +1,7 @@
From 51f91f7ccd3638360afcc8333d086bd2d5852b0e Mon Sep 17 00:00:00 2001
From b936da7d9d3572a4ded40a5ba74d51dead91e832 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 14 Nov 2018 21:09:39 +0100
Subject: [PATCH 01/42] Apply basic dcevm11 patch
Subject: [PATCH 01/45] Apply basic dcevm11 patch
---
src/hotspot/share/ci/ciObjectFactory.cpp | 25 +
@@ -125,7 +125,7 @@ index 83f4bcf248f..fdefc8e3b92 100644
#endif // SHARE_CI_CIOBJECTFACTORY_HPP
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
index 41da1214f2b..906798b029d 100644
index 0999d7dced7..14e86466cda 100644
--- a/src/hotspot/share/classfile/classFileParser.cpp
+++ b/src/hotspot/share/classfile/classFileParser.cpp
@@ -852,6 +852,8 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
@@ -137,7 +137,7 @@ index 41da1214f2b..906798b029d 100644
if (!interf->is_interface()) {
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(),
err_msg("class %s can not implement %s, because it is not an interface (%s)",
@@ -4010,7 +4012,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
@@ -4017,7 +4019,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
// However, make sure it is not an array type.
bool is_array = false;
if (cp->tag_at(super_class_index).is_klass()) {
@@ -146,7 +146,7 @@ index 41da1214f2b..906798b029d 100644
if (need_verify)
is_array = super_klass->is_array_klass();
} else if (need_verify) {
@@ -4150,7 +4152,10 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
@@ -4157,7 +4159,10 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
if (!_has_empty_finalizer) {
if (_has_finalizer ||
(super != NULL && super->has_finalizer())) {
@@ -158,7 +158,7 @@ index 41da1214f2b..906798b029d 100644
}
}
@@ -5497,6 +5502,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
@@ -5504,6 +5509,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
ClassLoaderData* loader_data,
const ClassLoadInfo* cl_info,
Publicity pub_level,
@@ -166,7 +166,7 @@ index 41da1214f2b..906798b029d 100644
TRAPS) :
_stream(stream),
_class_name(NULL),
@@ -5555,7 +5561,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
@@ -5562,7 +5568,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
_has_finalizer(false),
_has_empty_finalizer(false),
_has_vanilla_constructor(false),
@@ -176,7 +176,7 @@ index 41da1214f2b..906798b029d 100644
_class_name = name != NULL ? name : vmSymbols::unknown_class_name();
_class_name->increment_refcount();
@@ -5954,14 +5961,15 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
@@ -5961,14 +5968,15 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
CHECK);
}
Handle loader(THREAD, _loader_data->class_loader());
@@ -843,7 +843,7 @@ index f4d40685ddc..0c774dfeb51 100644
Handle class_loader,
InstanceKlass* k, TRAPS);
diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp
index 47468a16a20..bbabe2976bf 100644
index 9bebe3a5faf..d3045ca69f9 100644
--- a/src/hotspot/share/classfile/verifier.cpp
+++ b/src/hotspot/share/classfile/verifier.cpp
@@ -270,7 +270,7 @@ bool Verifier::is_eligible_for_verification(InstanceKlass* klass, bool should_ve
@@ -5674,7 +5674,7 @@ index 233608bc7b1..b934302f422 100644
// RedefineClasses support
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index 208d8a04f73..ee8d2d11ce4 100644
index cdc67e970bf..69d319e1f29 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -964,7 +964,8 @@ bool InstanceKlass::link_class_impl(TRAPS) {
@@ -5771,7 +5771,7 @@ index 208d8a04f73..ee8d2d11ce4 100644
#ifndef PRODUCT
void InstanceKlass::print_dependent_nmethods(bool verbose) {
dependencies().print_dependent_nmethods(verbose);
@@ -3733,7 +3782,7 @@ void InstanceKlass::verify_on(outputStream* st) {
@@ -3745,7 +3794,7 @@ void InstanceKlass::verify_on(outputStream* st) {
}
guarantee(sib->is_klass(), "should be klass");

View File

@@ -1,7 +1,7 @@
From 53a078caced2b0812e45cf2586b5e9036ee142ae Mon Sep 17 00:00:00 2001
From 269611e5ccc24a29685bd38aff50c9681506dd26 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 14 Nov 2018 21:18:22 +0100
Subject: [PATCH 02/42] dcevm11 fixes
Subject: [PATCH 02/45] dcevm11 fixes
1. We need to set classRedefinitionCount on new class, not old class.
@@ -89,7 +89,7 @@ dmh
delete mode 100644 src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
index 906798b029d..e1dfda7d26b 100644
index 14e86466cda..a7bbb0252dc 100644
--- a/src/hotspot/share/classfile/classFileParser.cpp
+++ b/src/hotspot/share/classfile/classFileParser.cpp
@@ -852,6 +852,7 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
@@ -100,7 +100,7 @@ index 906798b029d..e1dfda7d26b 100644
interf = (Klass *) maybe_newest(interf);
if (!interf->is_interface()) {
@@ -4012,6 +4013,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
@@ -4019,6 +4020,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
// However, make sure it is not an array type.
bool is_array = false;
if (cp->tag_at(super_class_index).is_klass()) {
@@ -108,7 +108,7 @@ index 906798b029d..e1dfda7d26b 100644
super_klass = InstanceKlass::cast(maybe_newest(cp->resolved_klass_at(super_class_index)));
if (need_verify)
is_array = super_klass->is_array_klass();
@@ -4152,7 +4154,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
@@ -4159,7 +4161,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
if (!_has_empty_finalizer) {
if (_has_finalizer ||
(super != NULL && super->has_finalizer())) {
@@ -4365,7 +4365,7 @@ index 9c1961619c1..167cb274661 100644
}
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index ee8d2d11ce4..9327652d8fe 100644
index 69d319e1f29..db5b8da58fc 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -1275,6 +1275,15 @@ void InstanceKlass::init_implementor() {
@@ -4423,7 +4423,7 @@ index ee8d2d11ce4..9327652d8fe 100644
bool InstanceKlass::update_jmethod_id(Method* method, jmethodID newMethodID) {
size_t idnum = (size_t)method->method_idnum();
jmethodID* jmeths = methods_jmethod_ids_acquire();
@@ -3782,6 +3792,7 @@ void InstanceKlass::verify_on(outputStream* st) {
@@ -3794,6 +3804,7 @@ void InstanceKlass::verify_on(outputStream* st) {
}
guarantee(sib->is_klass(), "should be klass");

View File

@@ -1,7 +1,7 @@
From 6e99aea309783dab138d3789b0039128bcc7344a Mon Sep 17 00:00:00 2001
From 9b18096f241be0350245868e8cf26729f6c3d110 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 11 Mar 2020 14:19:34 +0100
Subject: [PATCH 03/42] Fix class cast exception on redefinition of class A,
Subject: [PATCH 03/45] Fix class cast exception on redefinition of class A,
that is superclass of B that has anonymous class C
---
@@ -9,7 +9,7 @@ Subject: [PATCH 03/42] Fix class cast exception on redefinition of class A,
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index 9327652d8fe..c18a5822939 100644
index db5b8da58fc..6d9e5116df1 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -908,7 +908,10 @@ bool InstanceKlass::link_class_impl(TRAPS) {

View File

@@ -1,7 +1,7 @@
From 146b85fb6af764594999cb9922fd820798f3e9cc Mon Sep 17 00:00:00 2001
From 784dd5e16922110b0ee802d5bf1063e2b94499bc Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 4 Oct 2020 21:12:12 +0200
Subject: [PATCH 04/42] Support for Lambda class redefinition
Subject: [PATCH 04/45] Support for Lambda class redefinition
---
.../share/classfile/classLoaderData.cpp | 9 +++

View File

@@ -1,7 +1,7 @@
From 57d2451903b84dfc772cc0bf6957a52ee5e8c0f3 Mon Sep 17 00:00:00 2001
From 97ab12615a56e90993b5df4615c6dbd7eb856ebb Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 23 May 2020 10:02:15 +0200
Subject: [PATCH 05/42] Fix "no original bytecode found" error if method with
Subject: [PATCH 05/45] 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 d606e7de6dfe1204128a8ac034d8f57ad6130e0a Mon Sep 17 00:00:00 2001
From cb8d0e41bed94d0c8b8a4c51f692a4ca66dc3672 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 24 May 2020 12:07:42 +0200
Subject: [PATCH 06/42] Replace deleted method with
Subject: [PATCH 06/45] Replace deleted method with
Universe::throw_no_such_method_error
+ Change log level in advanced redefinition

View File

@@ -1,7 +1,7 @@
From 2365d0dc56b6b28ee3355e89ecf981a42fdfe440 Mon Sep 17 00:00:00 2001
From cfd0e2b3070e7ad75bcf3f320b2c35ac432f9ee9 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Jun 2020 17:43:52 +0200
Subject: [PATCH 07/42] Support for G1 gc
Subject: [PATCH 07/45] Support for G1 gc
---
src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 23 +++

View File

@@ -1,7 +1,7 @@
From e818e4a83fafc07142b7b7279c633823d5d8ab23 Mon Sep 17 00:00:00 2001
From 74de59c61db380a0e1c85686714bd9a3f1b29210 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Tue, 6 Oct 2020 22:15:31 +0200
Subject: [PATCH 08/42] AllowEnhancedClassRedefinition is false (disabled) by
Subject: [PATCH 08/45] AllowEnhancedClassRedefinition is false (disabled) by
default
---

View File

@@ -1,7 +1,7 @@
From 737c3616d674224661dd8751861f0365d9591d80 Mon Sep 17 00:00:00 2001
From c00c2a58550ae33ab2c842b521bf3b73163a93a1 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Mon, 19 Oct 2020 20:00:04 +0200
Subject: [PATCH 09/42] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
Subject: [PATCH 09/45] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
---
make/autoconf/version-numbers | 55 +++++++++++++++++++++++++++++++++++

View File

@@ -1,7 +1,7 @@
From b14f6ba2d743aacf15dedfe8ad677f176683d51c Mon Sep 17 00:00:00 2001
From c04d57e5278aa5d3cb6ef53fc161d2b6b4f19f3c Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 23 Oct 2020 10:20:26 +0200
Subject: [PATCH 10/42] Clear dcevm code separation
Subject: [PATCH 10/45] Clear dcevm code separation
---
src/hotspot/share/classfile/systemDictionary.cpp | 3 +--
@@ -132,7 +132,7 @@ index b934302f422..d7ae5edc7b3 100644
void set_field( // sets entry to resolved field state
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index c18a5822939..994f6bf266f 100644
index 6d9e5116df1..1e2b40dd1f2 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -968,7 +968,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {
@@ -153,7 +153,7 @@ index c18a5822939..994f6bf266f 100644
wait = true;
jt->set_class_to_be_initialized(this);
ol.wait_uninterruptibly(jt);
@@ -3796,7 +3796,7 @@ void InstanceKlass::verify_on(outputStream* st) {
@@ -3808,7 +3808,7 @@ void InstanceKlass::verify_on(outputStream* st) {
guarantee(sib->is_klass(), "should be klass");
// TODO: (DCEVM) explain

View File

@@ -1,7 +1,7 @@
From 3957393df0bd440fe90f4a8eea007b3354a45b98 Mon Sep 17 00:00:00 2001
From 3e9df9bdd901f1a7f7af57f2d37a738c059e3bb3 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 11 Nov 2020 18:45:15 +0100
Subject: [PATCH 11/42] Fix LoadedClassesClosure - fixes problems with remote
Subject: [PATCH 11/45] Fix LoadedClassesClosure - fixes problems with remote
debugging
---

View File

@@ -1,7 +1,7 @@
From f583e16509936d6873c4a2dac936d9089cc402a1 Mon Sep 17 00:00:00 2001
From 9b3a0f4afda0051f7c653162ff4192d55ecceb4f Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 10:10:02 +0100
Subject: [PATCH 12/42] dcevm15 - fix java15 compilation issues
Subject: [PATCH 12/45] dcevm15 - fix java15 compilation issues
---
.../share/classfile/classFileParser.hpp | 8 +-
@@ -322,7 +322,7 @@ index bec9c91d40a..29a81348d2d 100644
// Old and new address are in same space, so just compare the address.
// Must rescue if object moves towards the top of the space.
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index 994f6bf266f..ef0091fe288 100644
index 1e2b40dd1f2..c181fe044e2 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -1281,7 +1281,7 @@ void InstanceKlass::init_implementor() {

View File

@@ -1,7 +1,7 @@
From 4c98b29fed42b51e399f2ae0dc06f0c7a4397e2c Mon Sep 17 00:00:00 2001
From 2a27d36f5fbb0ebd94da192355f3946138c495bd Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 22 Nov 2020 19:51:46 +0100
Subject: [PATCH 13/42] dcevm15 - add ClassLoaderDataGraph_lock on
Subject: [PATCH 13/45] dcevm15 - add ClassLoaderDataGraph_lock on
ClassLoaderDataGraph::classes_do
ClassLoaderDataGraph::classes_do and need safepoint or lock,

View File

@@ -1,7 +1,7 @@
From b312e64db8532c57658d1f39269d73969ecf98d4 Mon Sep 17 00:00:00 2001
From 09af8da3c8fcb6d97917951673a56696fd7d6a2b Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 22 Nov 2020 12:05:50 +0100
Subject: [PATCH 14/42] dcevm15 - fix Universe::root_oops_do
Subject: [PATCH 14/45] dcevm15 - fix Universe::root_oops_do
Removed ClassLoaderDataGraph::cld_do was cause of crashes due multiple
oop patching. ClassLoaderDataGraph::cld_do replaced in dcevm15

View File

@@ -1,7 +1,7 @@
From b99bae1157fea7a62a2c9d2f10aaf722de1a5299 Mon Sep 17 00:00:00 2001
From fc0d2894212fd2186498d3341dddf2f201965686 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 28 Nov 2020 19:29:42 +0100
Subject: [PATCH 15/42] dcevm15 - check if has_nestmate_access_to has newest
Subject: [PATCH 15/45] dcevm15 - check if has_nestmate_access_to has newest
host class
---
@@ -9,7 +9,7 @@ Subject: [PATCH 15/42] dcevm15 - check if has_nestmate_access_to has newest
1 file changed, 5 insertions(+)
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index ef0091fe288..b4d09e92830 100644
index c181fe044e2..a8ac12450d7 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -398,6 +398,11 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {

View File

@@ -1,7 +1,7 @@
From 936d83f295468e7c0e51b759def1d8664cca2a6e Mon Sep 17 00:00:00 2001
From d20a52a5e7a87003da6f3e4bda39ec2976868a75 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 29 Nov 2020 17:18:16 +0100
Subject: [PATCH 16/42] dcevm15 - mark_as_scavengable only alive methods
Subject: [PATCH 16/45] dcevm15 - mark_as_scavengable only alive methods
---
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 14 ++++++++------

View File

@@ -1,7 +1,7 @@
From 50e3023f20fbea76fcc644a037bebc3ee5afc212 Mon Sep 17 00:00:00 2001
From b315e7cd828e79d63562b0296b97795015b644af Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 29 Nov 2020 20:05:03 +0100
Subject: [PATCH 17/42] dcevm15 - fix hidded classes
Subject: [PATCH 17/45] dcevm15 - fix hidded classes
---
.../prims/jvmtiEnhancedRedefineClasses.cpp | 41 ++++++++++++++-----

View File

@@ -1,7 +1,7 @@
From 21a17a7caf43236590d2e7319e176cb19c42f9aa Mon Sep 17 00:00:00 2001
From 25d78e62a702ad754c1a3a0136db1453089f008e Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 29 Nov 2020 20:08:57 +0100
Subject: [PATCH 18/42] dcevm15 - DON'T clear F2 in CP cache after indy
Subject: [PATCH 18/45] dcevm15 - DON'T clear F2 in CP cache after indy
unevolving
It's not clear why it was cleared in dcevm7-11

View File

@@ -1,7 +1,7 @@
From e286bbfb6ef8235be6aa9b41e30e9ed36cfd177d Mon Sep 17 00:00:00 2001
From b84814b31883b0f5441fca6d77b18c7426d26c36 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 22 Nov 2020 12:03:32 +0100
Subject: [PATCH 19/42] Cleanup and review comments
Subject: [PATCH 19/45] Cleanup and review comments
---
src/hotspot/share/classfile/classLoaderDataGraph.hpp | 2 +-

View File

@@ -1,7 +1,7 @@
From a755a90e2845ef3a30f3f03185ecee1a71182606 Mon Sep 17 00:00:00 2001
From 9da70fec073a442e9c0aee19a5ec643c1f84cea5 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 10:11:10 +0100
Subject: [PATCH 20/42] Disable AllowEnhancedClassRedefinition in flight
Subject: [PATCH 20/45] Disable AllowEnhancedClassRedefinition in flight
recorder
---

View File

@@ -1,7 +1,7 @@
From 8770c3da756a6193d69bb8c23aa992584edcb723 Mon Sep 17 00:00:00 2001
From 5d065e823c431a80251696c2543f6c98e68f00a6 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 09:44:28 +0100
Subject: [PATCH 21/42] dcevm17 - fix compilation issues
Subject: [PATCH 21/45] dcevm17 - fix compilation issues
---
.../share/classfile/classLoaderData.cpp | 2 +-
@@ -511,7 +511,7 @@ index cb320076a55..4b2211c415e 100644
static void serialize(SerializeClosure* f);
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index b4d09e92830..c2de2bec7d4 100644
index a8ac12450d7..ab2d7f10f9c 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -1286,7 +1286,7 @@ void InstanceKlass::init_implementor() {
@@ -523,7 +523,7 @@ index b4d09e92830..c2de2bec7d4 100644
assert(addr != NULL, "null addr");
if (addr != NULL) {
*addr = NULL;
@@ -3816,7 +3816,7 @@ void InstanceKlass::verify_on(outputStream* st) {
@@ -3828,7 +3828,7 @@ void InstanceKlass::verify_on(outputStream* st) {
guarantee(sib->is_klass(), "should be klass");
// TODO: (DCEVM) explain

View File

@@ -1,7 +1,7 @@
From d170fa0a21d5c62348fe77eeaa81b16c8c51531a Mon Sep 17 00:00:00 2001
From 09f5f22d61675a9f8909e903fa6e6f51507b656c Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 11:38:48 +0100
Subject: [PATCH 22/42] Fix crash on GrowableArray allocation in C_HEAP
Subject: [PATCH 22/45] Fix crash on GrowableArray allocation in C_HEAP
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 4 ++--

View File

@@ -1,7 +1,7 @@
From 8f59a799ec9996f3d92843f1a9f8504390c20009 Mon Sep 17 00:00:00 2001
From 90b8572ff42dd5f64a6d2063aab6842bceddcf55 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 11:39:05 +0100
Subject: [PATCH 23/42] Rename confusing method name old_if_redefined to
Subject: [PATCH 23/45] Rename confusing method name old_if_redefined to
old_if_redefining
---

View File

@@ -1,7 +1,7 @@
From cc05b370b2fdf4c367bb9b6e4a21b9f97ae53dcf Mon Sep 17 00:00:00 2001
From 86f7318e889fcb0d883501b4a70105d087b39482 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Fri, 12 Feb 2021 12:33:47 +0100
Subject: [PATCH 24/42] Check InstanceKlass::has_nestmate_access_to with active
Subject: [PATCH 24/45] Check InstanceKlass::has_nestmate_access_to with active
classes
Dcevm can leave old host in nested class if nested class is not
@@ -11,7 +11,7 @@ redefined together with host class
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index c2de2bec7d4..3cc96f98f41 100644
index ab2d7f10f9c..bcb0da6301f 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -398,9 +398,9 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {

View File

@@ -1,7 +1,7 @@
From fdc87a0203f5aa1a21b3bf2e7a5aa114739f66cf Mon Sep 17 00:00:00 2001
From 79ea607bf68161cfcee3a681d14540cffe5589a3 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 13 Feb 2021 20:47:52 +0100
Subject: [PATCH 25/42] JBR-3111 Update class in all dictionaries where it was
Subject: [PATCH 25/45] JBR-3111 Update class in all dictionaries where it was
already defined
This patch keeps compatibility with std redefinition, that does not

View File

@@ -1,7 +1,7 @@
From a33424d92f6001c9f9cb627b620f490fdfbc1196 Mon Sep 17 00:00:00 2001
From 99c65ab84080d35c1ba1df6efd5641ad3ab9e1e8 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 20 Feb 2021 15:47:47 +0100
Subject: [PATCH 26/42] Add ClassLoaderDataGraph_lock to define new class in
Subject: [PATCH 26/45] Add ClassLoaderDataGraph_lock to define new class in
enhanced redefiniton
ClassLoaderDataGraph locking for introduced in redefinition in

View File

@@ -1,7 +1,7 @@
From e85a74a6bd33e5d81569ec209311e698de402990 Mon Sep 17 00:00:00 2001
From e7e7920986355d6fd5ad0c333ec780c93583d030 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Thu, 18 Jun 2020 18:40:11 +0200
Subject: [PATCH 27/42] JBR-3140 - support for modularized HotswapAgent
Subject: [PATCH 27/45] JBR-3140 - support for modularized HotswapAgent
Add -XX:HotswapAgent=[disabled,fatjar.core]
---

View File

@@ -1,7 +1,7 @@
From b2e59ba5f246798f4901fa16d8fd3aeceac8309e Mon Sep 17 00:00:00 2001
From 854df9651b358f3a8d89cd8a7d60fed26ca3d1d5 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 7 Mar 2021 20:22:54 +0100
Subject: [PATCH 28/42] Support for redefinition of Well Known classses
Subject: [PATCH 28/45] Support for redefinition of Well Known classses
(java.*,jdk.*, sun.*)
---

View File

@@ -1,7 +1,7 @@
From 76c2c517d54f0fdbae2cb10cceb6c1aab7ee3a7b Mon Sep 17 00:00:00 2001
From 01f4cb9929cad1512d02e20cc7538a29ff0d3ef1 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 15 May 2021 10:31:28 +0200
Subject: [PATCH 29/42] Fix fastdebug compilation issues - cast_to_oop
Subject: [PATCH 29/45] Fix fastdebug compilation issues - cast_to_oop
---
.../share/gc/g1/g1FullGCCompactTask.cpp | 12 +++++-----

View File

@@ -1,7 +1,7 @@
From e3dcad4df8369cfa4a5eb90058ce265c0233b272 Mon Sep 17 00:00:00 2001
From cac2eac1986ae05e264b2213d0d2658e2f57f07f Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Fri, 19 Mar 2021 19:13:38 +0100
Subject: [PATCH 30/42] JBR-3458: Skip dynamic proxy classes based on
Subject: [PATCH 30/45] JBR-3458: Skip dynamic proxy classes based on
com.sun.proxy
---

View File

@@ -1,7 +1,7 @@
From b57c414d7885df5142a4a6bbf78001e96938f8ac Mon Sep 17 00:00:00 2001
From 4c87af809d20a12553f155110592a9f230ec0ea5 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
Date: Sat, 20 Mar 2021 20:51:08 +0100
Subject: [PATCH 31/42] JBR-3459: Fix race condition in
Subject: [PATCH 31/45] JBR-3459: Fix race condition in
ClassLoaderDataGraph::classes_do
InstanceKlass in ClassLoaderData can be uninitialized when

View File

@@ -1,7 +1,7 @@
From 66d53205a84c8e4db40fb2fc91f563cde458afcc Mon Sep 17 00:00:00 2001
From c4941350aa7d3c5df3a20652f640fe446ff00c5c Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 15 May 2021 13:01:25 +0200
Subject: [PATCH 32/42] Fix compilation problems
Subject: [PATCH 32/45] Fix compilation problems
---
src/hotspot/share/oops/instanceKlass.cpp | 2 +-
@@ -9,7 +9,7 @@ Subject: [PATCH 32/42] Fix compilation problems
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index 3cc96f98f41..c54b6b1bf46 100644
index bcb0da6301f..c5f37d42a9a 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -978,7 +978,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {

View File

@@ -1,7 +1,7 @@
From fd5b6cd29a5dfed532b0c6ac80c94271f388c5bc Mon Sep 17 00:00:00 2001
From dad40d31ec8a1633189e70eff57ae5fd21544b20 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 20 Jun 2021 19:11:16 +0200
Subject: [PATCH 33/42] Fix dcevm issues related to refactorization of Thread
Subject: [PATCH 33/45] Fix dcevm issues related to refactorization of Thread
to JavaThread
---

View File

@@ -1,7 +1,7 @@
From 52c661cebf92d4ad68058ada5d3463e54428aee7 Mon Sep 17 00:00:00 2001
From 7fcef1a84c37c568c0afafb8cb22303efda68f0d Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 20 Jun 2021 19:42:51 +0200
Subject: [PATCH 34/42] Fix init_method_MemberName after Thread to JavaThread
Subject: [PATCH 34/45] Fix init_method_MemberName after Thread to JavaThread
refactorization
---
@@ -78,7 +78,7 @@ index 9eeb10cc6fd..871eaab7464 100644
BasicType result_type() const { return selected_method()->result_type(); }
CallKind call_kind() const { return _call_kind; }
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
index c54b6b1bf46..8d259451032 100644
index c5f37d42a9a..9920e7fb25d 100644
--- a/src/hotspot/share/oops/instanceKlass.cpp
+++ b/src/hotspot/share/oops/instanceKlass.cpp
@@ -1643,21 +1643,6 @@ void InstanceKlass::methods_do(void f(Method* method)) {

View File

@@ -1,7 +1,7 @@
From 523ce6dd1559af84ebd6e4f10e7de9142f88d9d0 Mon Sep 17 00:00:00 2001
From e16371268f8ba1c752dc61635a09c94e978f5117 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Mon, 21 Jun 2021 20:44:17 +0200
Subject: [PATCH 35/42] Fix "implicit conversion of NULL constant to 'bool'"
Subject: [PATCH 35/45] Fix "implicit conversion of NULL constant to 'bool'"
---
src/hotspot/share/prims/jvmtiRedefineClasses.cpp | 2 +-

View File

@@ -1,7 +1,7 @@
From df4c29b24d41069168ee5647b2737348d9902090 Mon Sep 17 00:00:00 2001
From 4d7390cedc3d06281f6a89f12b469108f11aab42 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 30 Jun 2021 18:30:00 +0200
Subject: [PATCH 36/42] Fix, pass SystemDictionary::resolve_from_stream cl_info
Subject: [PATCH 36/45] Fix, pass SystemDictionary::resolve_from_stream cl_info
param
---

View File

@@ -1,7 +1,7 @@
From 47ae71afaf12c7bab4f928579b154ec72aad3c02 Mon Sep 17 00:00:00 2001
From 24fe3ebd655068b819a437af62d40c2ee9ed7171 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 30 Jun 2021 18:50:38 +0200
Subject: [PATCH 37/42] Search for affected classes in all initialized classes
Subject: [PATCH 37/45] Search for affected classes in all initialized classes
in cld
Fix also case when lambda interface is redefined. Lambda class is

View File

@@ -1,7 +1,7 @@
From e9c3042e13c5fe58cac7409b1f93a4dc287cc14a Mon Sep 17 00:00:00 2001
From 3e62ad1914f202d2d3fe907036924e181cd60fcb Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Wed, 30 Jun 2021 18:58:47 +0200
Subject: [PATCH 38/42] Fix compilation issue
Subject: [PATCH 38/45] Fix compilation issue
---
src/hotspot/share/interpreter/linkResolver.cpp | 4 ++--

View File

@@ -1,7 +1,7 @@
From f303ef1fec703144efe6b9989a1a71fae0fb4263 Mon Sep 17 00:00:00 2001
From 4cfb8eb8caa9b13f54f21cdd34b4d761b2b488cc Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Tue, 27 Jul 2021 21:32:51 +0200
Subject: [PATCH 39/42] Remove duplicated lambdaFormInvokers.cpp
Subject: [PATCH 39/45] Remove duplicated lambdaFormInvokers.cpp
---
.../share/classfile/lambdaFormInvokers.cpp | 152 ------------------

View File

@@ -1,7 +1,7 @@
From 9cb4aaf17c8e35f39aed0dfa33e173b40968eee6 Mon Sep 17 00:00:00 2001
From 92651c5d109896613e14792aa96ed5226a797f9b Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sun, 10 Oct 2021 20:25:30 +0200
Subject: [PATCH 40/42] JBR-3867 - update keys of jvmti TAG map after
Subject: [PATCH 40/45] JBR-3867 - update keys of jvmti TAG map after
redefinition
jdwp keeps relation class_ptr->class_ref in jvmti tag. class_ptr is used

View File

@@ -1,7 +1,7 @@
From db54a42adf258e2ba3459fe017221cf2cf49c33f Mon Sep 17 00:00:00 2001
From 7cfd70e1e43bca677b9827a5a7643bb604e6ae38 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Mon, 11 Oct 2021 20:22:26 +0200
Subject: [PATCH 41/42] JBR-3867 - fix msvc compilation issue with non const
Subject: [PATCH 41/45] JBR-3867 - fix msvc compilation issue with non const
array on stack
---

View File

@@ -1,7 +1,7 @@
From 976b5f8b1326fee64febef8771d7cebee46bada9 Mon Sep 17 00:00:00 2001
From d41ca807dcf4f192bc730c577acb5d2bff0aa3f7 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Tue, 19 Oct 2021 17:02:35 +0200
Subject: [PATCH 42/42] Attempt to fix JBR-3887
Subject: [PATCH 42/45] Attempt to fix JBR-3887
---
src/hotspot/share/prims/jvmtiExtensions.cpp | 8 +++++++-

View File

@@ -0,0 +1,180 @@
From 91534f381bf08471b7e6e5064d561fb75e2890c6 Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Mon, 1 Nov 2021 19:00:41 +0100
Subject: [PATCH 43/45] JBR-3937 Fix crashes in C1/C2 compilers
There is a race condition in enhanced redefinition with C1/C2. Therefore
the patch stops C1/C2 compilation before redefinition and release after
redefinition finishing. There is no performance impact since dcevm
flushes all code cache.
---
src/hotspot/share/compiler/compileBroker.cpp | 38 ++++++++++++++++++--
src/hotspot/share/compiler/compileBroker.hpp | 6 ++++
src/hotspot/share/prims/jvmtiEnv.cpp | 7 ++++
src/hotspot/share/runtime/mutexLocker.cpp | 3 ++
src/hotspot/share/runtime/mutexLocker.hpp | 1 +
5 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp
index aaf8e4b1f1e..878bc265d2f 100644
--- a/src/hotspot/share/compiler/compileBroker.cpp
+++ b/src/hotspot/share/compiler/compileBroker.cpp
@@ -140,6 +140,8 @@ CompileLog** CompileBroker::_compiler2_logs = NULL;
// These counters are used to assign an unique ID to each compilation.
volatile jint CompileBroker::_compilation_id = 0;
volatile jint CompileBroker::_osr_compilation_id = 0;
+volatile bool CompileBroker::_compilation_stopped = false;
+volatile int CompileBroker::_active_compilations = 0;
// Performance counters
PerfCounter* CompileBroker::_perf_total_compilation = NULL;
@@ -2320,8 +2322,19 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
locker.wait();
}
}
- comp->compile_method(&ci_env, target, osr_bci, true, directive);
-
+ if (AllowEnhancedClassRedefinition) {
+ {
+ MonitorLocker locker(DcevmCompilation_lock, Mutex::_no_safepoint_check_flag);
+ while (_compilation_stopped) {
+ locker.wait();
+ }
+ Atomic::add(&_active_compilations, 1);
+ }
+ comp->compile_method(&ci_env, target, osr_bci, true, directive);
+ Atomic::sub(&_active_compilations, 1);
+ } else {
+ comp->compile_method(&ci_env, target, osr_bci, true, directive);
+ }
/* Repeat compilation without installing code for profiling purposes */
int repeat_compilation_count = directive->RepeatCompilationOption;
while (repeat_compilation_count > 0) {
@@ -2329,6 +2342,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
comp->compile_method(&ci_env, target, osr_bci, false , directive);
repeat_compilation_count--;
}
+
}
if (!ci_env.failing() && task->code() == NULL) {
@@ -2942,3 +2956,23 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
}
out->print_cr("\n__ CodeHeapStateAnalytics total duration %10.3f seconds _________\n", ts_total.seconds());
}
+
+void CompileBroker::stopCompilationBeforeEnhancedRedefinition() {
+ if (AllowEnhancedClassRedefinition) {
+ MonitorLocker locker(DcevmCompilation_lock, Mutex::_no_safepoint_check_flag);
+ _compilation_stopped = true;
+ while (_active_compilations > 0) {
+ VM_ThreadsSuspendJVMTI tsj; // force safepoint to run C1/C2 VM op
+ VMThread::execute(&tsj);
+ locker.wait(10);
+ }
+ }
+}
+
+void CompileBroker::releaseCompilationAfterEnhancedRedefinition() {
+ if (AllowEnhancedClassRedefinition) {
+ MonitorLocker locker(DcevmCompilation_lock, Mutex::_no_safepoint_check_flag);
+ _compilation_stopped = false;
+ locker.notify_all();
+ }
+}
diff --git a/src/hotspot/share/compiler/compileBroker.hpp b/src/hotspot/share/compiler/compileBroker.hpp
index 0b721f83121..f146ff5c93d 100644
--- a/src/hotspot/share/compiler/compileBroker.hpp
+++ b/src/hotspot/share/compiler/compileBroker.hpp
@@ -175,6 +175,9 @@ class CompileBroker: AllStatic {
static volatile jint _compilation_id;
static volatile jint _osr_compilation_id;
+ static volatile bool _compilation_stopped;
+ static volatile int _active_compilations;
+
static CompileQueue* _c2_compile_queue;
static CompileQueue* _c1_compile_queue;
@@ -423,6 +426,9 @@ public:
// CodeHeap State Analytics.
static void print_info(outputStream *out);
static void print_heapinfo(outputStream *out, const char* function, size_t granularity);
+
+ static void stopCompilationBeforeEnhancedRedefinition();
+ static void releaseCompilationAfterEnhancedRedefinition();
};
#endif // SHARE_COMPILER_COMPILEBROKER_HPP
diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp
index 8970d7991b7..9ca8e660197 100644
--- a/src/hotspot/share/prims/jvmtiEnv.cpp
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp
@@ -31,6 +31,7 @@
#include "classfile/vmClasses.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc/shared/collectedHeap.hpp"
+#include "compiler/compileBroker.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "interpreter/interpreter.hpp"
#include "jfr/jfrEvents.hpp"
@@ -458,8 +459,11 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) {
if (AllowEnhancedClassRedefinition) {
MutexLocker sd_mutex(EnhancedRedefineClasses_lock);
+ // Stop compilation to avoid compilator race condition (crashes) with advanced redefinition
+ CompileBroker::stopCompilationBeforeEnhancedRedefinition();
VM_EnhancedRedefineClasses op(class_count, class_definitions, jvmti_class_load_kind_retransform);
VMThread::execute(&op);
+ CompileBroker::releaseCompilationAfterEnhancedRedefinition();
op_id = op.id();
error = (op.check_error());
} else {
@@ -489,8 +493,11 @@ JvmtiEnv::RedefineClasses(jint class_count, const jvmtiClassDefinition* class_de
if (AllowEnhancedClassRedefinition) {
MutexLocker sd_mutex(EnhancedRedefineClasses_lock);
+ // Stop compilation to avoid compilator race condition (crashes) with advanced redefinition
+ CompileBroker::stopCompilationBeforeEnhancedRedefinition();
VM_EnhancedRedefineClasses op(class_count, class_definitions, jvmti_class_load_kind_redefine);
VMThread::execute(&op);
+ CompileBroker::releaseCompilationAfterEnhancedRedefinition();
op_id = op.id();
error = (op.check_error());
} else {
diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp
index 83982382e6f..beb36ebc177 100644
--- a/src/hotspot/share/runtime/mutexLocker.cpp
+++ b/src/hotspot/share/runtime/mutexLocker.cpp
@@ -84,6 +84,7 @@ Mutex* Compile_lock = NULL;
Monitor* MethodCompileQueue_lock = NULL;
Monitor* CompileThread_lock = NULL;
Monitor* Compilation_lock = NULL;
+Monitor* DcevmCompilation_lock = NULL;
Mutex* CompileTaskAlloc_lock = NULL;
Mutex* CompileStatistics_lock = NULL;
Mutex* DirectivesStack_lock = NULL;
@@ -318,6 +319,8 @@ void mutex_init() {
def(Compilation_lock , PaddedMonitor, leaf, false, _safepoint_check_never);
}
+ def(DcevmCompilation_lock , PaddedMonitor, nonleaf+1, false, _safepoint_check_never);
+
#if INCLUDE_JFR
def(JfrMsg_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
def(JfrBuffer_lock , PaddedMutex , leaf, true, _safepoint_check_never);
diff --git a/src/hotspot/share/runtime/mutexLocker.hpp b/src/hotspot/share/runtime/mutexLocker.hpp
index 65a6366bbfb..4333bd51464 100644
--- a/src/hotspot/share/runtime/mutexLocker.hpp
+++ b/src/hotspot/share/runtime/mutexLocker.hpp
@@ -80,6 +80,7 @@ extern Mutex* Compile_lock; // a lock held when Compilation
extern Monitor* MethodCompileQueue_lock; // a lock held when method compilations are enqueued, dequeued
extern Monitor* CompileThread_lock; // a lock held by compile threads during compilation system initialization
extern Monitor* Compilation_lock; // a lock used to pause compilation
+extern Monitor* DcevmCompilation_lock; // a lock used to pause compilation from dcevm
extern Mutex* CompileTaskAlloc_lock; // a lock held when CompileTasks are allocated
extern Mutex* CompileStatistics_lock; // a lock held when updating compilation statistics
extern Mutex* DirectivesStack_lock; // a lock held when mutating the dirstack and ref counting directives
--
2.23.0

View File

@@ -0,0 +1,111 @@
From c45eb681e77d16b7e873c8e4dbd19f98879a102a Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Sat, 6 Nov 2021 19:47:08 +0100
Subject: [PATCH 44/45] G1 fixes, code cleanup
---
src/hotspot/share/compiler/compileBroker.cpp | 2 ++
src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp | 4 +---
src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp | 4 ++++
src/hotspot/share/gc/shared/gcConfig.cpp | 6 +++---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 3 ++-
5 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp
index 878bc265d2f..d8275508f9b 100644
--- a/src/hotspot/share/compiler/compileBroker.cpp
+++ b/src/hotspot/share/compiler/compileBroker.cpp
@@ -2958,6 +2958,8 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
}
void CompileBroker::stopCompilationBeforeEnhancedRedefinition() {
+ // There are hard to fix C1/C2 race conditions with dcevm. The easiest solution
+ // is to stop compilation.
if (AllowEnhancedClassRedefinition) {
MonitorLocker locker(DcevmCompilation_lock, Mutex::_no_safepoint_check_flag);
_compilation_stopped = true;
diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
index 765630a9826..c5bffc9bc49 100644
--- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
@@ -140,7 +140,6 @@ void G1FullGCCompactTask::compact_region_dcevm(HeapRegion* hr, GrowableArray<Hea
hr->apply_to_marked_objects(collector()->mark_bitmap(), &compact);
// Once all objects have been moved the liveness information
// needs be cleared.
- collector()->mark_bitmap()->clear_region(hr);
if (G1VerifyBitmaps) {
collector()->mark_bitmap()->clear_region(hr);
}
@@ -150,8 +149,7 @@ void G1FullGCCompactTask::compact_region_dcevm(HeapRegion* hr, GrowableArray<Hea
void G1FullGCCompactTask::serial_compaction_dcevm() {
GCTraceTime(Debug, gc, phases) tm("Phase 4: Serial Compaction", collector()->scope()->timer());
- // compact remaining, not parallel compacted rescued oops using serial compact point
-
+ // Clear allocated resources at compact points now, since all rescued oops are copied to destination.
for (uint i = 0; i < collector()->workers(); i++) {
G1FullGCCompactionPoint* cp = collector()->compaction_point(i);
DcevmSharedGC::clear_rescued_objects_heap(cp->rescued_oops_values());
diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
index 93c066383a1..aa199f57dd7 100644
--- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
+++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
@@ -146,6 +146,9 @@ bool G1FullGCPrepareTask::G1CalculatePointersClosure::should_compact(HeapRegion*
if (hr->is_pinned()) {
return false;
}
+ if (Universe::is_redefining_gc_run()) {
+ return true;
+ }
size_t live_words = _collector->live_words(hr->hrm_index());
size_t live_words_threshold = _collector->scope()->region_compaction_threshold();
// High live ratio region will not be compacted.
@@ -324,6 +327,7 @@ bool G1FullGCPrepareTask::G1PrepareCompactLiveClosureDcevm::must_rescue(oop old_
int new_size = old_obj->size_given_klass(oop(old_obj)->klass()->new_version());
int original_size = old_obj->size();
+ // what if old_obj > new_obj ?
bool overlap = (cast_from_oop<HeapWord*>(old_obj) + original_size < cast_from_oop<HeapWord*>(new_obj) + new_size);
return overlap;
diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp
index 8e78696bef5..f8365f94214 100644
--- a/src/hotspot/share/gc/shared/gcConfig.cpp
+++ b/src/hotspot/share/gc/shared/gcConfig.cpp
@@ -96,9 +96,9 @@ void GCConfig::fail_if_non_included_gc_is_selected() {
}
void GCConfig::select_gc_ergonomically() {
- if (AllowEnhancedClassRedefinition && !UseG1GC) {
- // (DCEVM) Enhanced class redefinition only supports serial GC at the moment
- FLAG_SET_ERGO(UseSerialGC, true);
+ if (AllowEnhancedClassRedefinition && !UseSerialGC) {
+ // (DCEVM) use G1 as default GC in Enhanced class redefinition
+ FLAG_SET_ERGO(UseG1GC, true);
} else if (os::is_server_class_machine()) {
#if INCLUDE_G1GC
FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true);
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
index 8615806ac98..32e0fcbe62b 100644
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
@@ -385,7 +385,7 @@ class ChangePointersOopClosure : public BasicOopIterateClosure {
bool oop_updated = false;
if (obj->is_instance() && InstanceKlass::cast(obj->klass())->is_mirror_instance_klass()) {
Klass* klass = java_lang_Class::as_Klass(obj);
- if (klass != NULL && klass->is_instance_klass()) {
+ if (klass != NULL && klass->is_instance_klass() && klass->new_version() != NULL) {
assert(obj == InstanceKlass::cast(klass)->java_mirror(), "just checking");
if (klass->new_version() != NULL) {
obj = InstanceKlass::cast(klass->new_version())->java_mirror();
@@ -578,6 +578,7 @@ void VM_EnhancedRedefineClasses::doit() {
if (log_is_enabled(Info, redefine, class, timer)) {
_timer_heap_iterate.start();
}
+ // returns after the iteration is finished
G1CollectedHeap::heap()->object_par_iterate(&objectClosure);
_timer_heap_iterate.stop();
} else {
--
2.23.0

View File

@@ -0,0 +1,35 @@
From bb7c41e91326eaa90e25e02e13a2559adf41ae9e Mon Sep 17 00:00:00 2001
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
Date: Mon, 8 Nov 2021 19:51:41 +0100
Subject: [PATCH 45/45] JBR-3867 - fix dcevm redefinition stops due the not
updated weak oops
Dcevm must update also oops in weak storage using WeakProcessor. Oops
storage is new concept in java17.
---
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
index 32e0fcbe62b..35dfc1a66d1 100644
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
@@ -67,6 +67,7 @@
#include "gc/shared/dcevmSharedGC.hpp"
#include "gc/shared/scavengableNMethods.hpp"
#include "gc/shared/oopStorageSet.inline.hpp"
+#include "gc/shared/weakProcessor.hpp"
#include "ci/ciObjectFactory.hpp"
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
@@ -250,6 +251,7 @@ void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
Threads::oops_do(oopClosure, NULL);
OopStorageSet::strong_oops_do(oopClosure);
+ WeakProcessor::oops_do(oopClosure);
CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
CodeCache::blobs_do(&blobClosure);
--
2.23.0

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2021, 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
@@ -88,7 +88,10 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
$(CAT) $(LINK_OPT_DIR)/stderr $(JLI_TRACE_FILE) ; \
exit $$exitcode \
)
$(GREP) -v HelloClasslist $@.raw.2 > $@
$(GREP) -v HelloClasslist $@.raw.2 > $@.raw.3
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
build.tools.classlist.SortClasslist $@.raw.3 > $@
# The jli trace is created by the same recipe as classlist. By declaring these
# dependencies, make will correctly rebuild both jli trace and classlist

View File

@@ -324,7 +324,7 @@ $(eval $(call SetupTarget, vscode-project-ccls, \
# aren't built until after libjava and libjvm are available to link to.
$(eval $(call SetupTarget, demos-jdk, \
MAKEFILE := CompileDemos, \
DEPS := java.base-libs exploded-image, \
DEPS := java.base-libs exploded-image buildtools-jdk, \
))
$(eval $(call SetupTarget, test-image-demos-jdk, \
@@ -383,12 +383,12 @@ bootcycle-images:
$(eval $(call SetupTarget, zip-security, \
MAKEFILE := ZipSecurity, \
DEPS := java.base-java java.security.jgss-java java.security.jgss-libs, \
DEPS := buildtools-jdk java.base-java java.security.jgss-java java.security.jgss-libs, \
))
$(eval $(call SetupTarget, zip-source, \
MAKEFILE := ZipSource, \
DEPS := gensrc, \
DEPS := buildtools-jdk gensrc, \
))
$(eval $(call SetupTarget, jrtfs-jar, \
@@ -508,13 +508,13 @@ $(eval $(call SetupTarget, docs-jdk-index, \
$(eval $(call SetupTarget, docs-zip, \
MAKEFILE := Docs, \
TARGET := docs-zip, \
DEPS := docs-jdk, \
DEPS := docs-jdk buildtools-jdk, \
))
$(eval $(call SetupTarget, docs-specs-zip, \
MAKEFILE := Docs, \
TARGET := docs-specs-zip, \
DEPS := docs-jdk-specs, \
DEPS := docs-jdk-specs buildtools-jdk, \
))
$(eval $(call SetupTarget, update-build-docs, \

View File

@@ -80,6 +80,8 @@ TOOL_GENERATECACERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_class
TOOL_GENERATEEMOJIDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generateemojidata.GenerateEmojiData
TOOL_MAKEZIPREPRODUCIBLE = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.makezipreproducible.MakeZipReproducible
# TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
# and nbproject/project.properties in the same dir. Needs to be looked at.

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, 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
@@ -94,11 +94,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
# Locate the directory of this script.
AUTOCONF_DIR=$TOPDIR/make/autoconf
# Setup username (for use in adhoc version strings etc)
# Outer [ ] to quote m4.
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
AC_SUBST(USERNAME)
])
###############################################################################

View File

@@ -356,6 +356,14 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
fi
AC_SUBST(IS_GNU_TIME)
# Check if it's GNU date
check_date=`$DATE --version 2>&1 | $GREP GNU`
if test "x$check_date" != x; then
IS_GNU_DATE=yes
else
IS_GNU_DATE=no
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
UTIL_REQUIRE_PROGS(DSYMUTIL, dsymutil)
UTIL_REQUIRE_PROGS(MIG, mig)

View File

@@ -199,6 +199,12 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
AC_MSG_ERROR([Copyright year must have a value])
elif test "x$with_copyright_year" != x; then
COPYRIGHT_YEAR="$with_copyright_year"
elif test "x$SOURCE_DATE_EPOCH" != x; then
if test "x$IS_GNU_DATE" = xyes; then
COPYRIGHT_YEAR=`date --date=@$SOURCE_DATE_EPOCH +%Y`
else
COPYRIGHT_YEAR=`date -j -f %s $SOURCE_DATE_EPOCH +%Y`
fi
else
COPYRIGHT_YEAR=`$DATE +'%Y'`
fi
@@ -735,7 +741,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD],
if test "x$OPENJDK_BUILD_OS" = xwindows && \
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse && \
test "x$ENABLE_REPRODUCIBLE_BUILD" = xfalse; then
AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-builds])
AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-build])
AC_MSG_NOTICE([with --disable-absolute-paths-in-output.])
AC_MSG_ERROR([Cannot continue])
fi

View File

@@ -69,6 +69,17 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
AC_SUBST(JDK_RC_PLATFORM_NAME)
AC_SUBST(HOTSPOT_VM_DISTRO)
# Setup username (for use in adhoc version strings etc)
AC_ARG_WITH([build-user], [AS_HELP_STRING([--with-build-user],
[build username to use in version strings])])
if test "x$with_build_user" != x; then
USERNAME="$with_build_user"
else
# Outer [ ] to quote m4.
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
fi
AC_SUBST(USERNAME)
# Set the JDK RC name
AC_ARG_WITH(jdk-rc-name, [AS_HELP_STRING([--with-jdk-rc-name],
[Set JDK RC name. This is used for FileDescription and ProductName properties

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, 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
@@ -26,6 +26,9 @@
ifndef _ZIP_ARCHIVE_GMK
_ZIP_ARCHIVE_GMK := 1
# Depends on build tools for MakeZipReproducible
include ../ToolsJdk.gmk
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including ZipArchive.gmk)
endif
@@ -51,6 +54,8 @@ endif
# FOLLOW_SYMLINKS - Set to explicitly follow symlinks. Affects performance of
# finding files.
# ZIP_OPTIONS extra options to pass to zip
# REPRODUCIBLE override ENABLE_REPRODUCIBLE_BUILD (to make zip reproducible or not)
SetupZipArchive = $(NamedParamsMacroTemplate)
define SetupZipArchiveBody
@@ -124,6 +129,10 @@ define SetupZipArchiveBody
) \
)
ifeq ($$($1_REPRODUCIBLE), )
$1_REPRODUCIBLE := $$(ENABLE_REPRODUCIBLE_BUILD)
endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
$1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP))
@@ -134,6 +143,8 @@ define SetupZipArchiveBody
# dir is very small.
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12
# and only fail if it's not.
# For reproducible builds set the zip access & modify times to SOURCE_DATE_EPOCH
# by using a ziptmp folder to generate final zip from using MakeZipReproducible.
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$$(call LogWarn, Updating $$($1_NAME))
$$(call MakeTargetDir)
@@ -163,7 +174,18 @@ define SetupZipArchiveBody
$$($1_ZIP_EXCLUDES_$$s) \
|| test "$$$$?" = "12" \
))$$(NEWLINE) \
) true \
) true
ifeq ($$($1_REPRODUCIBLE), true)
$$(call ExecuteWithLog, \
$$(SUPPORT_OUTPUTDIR)/makezipreproducible/$$(patsubst $$(OUTPUTDIR)/%,%, $$@), \
($(RM) $$(SUPPORT_OUTPUTDIR)/ziptmp/$1/tmp.zip && \
$(MKDIR) -p $$(SUPPORT_OUTPUTDIR)/ziptmp/$1 && \
$(TOOL_MAKEZIPREPRODUCIBLE) -f $$(SUPPORT_OUTPUTDIR)/ziptmp/$1/tmp.zip \
-t $(SOURCE_DATE_EPOCH) $$@ && \
$(RM) $$@ && \
$(MV) $$(SUPPORT_OUTPUTDIR)/ziptmp/$1/tmp.zip $$@ \
))
endif
$(TOUCH) $$@
# Add zip to target list

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2021, 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. 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.
*/
/**
* This application is meant to be run to create a classlist file representing
* common use.
*
* The classlist is produced by adding -XX:DumpLoadedClassList=classlist
*/
package build.tools.classlist;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.Scanner;
/**
* The classlist generated by build.tools.classlist.HelloClasslist
* may have non-deterministic contents, affected by Java thread execution order.
* SortClasslist sorts the file to make the JDK image's contents more deterministic.
*/
public class SortClasslist {
public static void main(String args[]) throws FileNotFoundException {
ArrayList<String> classes = new ArrayList<>();
ArrayList<String> lambdas = new ArrayList<>();
FileInputStream fis = new FileInputStream(args[0]);
Scanner scanner = new Scanner(fis);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.startsWith("#")) {
// Comments -- print them first without sorting. These appear only at the top
// of the file.
System.out.println(line);
} else if (line.startsWith("@")) {
// @lambda-form-invoker, @lambda-proxy, etc.
lambdas.add(line);
} else {
// We should find a pattern like this:
//
// <beginning of line>java/lang/Object<end of line>
final String className = line;
classes.add(className);
}
}
Collections.sort(classes);
Collections.sort(lambdas);
for (String s : classes) {
System.out.println(s);
}
for (String s : lambdas) {
System.out.println(s);
}
}
}

View File

@@ -114,6 +114,7 @@ public class CLDRConverter {
ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
private static Set<String> AVAILABLE_TZIDS;
static int copyrightYear;
private static String zoneNameTempFile;
private static String tzDataDir;
private static final Map<String, String> canonicalTZMap = new HashMap<>();
@@ -217,6 +218,10 @@ public class CLDRConverter {
verbose = true;
break;
case "-year":
copyrightYear = Integer.parseInt(args[++i]);
break;
case "-zntempfile":
zoneNameTempFile = args[++i];
break;
@@ -235,7 +240,7 @@ public class CLDRConverter {
}
}
} catch (RuntimeException e) {
severe("unknown or imcomplete arg(s): " + currentArg);
severe("unknown or incomplete arg(s): " + currentArg);
usage();
System.exit(1);
}
@@ -260,6 +265,10 @@ public class CLDRConverter {
setupBaseLocales("en-US");
}
if (copyrightYear == 0) {
copyrightYear = ZonedDateTime.now(ZoneId.of("America/Los_Angeles")).getYear();
}
bundleGenerator = new ResourceBundleGenerator();
// Parse data independent of locales
@@ -292,6 +301,7 @@ public class CLDRConverter {
+ "\t-basemodule generates bundles that go into java.base module%n"
+ "\t-baselocales loc(,loc)* locales that go into the base module%n"
+ "\t-o dir output directory (default: ./build/gensrc)%n"
+ "\t-year year copyright year in output%n"
+ "\t-zntempfile template file for java.time.format.ZoneName.java%n"
+ "\t-tzdatadir tzdata directory for java.time.format.ZoneName.java%n"
+ "\t-utf8 use UTF-8 rather than \\uxxxx (for debug)%n");

View File

@@ -26,6 +26,7 @@
package build.tools.cldrconverter;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
@@ -131,8 +132,7 @@ class CopyrightHeaders {
" * questions.\n" +
" */\n";
static String getOracleCopyright() {
int year = getYear();
static String getOracleCopyright(int year) {
return String.format(year > 2012 ? ORACLE_AFTER2012 : ORACLE2012, year);
}
@@ -140,16 +140,10 @@ class CopyrightHeaders {
return UNICODE;
}
static String getOpenJDKCopyright() {
int year = getYear();
static String getOpenJDKCopyright(int year) {
return String.format(year > 2012 ? OPENJDK_AFTER2012 : OPENJDK2012, year);
}
private static int getYear() {
return new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"),
Locale.US).get(Calendar.YEAR);
}
// no instantiation
private CopyrightHeaders() {
}

View File

@@ -198,7 +198,7 @@ class ResourceBundleGenerator implements BundleGenerator {
try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright());
out.println(CopyrightHeaders.getOpenJDKCopyright(CLDRConverter.copyrightYear));
out.println(CopyrightHeaders.getUnicodeCopyright());
if (useJava) {
@@ -266,7 +266,7 @@ class ResourceBundleGenerator implements BundleGenerator {
CLDRConverter.info("Generating file " + file);
try (PrintWriter out = new PrintWriter(file, "us-ascii")) {
out.printf(CopyrightHeaders.getOpenJDKCopyright());
out.printf(CopyrightHeaders.getOpenJDKCopyright(CLDRConverter.copyrightYear));
out.printf((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
"package sun.util.resources.cldr.provider;\n\n")

View File

@@ -30,13 +30,15 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.stream.Collectors;
@@ -52,17 +54,19 @@ import java.util.stream.Collectors;
public class EquivMapsGenerator {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
if (args.length != 3) {
System.err.println("Usage: java EquivMapsGenerator"
+ " language-subtag-registry.txt LocaleEquivalentMaps.java");
+ " language-subtag-registry.txt LocaleEquivalentMaps.java copyrightYear");
System.exit(1);
}
copyrightYear = Integer.parseInt(args[2]);
readLSRfile(args[0]);
generateEquivalentMap();
generateSourceCode(args[1]);
}
private static String LSRrevisionDate;
private static int copyrightYear;
private static Map<String, StringBuilder> initialLanguageMap =
new TreeMap<>();
private static Map<String, StringBuilder> initialRegionVariantMap =
@@ -246,9 +250,7 @@ public class EquivMapsGenerator {
+ "}";
private static String getOpenJDKCopyright() {
int year = ZonedDateTime.now(ZoneId
.of("America/Los_Angeles")).getYear();
return String.format(Locale.US, COPYRIGHT, year);
return String.format(Locale.US, COPYRIGHT, copyrightYear);
}
/**

View File

@@ -0,0 +1,231 @@
/*
* Copyright (c) 2021, 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.
*/
package build.tools.makezipreproducible;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
/**
* Generate a zip file in a "reproducible" manner from the input zip file.
* Standard zip tools rely on OS file list querying whose ordering can vary
* by platform architecture, this class ensures the zip entries are ordered
* and also supports SOURCE_DATE_EPOCH timestamps.
*/
public class MakeZipReproducible {
String input_file = null;
String fname = null;
String zname = "";
long timestamp = -1L;
boolean verbose = false;
// Keep a sorted Set of ZipEntrys to be processed, so that the zip is reproducible
SortedMap<String, ZipEntry> entries = new TreeMap<String, ZipEntry>();
private boolean ok;
public MakeZipReproducible() {
}
public synchronized boolean run(String args[]) {
ok = true;
if (!parseArgs(args)) {
return false;
}
try {
zname = fname.replace(File.separatorChar, '/');
if (zname.startsWith("./")) {
zname = zname.substring(2);
}
if (verbose) System.out.println("Input zip file: " + input_file);
File inFile = new File(input_file);
if (!inFile.exists()) {
error("Input zip file does not exist");
ok = false;
} else {
File zipFile = new File(fname);
// Check archive to create does not exist
if (!zipFile.exists()) {
// Process input ZipEntries
ok = processInputEntries(inFile);
if (ok) {
try (FileOutputStream out = new FileOutputStream(fname)) {
ok = create(inFile, new BufferedOutputStream(out, 4096));
}
} else {
}
} else {
error("Target zip file "+fname+" already exists.");
ok = false;
}
}
} catch (IOException e) {
fatalError(e);
ok = false;
} catch (Error ee) {
ee.printStackTrace();
ok = false;
} catch (Throwable t) {
t.printStackTrace();
ok = false;
}
return ok;
}
boolean parseArgs(String args[]) {
try {
boolean parsingIncludes = false;
boolean parsingExcludes = false;
int count = 0;
while(count < args.length) {
if (args[count].startsWith("-")) {
String flag = args[count].substring(1);
switch (flag.charAt(0)) {
case 'f':
fname = args[++count];
break;
case 't':
// SOURCE_DATE_EPOCH timestamp specified
timestamp = Long.parseLong(args[++count]) * 1000;
break;
case 'v':
verbose = true;
break;
default:
error(String.format("Illegal option -%s", String.valueOf(flag.charAt(0))));
usageError();
return false;
}
} else {
// input zip file
if (input_file != null) {
error("Input zip file already specified");
usageError();
return false;
}
input_file = args[count];
}
count++;
}
} catch (ArrayIndexOutOfBoundsException e) {
usageError();
return false;
} catch (NumberFormatException e) {
usageError();
return false;
}
if (fname == null) {
error("-f <outputArchiveName> must be specified");
usageError();
return false;
}
// If no files specified then default to current directory
if (input_file == null) {
error("No input zip file specified");
usageError();
return false;
}
return true;
}
// Process input zip file and add to sorted entries set
boolean processInputEntries(File inFile) throws IOException {
ZipFile zipFile = new ZipFile(inFile);
zipFile.stream().forEach(entry -> entries.put(entry.getName(), entry));
return true;
}
// Create new zip from entries
boolean create(File inFile, OutputStream out) throws IOException
{
try (ZipFile zipFile = new ZipFile(inFile);
ZipOutputStream zos = new ZipOutputStream(out)) {
for (Map.Entry<String, ZipEntry> entry : entries.entrySet()) {
ZipEntry zipEntry = entry.getValue();
if (zipEntry.getSize() > 0) {
try (InputStream eis = zipFile.getInputStream(zipEntry)) {
addEntry(zos, zipEntry, eis);
}
} else {
addEntry(zos, zipEntry, null);
}
}
}
return true;
}
// Add Entry and data to Zip
void addEntry(ZipOutputStream zos, ZipEntry entry, InputStream entryInputStream) throws IOException {
if (verbose) {
System.out.println("Adding: "+entry.getName());
}
// Set to specified timestamp if set otherwise leave as original lastModified time
if (timestamp != -1L) {
entry.setTime(timestamp);
}
zos.putNextEntry(entry);
if (entry.getSize() > 0 && entryInputStream != null) {
entryInputStream.transferTo(zos);
}
zos.closeEntry();
}
void usageError() {
error(
"Usage: MakeZipReproducible [-v] [-t <SOURCE_DATE_EPOCH>] -f <output_zip_file> <input_zip_file>\n" +
"Options:\n" +
" -v verbose output\n" +
" -f specify archive file name to create\n" +
" -t specific SOURCE_DATE_EPOCH value to use for timestamps\n" +
" input_zip_file re-written as a reproducible zip output_zip_file.\n");
}
void fatalError(Exception e) {
e.printStackTrace();
}
protected void error(String s) {
System.err.println(s);
}
public static void main(String args[]) {
MakeZipReproducible z = new MakeZipReproducible();
System.exit(z.run(args) ? 0 : 1);
}
}

View File

@@ -62,6 +62,7 @@ $(CLDR_GEN_DONE): $(wildcard $(CLDR_DATA_DIR)/dtd/*.dtd) \
-baselocales "en-US" \
-o $(GENSRC_DIR) \
-basemodule \
-year $(COPYRIGHT_YEAR) \
-zntempfile $(ZONENAME_TEMPLATE) \
-tzdatadir $(TZ_DATA_DIR))
$(TOUCH) $@
@@ -99,7 +100,7 @@ GENSRC_LSREQUIVMAPS := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/Loc
$(GENSRC_LSREQUIVMAPS): $(TOPDIR)/make/data/lsrdata/language-subtag-registry.txt $(BUILD_TOOLS_JDK)
$(call MakeDir, $(@D))
$(TOOL_GENERATELSREQUIVMAPS) $< $@
$(TOOL_GENERATELSREQUIVMAPS) $< $@ $(COPYRIGHT_YEAR)
TARGETS += $(GENSRC_LSREQUIVMAPS)

View File

@@ -837,6 +837,19 @@ endif
################################################################################
# MACOSX_METAL_VERSION_MIN specifies the lowest version of Macosx
# that should be used to compile Metal shaders. We support Metal
# pipeline only on Macosx >=10.14. For Macosx versions <10.14 even if
# we enable Metal pipeline using -Dsun.java2d.metal=true, at
# runtime we force it to use OpenGL pipeline. And MACOSX_VERSION_MIN
# for aarch64 has always been >10.14 so we use continue to use
# MACOSX_VERSION_MIN for aarch64.
ifeq ($(OPENJDK_TARGET_CPU_ARCH), xaarch64)
MACOSX_METAL_VERSION_MIN=$(MACOSX_VERSION_MIN)
else
MACOSX_METAL_VERSION_MIN=10.14.0
endif
ifeq ($(call isTargetOs, macosx), true)
SHADERS_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/shaders.metal
SHADERS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libosxui
@@ -848,7 +861,9 @@ ifeq ($(call isTargetOs, macosx), true)
DEPS := $(SHADERS_SRC), \
OUTPUT_FILE := $(SHADERS_AIR), \
SUPPORT_DIR := $(SHADERS_SUPPORT_DIR), \
COMMAND := $(METAL) -c -std=osx-metal2.0 -o $(SHADERS_AIR) $(SHADERS_SRC), \
COMMAND := $(METAL) -c -std=osx-metal2.0 \
-mmacosx-version-min=$(MACOSX_METAL_VERSION_MIN) \
-o $(SHADERS_AIR) $(SHADERS_SRC), \
))
$(eval $(call SetupExecute, metallib_shaders, \

View File

@@ -72,7 +72,9 @@ $(JDK_JAVADOC_DIR)/_element_lists.marker: \
$(MODULE_INFOS)
$(call MakeTargetDir)
$(call LogInfo, Creating javadoc element lists)
$(RM) -r $(ELEMENT_LISTS_DIR)
$(RM) $(ELEMENT_LISTS_DIR)/element-list-{$(call CommaList, \
$(call sequence, $(GENERATE_SYMBOLS_FROM_JDK_VERSION), \
$(JDK_SOURCE_TARGET_VERSION)))}.txt
# Generate element-list files for JDK 11 to current-1
$(call ExecuteWithLog, $@_historic, \
$(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \

View File

@@ -46,6 +46,7 @@ $(CLDR_GEN_DONE): $(wildcard $(CLDR_DATA_DIR)/dtd/*.dtd) \
$(call ExecuteWithLog, $@, \
$(TOOL_CLDRCONVERTER) -base $(CLDR_DATA_DIR) \
-baselocales "en-US" \
-year $(COPYRIGHT_YEAR) \
-o $(GENSRC_DIR))
$(TOUCH) $@

View File

@@ -356,8 +356,8 @@ compare_general_files() {
"
$CAT $OTHER_DIR/$f | eval "$SVG_FILTER" > $OTHER_FILE
$CAT $THIS_DIR/$f | eval "$SVG_FILTER" > $THIS_FILE
elif [[ "$f" = *"/lib/classlist" ]] || [ "$SUFFIX" = "jar_contents" ]; then
# The classlist files may have some lines in random order
elif [ "$SUFFIX" = "jar_contents" ]; then
# The jar_contents files may have some lines in random order
OTHER_FILE=$WORK_DIR/$f.other
THIS_FILE=$WORK_DIR/$f.this
$MKDIR -p $(dirname $OTHER_FILE) $(dirname $THIS_FILE)

View File

@@ -1885,7 +1885,11 @@ int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
// Use always vfork on AIX, since its safe and helps with analyzing OOM situations.
// Otherwise leave it up to the caller.
AIX_ONLY(prefer_vfork = true;)
#ifdef __APPLE__
pid = ::fork();
#else
pid = prefer_vfork ? ::vfork() : ::fork();
#endif
if (pid < 0) {
// fork failed

View File

@@ -839,6 +839,19 @@ bool BlockBegin::try_merge(ValueStack* new_state) {
}
}
for_each_stack_value(existing_state, index, existing_value) {
if ( !(existing_value->as_Phi() != NULL && existing_value->as_Phi()->block() == this)) {
TRACE_PHI(tty->print_cr("Re-entered loop head without existing phi for stack - bailout"));
return false;
}
}
for_each_local_value(existing_state, index, existing_value) {
if (!(existing_value == new_state->local_at(index) || (existing_value->as_Phi() != NULL && existing_value->as_Phi()->as_Phi()->block() == this))) {
TRACE_PHI(tty->print_cr("Re-entered loop head without existing phi for modified local - bailout"));
return false;
}
}
#ifdef ASSERT
// check that all necessary phi functions are present
for_each_stack_value(existing_state, index, existing_value) {

View File

@@ -113,10 +113,12 @@ class JfrNetworkInterfaceName : public JfrSerializer {
void serialize(JfrCheckpointWriter& writer) {} // we write each constant lazily
void on_rotation() {
for (int i = 0; i < _interfaces->length(); ++i) {
const InterfaceEntry& entry = _interfaces->at(i);
if (entry.written) {
entry.written = false;
if (_interfaces != NULL) {
for (int i = 0; i < _interfaces->length(); ++i) {
const InterfaceEntry &entry = _interfaces->at(i);
if (entry.written) {
entry.written = false;
}
}
}
}

View File

@@ -327,7 +327,7 @@ public class ModuleDescriptor
*/
@Override
public int hashCode() {
int hash = name.hashCode() * 43 + mods.hashCode();
int hash = name.hashCode() * 43 + modsHashCode(mods);
if (compiledVersion != null)
hash = hash * 43 + compiledVersion.hashCode();
if (rawCompiledVersion != null)
@@ -505,7 +505,7 @@ public class ModuleDescriptor
*/
@Override
public int hashCode() {
int hash = mods.hashCode();
int hash = modsHashCode(mods);
hash = hash * 43 + source.hashCode();
return hash * 43 + targets.hashCode();
}
@@ -708,7 +708,7 @@ public class ModuleDescriptor
*/
@Override
public int hashCode() {
int hash = mods.hashCode();
int hash = modsHashCode(mods);
hash = hash * 43 + source.hashCode();
return hash * 43 + targets.hashCode();
}
@@ -2261,7 +2261,7 @@ public class ModuleDescriptor
int hc = hash;
if (hc == 0) {
hc = name.hashCode();
hc = hc * 43 + Objects.hashCode(modifiers);
hc = hc * 43 + modsHashCode(modifiers);
hc = hc * 43 + requires.hashCode();
hc = hc * 43 + Objects.hashCode(packages);
hc = hc * 43 + exports.hashCode();
@@ -2546,6 +2546,18 @@ public class ModuleDescriptor
.collect(Collectors.joining(" "));
}
/**
* Generates and returns a hashcode for the enum instances. The returned hashcode
* is a value based on the {@link Enum#name() name} of each enum instance.
*/
private static int modsHashCode(Iterable<? extends Enum<?>> enums) {
int h = 0;
for (Enum<?> e : enums) {
h = h * 43 + Objects.hashCode(e.name());
}
return h;
}
private static <T extends Object & Comparable<? super T>>
int compare(T obj1, T obj2) {
if (obj1 != null) {

View File

@@ -46,6 +46,7 @@ import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
import jdk.internal.util.StaticProperty;
import sun.nio.cs.ISO_8859_1;
import sun.nio.cs.UTF_8;
@@ -807,17 +808,25 @@ public class Properties extends Hashtable<Object,Object> {
* If the comments argument is not null, then an ASCII {@code #}
* character, the comments string, and a line separator are first written
* to the output stream. Thus, the {@code comments} can serve as an
* identifying comment. Any one of a line feed ('\n'), a carriage
* return ('\r'), or a carriage return followed immediately by a line feed
* in comments is replaced by a line separator generated by the {@code Writer}
* and if the next character in comments is not character {@code #} or
* character {@code !} then an ASCII {@code #} is written out
* after that line separator.
* identifying comment. Any one of a line feed ({@code \n}), a carriage
* return ({@code \r}), or a carriage return followed immediately by a line feed
* ({@code \r\n}) in comments is replaced by a
* {@link System#lineSeparator() line separator} and if the next
* character in comments is not character {@code #} or character {@code !} then
* an ASCII {@code #} is written out after that line separator.
* <p>
* Next, a comment line is always written, consisting of an ASCII
* {@code #} character, the current date and time (as if produced
* by the {@code toString} method of {@code Date} for the
* current time), and a line separator as generated by the {@code Writer}.
* If the {@systemProperty java.properties.date} is set on the command line
* and is non-empty (as determined by {@link String#isEmpty() String.isEmpty}),
* a comment line is written as follows.
* First, a {@code #} character is written, followed by the contents
* of the property, followed by a line separator. Any line terminator characters
* in the value of the system property are treated the same way as noted above
* for the comments argument.
* If the system property is not set or is empty, a comment line is written
* as follows.
* First, a {@code #} character is written, followed by the current date and time
* formatted as if by the {@link Date#toString() Date.toString} method,
* followed by a line separator.
* <p>
* Then every entry in this {@code Properties} table is
* written out, one per line. For each entry the key string is
@@ -833,6 +842,10 @@ public class Properties extends Hashtable<Object,Object> {
* After the entries have been written, the output stream is flushed.
* The output stream remains open after this method returns.
*
* @implSpec The keys and elements are written in the natural sort order
* of the keys in the {@code entrySet()} unless {@code entrySet()} is
* overridden by a subclass to return a different value than {@code super.entrySet()}.
*
* @param writer an output character stream writer.
* @param comments a description of the property list.
* @throws IOException if writing this property list to the specified
@@ -903,12 +916,25 @@ public class Properties extends Hashtable<Object,Object> {
if (comments != null) {
writeComments(bw, comments);
}
bw.write("#" + new Date().toString());
bw.newLine();
writeDateComment(bw);
synchronized (this) {
for (Map.Entry<Object, Object> e : entrySet()) {
String key = (String)e.getKey();
String val = (String)e.getValue();
@SuppressWarnings("unchecked")
Collection<Map.Entry<String, String>> entries = (Set<Map.Entry<String, String>>) (Set) entrySet();
// entrySet() can be overridden by subclasses. Here we check to see if
// the returned instance type is the one returned by the Properties.entrySet()
// implementation. If yes, then we sort those entries in the natural order
// of their key. Else, we consider that the subclassed implementation may
// potentially have returned a differently ordered entries and so we just
// use the iteration order of the returned instance.
if (entries instanceof Collections.SynchronizedSet<?> ss
&& ss.c instanceof EntrySet) {
entries = new ArrayList<>(entries);
((List<Map.Entry<String, String>>) entries).sort(Map.Entry.comparingByKey());
}
for (Map.Entry<String, String> e : entries) {
String key = e.getKey();
String val = e.getValue();
key = saveConvert(key, true, escUnicode);
/* No need to escape embedded and trailing spaces for value, hence
* pass false to flag.
@@ -921,6 +947,19 @@ public class Properties extends Hashtable<Object,Object> {
bw.flush();
}
private static void writeDateComment(BufferedWriter bw) throws IOException {
// value of java.properties.date system property isn't sensitive
// and so doesn't need any security manager checks to make the value accessible
// to the callers
String sysPropVal = StaticProperty.javaPropertiesDate();
if (sysPropVal != null && !sysPropVal.isEmpty()) {
writeComments(bw, sysPropVal);
} else {
bw.write("#" + new Date());
bw.newLine();
}
}
/**
* Loads all of the properties represented by the XML document on the
* specified input stream into this properties table.

View File

@@ -50,6 +50,7 @@ public final class StaticProperty {
private static final String JDK_SERIAL_FILTER_FACTORY;
private static final String JAVA_IO_TMPDIR;
private static final String NATIVE_ENCODING;
private static final String JAVA_PROPERTIES_DATE;
private StaticProperty() {}
@@ -65,6 +66,7 @@ public final class StaticProperty {
JDK_SERIAL_FILTER = getProperty(props, "jdk.serialFilter", null);
JDK_SERIAL_FILTER_FACTORY = getProperty(props, "jdk.serialFilterFactory", null);
NATIVE_ENCODING = getProperty(props, "native.encoding");
JAVA_PROPERTIES_DATE = getProperty(props, "java.properties.date", null);
}
private static String getProperty(Properties props, String key) {
@@ -212,4 +214,16 @@ public final class StaticProperty {
public static String nativeEncoding() {
return NATIVE_ENCODING;
}
/**
* Return the {@code java.properties.date} system property.
*
* <strong>{@link SecurityManager#checkPropertyAccess} is NOT checked
* in this method.</strong>
*
* @return the {@code java.properties.date} system property
*/
public static String javaPropertiesDate() {
return JAVA_PROPERTIES_DATE;
}
}

View File

@@ -129,12 +129,12 @@ module java.base {
exports javax.security.auth.spi;
exports javax.security.auth.x500;
exports javax.security.cert;
exports com.jetbrains.bootstrap;
// additional qualified exports may be inserted at build time
// see make/gensrc/GenModuleInfo.gmk
opens com.jetbrains.bootstrap;
exports com.jetbrains.internal to
java.desktop;
exports com.sun.crypto.provider to

View File

@@ -139,6 +139,8 @@ class UnixDomainSockets {
return UnixDomainSocketAddress.of(path);
} catch (InvalidPathException e) {
throw new BindException("Invalid temporary directory");
} catch (IllegalArgumentException e) {
throw new UnsupportedOperationException("Unix Domain Sockets not supported on non-default file system");
}
}

View File

@@ -444,7 +444,8 @@ static int copystrings(char *buf, int offset, const char * const *arg) {
__attribute_noinline__
#endif
/* vfork(2) is deprecated on Solaris */
/* vfork(2) is deprecated on Darwin */
#ifndef __APPLE__
static pid_t
vforkChild(ChildStuff *c) {
volatile pid_t resultPid;
@@ -463,6 +464,7 @@ vforkChild(ChildStuff *c) {
assert(resultPid != 0); /* childProcess never returns */
return resultPid;
}
#endif
static pid_t
forkChild(ChildStuff *c) {
@@ -573,9 +575,11 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
static pid_t
startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
switch (c->mode) {
/* vfork(2) is deprecated on Solaris */
/* vfork(2) is deprecated on Darwin*/
#ifndef __APPLE__
case MODE_VFORK:
return vforkChild(c);
#endif
case MODE_FORK:
return forkChild(c);
case MODE_POSIX_SPAWN:

View File

@@ -43,6 +43,7 @@ final class GestureHandler {
@Native static final int ROTATE = 2;
@Native static final int MAGNIFY = 3;
@Native static final int SWIPE = 4;
@Native static final int PRESSURE = 5;
// installs a private instance of GestureHandler, if necessary
static void addGestureListenerTo(final JComponent component, final GestureListener listener) {
@@ -97,6 +98,9 @@ final class GestureHandler {
case SWIPE:
firstNotifier.recursivelyHandleSwipe(a, b, new SwipeEvent());
return;
case PRESSURE:
firstNotifier.recursivelyHandlePressure(new PressureEvent(a,b));
return;
}
}
});
@@ -107,6 +111,7 @@ final class GestureHandler {
final List<RotationListener> rotaters = new LinkedList<RotationListener>();
final List<MagnificationListener> magnifiers = new LinkedList<MagnificationListener>();
final List<SwipeListener> swipers = new LinkedList<SwipeListener>();
final List<PressureListener> pressures = new LinkedList<PressureListener>();
GestureHandler() { }
@@ -115,6 +120,7 @@ final class GestureHandler {
if (listener instanceof RotationListener) rotaters.add((RotationListener)listener);
if (listener instanceof MagnificationListener) magnifiers.add((MagnificationListener)listener);
if (listener instanceof SwipeListener) swipers.add((SwipeListener)listener);
if (listener instanceof PressureListener) pressures.add((PressureListener)listener);
}
void removeListener(final GestureListener listener) {
@@ -169,6 +175,16 @@ final class GestureHandler {
if (next != null) next.recursivelyHandleMagnify(e);
}
void recursivelyHandlePressure(final PressureEvent e) {
for (final PressureListener listener : handler.pressures) {
listener.pressure(e);
if (e.isConsumed()) return;
}
final PerComponentNotifier next = getNextNotifierForComponent(component.getParent());
if (next != null) next.recursivelyHandlePressure(e);
}
void recursivelyHandleSwipe(final double x, final double y, final SwipeEvent e) {
for (final SwipeListener listener : handler.swipers) {
if (x < 0) listener.swipedLeft(e);

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2011, 2012, 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. 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.apple.eawt.event;
/**
* Event indicating a swipe was performed by the user.
*
* @see PressureListener
*
* @since Java for Mac OS X 10.10 Update 3, JDK 8
*/
public class PressureEvent extends GestureEvent {
public double getPressure() {
return pressure;
}
public double getStage() {
return stage;
}
private double pressure;
private double stage;
PressureEvent(double pressure, double stage) {
this.pressure = pressure;
this.stage = stage;
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2011, 2012, 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. 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.apple.eawt.event;
/**
* Listener interface for receiving pressure events.
*
* @see PressureEvent
* @see GestureUtilities
*
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
*/
public interface PressureListener extends GestureListener {
public void pressure(final PressureEvent e);
}

View File

@@ -128,12 +128,8 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
};
}
// This mapper returns either the glyph code, or if the character can be
// replaced on-the-fly using CoreText substitution; the negative unicode
// value. If this "glyph code int" is treated as an opaque code, it will
// strike and measure exactly as a real glyph code - whether the character
// is present or not. Missing characters for any font on the system will
// be returned as 0, as the getMissingGlyphCode() function above indicates.
// Missing characters for any font on the system will be returned as 0,
// as the getMissingGlyphCode() function above indicates.
private static native void nativeCharsToGlyphs(final long nativeFontPtr,
int count, char[] unicodes,
int[] glyphs);

View File

@@ -1,81 +0,0 @@
/*
* Copyright 2000-2018 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.
*/
package sun.font;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
public final class CCompositeFont extends CompositeFont {
private final List<CFont> fallbackFonts = new ArrayList<>();
public CCompositeFont(CFont font) {
super(new PhysicalFont[]{font});
mapper = new CCompositeGlyphMapper(this);
}
@Override
public synchronized int getNumSlots() {
return super.getNumSlots();
}
@Override
public CFont getSlotFont(int slot) {
if (slot == 0) return (CFont) super.getSlotFont(0);
synchronized (this) {
return fallbackFonts.get(slot - 1);
}
}
@Override
synchronized FontStrike getStrike(FontStrikeDesc desc, boolean copy) {
return super.getStrike(desc, copy);
}
@Override
protected synchronized int getValidatedGlyphCode(int glyphCode) {
return super.getValidatedGlyphCode(glyphCode);
}
@Override
public boolean hasSupplementaryChars() {
return false;
}
@Override
public boolean useAAForPtSize(int ptsize) {
return true;
}
public synchronized int findSlot(String fontName) {
for (int slot = 0; slot < numSlots; slot++) {
CFont slotFont = getSlotFont(slot);
if (fontName.equals(slotFont.getNativeFontName())) {
return slot;
}
}
return -1;
}
public synchronized int addSlot(CFont font) {
int slot = findSlot(font.getNativeFontName());
if (slot >= 0) return slot;
fallbackFonts.add(font);
lastFontStrike = new SoftReference<>(null);
strikeCache.clear();
return numSlots++;
}
}

View File

@@ -1,79 +0,0 @@
/*
* Copyright (c) 2015, 2018, 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. 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 sun.font;
import java.awt.*;
public final class CCompositeGlyphMapper extends CompositeGlyphMapper {
public CCompositeGlyphMapper(CCompositeFont compFont) {
super(compFont);
}
@Override
protected int convertToGlyph(int unicode) {
CCompositeFont compositeFont = (CCompositeFont) font;
CFont mainFont = (CFont) font.getSlotFont(0);
String[] fallbackFontInfo = new String[2];
int glyphCode = nativeCodePointToGlyph(mainFont.getNativeFontPtr(), unicode, fallbackFontInfo);
if (glyphCode == missingGlyph) {
setCachedGlyphCode(unicode, missingGlyph);
return missingGlyph;
}
String fallbackFontName = fallbackFontInfo[0];
String fallbackFontFamilyName = fallbackFontInfo[1];
if (fallbackFontName == null || fallbackFontFamilyName == null) {
int result = compositeGlyphCode(0, glyphCode);
setCachedGlyphCode(unicode, result);
return result;
}
int slot = compositeFont.findSlot(fallbackFontName);
if (slot < 0) {
Font2D fallbackFont = FontManagerFactory.getInstance().findFont2D(fallbackFontName,
Font.PLAIN, FontManager.NO_FALLBACK);
if (!(fallbackFont instanceof CFont) ||
!fallbackFontName.equals(((CFont) fallbackFont).getNativeFontName())) {
// Native font fallback mechanism can return "hidden" fonts - their names start with dot,
// and they are not returned in a list of fonts available in system, but they can still be used
// if requested explicitly.
fallbackFont = new CFont(fallbackFontName, fallbackFontFamilyName, null);
}
if (mainFont.isFakeItalic()) fallbackFont = ((CFont)fallbackFont).createItalicVariant(false);
slot = compositeFont.addSlot((CFont) fallbackFont);
}
int result = compositeGlyphCode(slot, glyphCode);
setCachedGlyphCode(unicode, result);
return result;
}
// This invokes native font fallback mechanism, returning information about font (its Postscript and family names)
// able to display a given character, and corresponding glyph code
private static native int nativeCodePointToGlyph(long nativeFontPtr, int codePoint, String[] result);
}

View File

@@ -31,6 +31,9 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
// Right now this class is final to avoid a problem with native code.
// For some reason the JNI IsInstanceOf was not working correctly
@@ -175,14 +178,12 @@ public final class CFont extends PhysicalFont implements FontSubstitution, FontW
isFakeItalic = other.isFakeItalic;
}
public CFont createItalicVariant(boolean updateStyle) {
public CFont createItalicVariant() {
CFont font = new CFont(this, familyName);
font.nativeFontName = fullName;
font.fullName =
fullName + (style == Font.BOLD ? "" : "-") + "Italic-Derived";
if (updateStyle) {
font.style |= Font.ITALIC;
}
font.style |= Font.ITALIC;
font.isFakeItalic = true;
return font;
}
@@ -204,11 +205,51 @@ public final class CFont extends PhysicalFont implements FontSubstitution, FontW
return getCGFontPtrNative(getNativeFontPtr());
}
static native void getCascadeList(long nativeFontPtr, ArrayList<String> listOfString);
private CompositeFont createCompositeFont() {
ArrayList<String> listOfString = new ArrayList<String>();
getCascadeList(getNativeFontPtr(), listOfString);
Set<String> components = new LinkedHashSet<>(listOfString);
// In some italic cases the standard Mac cascade list is missing Arabic.
components.add("GeezaPro");
CFontManager fm = (CFontManager) FontManagerFactory.getInstance();
components.addAll(fm.getAdditionalFallbackVariants());
int numFonts = 1 + components.size();
PhysicalFont[] fonts = new PhysicalFont[numFonts];
fonts[0] = this;
int idx = 1;
if (FontUtilities.isLogging()) {
FontUtilities.logInfo("Cascading list for " + this + " :");
}
for (String s : components) {
if (FontUtilities.isLogging()) {
FontUtilities.logInfo("Fallback:" + s);
}
if (s.equals(".AppleSymbolsFB")) {
// Don't know why we get the weird name above .. replace.
s = "AppleSymbols";
}
Font2D f2d = fm.getOrCreateFallbackFont(s);
if (f2d == null || f2d == this) {
continue;
}
fonts[idx++] = (PhysicalFont)f2d;
}
if (idx < fonts.length) {
PhysicalFont[] orig = fonts;
fonts = new PhysicalFont[idx];
System.arraycopy(orig, 0, fonts, 0, idx);
}
return new CompositeFont(fonts);
}
private CompositeFont compFont;
public CompositeFont getCompositeFont2D() {
if (compFont == null) {
compFont = new CCompositeFont(this);
compFont = createCompositeFont();
}
return compFont;
}
@@ -236,14 +277,6 @@ public final class CFont extends PhysicalFont implements FontSubstitution, FontW
return new CStrike(this, desc);
}
boolean isFakeItalic() {
return isFakeItalic;
}
String getNativeFontName() {
return nativeFontName;
}
@Override
public String getTypographicSubfamilyName() {
return faceName == null ? super.getTypographicSubfamilyName() : faceName;
@@ -276,8 +309,4 @@ public final class CFont extends PhysicalFont implements FontSubstitution, FontW
", familyName: " + familyName + ", style: " + style +
" } aka: " + super.toString();
}
public Font2D createItalic() {
return this.createItalicVariant(true);
}
}

View File

@@ -30,20 +30,27 @@ import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import javax.swing.plaf.FontUIResource;
import sun.awt.FontConfiguration;
import sun.awt.HeadlessToolkit;
import sun.lwawt.macosx.*;
import sun.security.action.GetBooleanAction;
import sun.util.logging.PlatformLogger;
public final class CFontManager extends SunFontManager {
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
private final Map<String, Font2D> fallbackFonts = new ConcurrentHashMap<>();
private final List<String> extFallbackVariants = new ArrayList<>();
@Override
protected FontConfiguration createFontConfiguration() {
@@ -230,6 +237,7 @@ public final class CFontManager extends SunFontManager {
public Object run() {
if (!loadedAllFonts) {
loadNativeFonts();
collectAdditionalFallbackVariants();
loadedAllFonts = true;
}
return null;
@@ -337,4 +345,40 @@ public final class CFontManager extends SunFontManager {
@Override
protected void populateFontFileNameMap(HashMap<String, String> fontToFileMap, HashMap<String, String> fontToFamilyNameMap,
HashMap<String, ArrayList<String>> familyToFontListMap, Locale locale) {}
@SuppressWarnings("removal")
private void collectAdditionalFallbackVariants() {
if (AccessController.doPrivileged(new GetBooleanAction("mac.ext.font.fallback"))) {
for (String fontName : genericFonts.keySet()) {
boolean accept = false;
if (fontName.equals("ArialUnicodeMS")) {
accept = true;
} else if (fontName.startsWith("NotoSans")) {
int pos = fontName.indexOf('-');
accept = pos == -1 || fontName.substring(pos + 1).equals("Regular");
}
if (accept) {
extFallbackVariants.add(fontName);
}
}
Collections.sort(extFallbackVariants); // ensure predictable order
}
}
List<String> getAdditionalFallbackVariants() {
return extFallbackVariants;
}
Font2D getOrCreateFallbackFont(String fontName) {
Font2D font2D = findFont2D(fontName, Font.PLAIN, FontManager.NO_FALLBACK);
if (font2D != null || fontName.startsWith(".")) {
return font2D;
} else {
// macOS doesn't list some system fonts in [NSFontManager availableFontFamilies] output,
// so they are not registered in font manager as part of 'loadNativeFonts'.
// These fonts are present in [NSFontManager availableFonts] output though,
// and can be accessed in the same way as other system fonts.
return fallbackFonts.computeIfAbsent(fontName, name -> new CFont(name, null, null));
}
}
}

View File

@@ -358,18 +358,14 @@ public final class CStrike extends PhysicalStrike {
}
}
// This class stores glyph pointers, and is indexed based on glyph codes,
// and negative unicode values. See the comments in
// CCharToGlyphMapper for more details on our glyph code strategy.
// This class stores glyph pointers, and is indexed based on glyph codes.
private static class GlyphInfoCache extends CStrikeDisposer {
private static final int FIRST_LAYER_SIZE = 256;
private static final int SECOND_LAYER_SIZE = 16384; // 16384 = 128x128
// rdar://problem/5204197
private final AtomicBoolean disposed = new AtomicBoolean(false);
private final long[] firstLayerCache;
private SparseBitShiftingTwoLayerArray secondLayerCache;
private HashMap<Integer, Long> generalCache;
GlyphInfoCache(final Font2D nativeFont, final FontStrikeDesc desc) {
@@ -378,19 +374,9 @@ public final class CStrike extends PhysicalStrike {
}
public synchronized long get(final int index) {
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
return 0L;
}
return secondLayerCache.get(-index);
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
if (generalCache == null) {
@@ -404,21 +390,10 @@ public final class CStrike extends PhysicalStrike {
}
public synchronized void put(final int index, final long value) {
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
secondLayerCache = new SparseBitShiftingTwoLayerArray(SECOND_LAYER_SIZE, 7); // 128x128
}
secondLayerCache.put(-index, value);
return;
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
firstLayerCache[index] = value;
return;
}
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
firstLayerCache[index] = value;
return;
}
if (generalCache == null) {
@@ -441,14 +416,6 @@ public final class CStrike extends PhysicalStrike {
// clean out the first array
disposeLongArray(firstLayerCache);
// clean out the two layer arrays
if (secondLayerCache != null) {
final long[][] secondLayerLongArrayArray = secondLayerCache.cache;
for (final long[] longArray : secondLayerLongArrayArray) {
if (longArray != null) disposeLongArray(longArray);
}
}
// clean up everyone else
if (generalCache != null) {
for (Long aLong : generalCache.values()) {
@@ -485,56 +452,18 @@ public final class CStrike extends PhysicalStrike {
}
}
}
private static class SparseBitShiftingTwoLayerArray {
final long[][] cache;
final int shift;
final int secondLayerLength;
SparseBitShiftingTwoLayerArray(final int size, final int shift) {
this.shift = shift;
this.cache = new long[1 << shift][];
this.secondLayerLength = size >> shift;
}
public long get(final int index) {
final int firstIndex = index >> shift;
final long[] firstLayerRow = cache[firstIndex];
if (firstLayerRow == null) return 0L;
return firstLayerRow[index - (firstIndex * (1 << shift))];
}
public void put(final int index, final long value) {
final int firstIndex = index >> shift;
long[] firstLayerRow = cache[firstIndex];
if (firstLayerRow == null) {
cache[firstIndex] = firstLayerRow = new long[secondLayerLength];
}
firstLayerRow[index - (firstIndex * (1 << shift))] = value;
}
}
}
private static class GlyphAdvanceCache {
private static final int FIRST_LAYER_SIZE = 256;
private static final int SECOND_LAYER_SIZE = 16384; // 16384 = 128x128
private final float[] firstLayerCache = new float[FIRST_LAYER_SIZE];
private SparseBitShiftingTwoLayerArray secondLayerCache;
private HashMap<Integer, Float> generalCache;
public synchronized float get(final int index) {
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) return 0;
return secondLayerCache.get(-index);
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
if (generalCache == null) return 0;
@@ -544,21 +473,10 @@ public final class CStrike extends PhysicalStrike {
}
public synchronized void put(final int index, final float value) {
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
secondLayerCache = new SparseBitShiftingTwoLayerArray(SECOND_LAYER_SIZE, 7); // 128x128
}
secondLayerCache.put(-index, value);
return;
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
firstLayerCache[index] = value;
return;
}
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
firstLayerCache[index] = value;
return;
}
if (generalCache == null) {
@@ -567,34 +485,5 @@ public final class CStrike extends PhysicalStrike {
generalCache.put(Integer.valueOf(index), Float.valueOf(value));
}
private static class SparseBitShiftingTwoLayerArray {
final float[][] cache;
final int shift;
final int secondLayerLength;
SparseBitShiftingTwoLayerArray(final int size, final int shift) {
this.shift = shift;
this.cache = new float[1 << shift][];
this.secondLayerLength = size >> shift;
}
public float get(final int index) {
final int firstIndex = index >> shift;
final float[] firstLayerRow = cache[firstIndex];
if (firstLayerRow == null) return 0L;
return firstLayerRow[index - (firstIndex * (1 << shift))];
}
public void put(final int index, final float value) {
final int firstIndex = index >> shift;
float[] firstLayerRow = cache[firstIndex];
if (firstLayerRow == null) {
cache[firstIndex] = firstLayerRow =
new float[secondLayerLength];
}
firstLayerRow[index - (firstIndex * (1 << shift))] = value;
}
}
}
}

View File

@@ -1246,23 +1246,6 @@ public class LWWindowPeer
return false;
}
AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget());
KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor()
.getCurrentKeyboardFocusManager(targetAppContext);
Window currentActive = kfm.getActiveWindow();
Window opposite = LWKeyboardFocusManagerPeer.getInstance().
getCurrentFocusedWindow();
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
if (getTarget() == currentActive && !getTarget().hasFocus()) {
changeFocusedWindow(true, opposite);
return true;
}
return platformWindow.requestWindowFocus();
}

View File

@@ -25,13 +25,14 @@
package sun.lwawt.macosx;
import java.awt.Component;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.security.PrivilegedAction;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.JTabbedPane;
import javax.swing.*;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_CARET_PROPERTY;
@@ -48,6 +49,20 @@ import sun.awt.AWTAccessor;
class CAccessible extends CFRetainedResource implements Accessible {
private static Timer timer = null;
private final static int SELECTED_CHILDREN_MILLISECONDS_DEFAULT = 100;
private static int SELECTED_CHILDREN_MILLISECONDS;
static {
@SuppressWarnings("removal") int scms = java.security.AccessController.doPrivileged(new PrivilegedAction<Integer>() {
@Override
public Integer run() {
return Integer.getInteger("sun.lwawt.macosx.CAccessible.selectedChildrenMilliSeconds",
SELECTED_CHILDREN_MILLISECONDS_DEFAULT);
}
});
SELECTED_CHILDREN_MILLISECONDS = scms >= 0 ? scms : SELECTED_CHILDREN_MILLISECONDS_DEFAULT;
}
public static CAccessible getCAccessible(final Accessible a) {
if (a == null) return null;
@@ -112,19 +127,25 @@ class CAccessible extends CFRetainedResource implements Accessible {
@Override
public void propertyChange(PropertyChangeEvent e) {
assert EventQueue.isDispatchThread();
String name = e.getPropertyName();
if ( ptr != 0 ) {
Object newValue = e.getNewValue();
Object oldValue = e.getOldValue();
if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) {
selectedTextChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0) {
valueChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0) {
selectionChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_TABLE_MODEL_CHANGED) == 0) {
valueChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) {
if (name.equals(ACCESSIBLE_CARET_PROPERTY)) {
execute(ptr -> selectedTextChanged(ptr));
} else if (name.equals(ACCESSIBLE_TEXT_PROPERTY)) {
execute(ptr -> valueChanged(ptr));
} else if (name.equals(ACCESSIBLE_SELECTION_PROPERTY)) {
if (timer != null) {
timer.stop();
}
timer = new Timer(SELECTED_CHILDREN_MILLISECONDS, actionEvent -> execute(ptr -> selectionChanged(ptr)));
timer.setRepeats(false);
timer.start();
} else if (name.equals(ACCESSIBLE_TABLE_MODEL_CHANGED)) {
execute(ptr -> valueChanged(ptr));
} else if (name.equals(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY)) {
if (newValue == null || newValue instanceof AccessibleContext) {
activeDescendant = (AccessibleContext)newValue;
if (newValue instanceof Accessible) {
@@ -135,7 +156,7 @@ class CAccessible extends CFRetainedResource implements Accessible {
if (p != null) {
AccessibleContext pac = p.getAccessibleContext();
if ((pac != null) && (pac.getAccessibleRole() == AccessibleRole.TABLE)) {
selectedCellsChanged(ptr);
execute(ptr -> selectedCellsChanged(ptr));
}
}
}
@@ -151,47 +172,54 @@ class CAccessible extends CFRetainedResource implements Accessible {
}
if (newValue == AccessibleState.EXPANDED) {
treeNodeExpanded(ptr);
execute(ptr -> treeNodeExpanded(ptr));
} else if (newValue == AccessibleState.COLLAPSED) {
treeNodeCollapsed(ptr);
execute(ptr -> treeNodeCollapsed(ptr));
}
// At least for now don't handle combo box menu state changes.
// This may change when later fixing issues which currently
// exist for combo boxes, but for now the following is only
// for JPopupMenus, not for combobox menus.
if (parentRole != AccessibleRole.COMBO_BOX) {
if (thisRole == AccessibleRole.POPUP_MENU) {
if ( newValue != null &&
((AccessibleState)newValue) == AccessibleState.VISIBLE ) {
menuOpened(ptr);
} else if ( oldValue != null &&
((AccessibleState)oldValue) == AccessibleState.VISIBLE ) {
menuClosed(ptr);
}
} else if (thisRole == AccessibleRole.MENU_ITEM) {
if ( newValue != null &&
((AccessibleState)newValue) == AccessibleState.FOCUSED ) {
menuItemSelected(ptr);
}
if (thisRole == AccessibleRole.COMBO_BOX) {
if (timer != null) {
timer.stop();
}
timer = new Timer(SELECTED_CHILDREN_MILLISECONDS, actionEvent -> execute(ptr -> selectionChanged(ptr)));
timer.setRepeats(false);
timer.start();
}
if (thisRole == AccessibleRole.POPUP_MENU) {
if (newValue != null &&
((AccessibleState) newValue) == AccessibleState.VISIBLE) {
execute(ptr -> menuOpened(ptr));
} else if (oldValue != null &&
((AccessibleState) oldValue) == AccessibleState.VISIBLE) {
execute(ptr -> menuClosed(ptr));
}
} else if (thisRole == AccessibleRole.MENU_ITEM) {
if (newValue != null &&
((AccessibleState) newValue) == AccessibleState.FOCUSED) {
execute(ptr -> menuItemSelected(ptr));
}
}
// Do send check box state changes to native side
if (thisRole == AccessibleRole.CHECK_BOX) {
valueChanged(ptr);
execute(ptr -> valueChanged(ptr));
}
} else if (name.compareTo(ACCESSIBLE_NAME_PROPERTY) == 0) {
//for now trigger only for JTabbedPane.
if (e.getSource() instanceof JTabbedPane) {
titleChanged(ptr);
execute(ptr -> titleChanged(ptr));
}
} else if (name.compareTo(ACCESSIBLE_VALUE_PROPERTY) == 0) {
AccessibleRole thisRole = accessible.getAccessibleContext()
.getAccessibleRole();
if (thisRole == AccessibleRole.SLIDER ||
thisRole == AccessibleRole.PROGRESS_BAR) {
valueChanged(ptr);
execute(ptr -> valueChanged(ptr));
}
}
}

View File

@@ -101,6 +101,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private static native void nativeExitFullScreenMode(long nsWindowPtr);
static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
private static native boolean nativeDelayShowing(long nsWindowPtr);
private static native void nativeRaiseLevel(long nsWindowPtr, boolean popup, boolean onlyIfParentIsActive);
// Loger to report issues happened during execution but that do not affect functionality
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
@@ -1387,10 +1388,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
protected void applyWindowLevel(Window target) {
if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) {
execute(ptr->CWrapper.NSWindow.setLevel(ptr, CWrapper.NSWindow.NSFloatingWindowLevel));
} else if (target.getType() == Window.Type.POPUP) {
execute(ptr->CWrapper.NSWindow.setLevel(ptr, CWrapper.NSWindow.NSPopUpMenuWindowLevel));
boolean popup = target.getType() == Window.Type.POPUP;
boolean alwaysOnTop = target.isAlwaysOnTop();
if (popup || alwaysOnTop || owner != null) {
execute(ptr -> nativeRaiseLevel(ptr, popup, !popup && !alwaysOnTop));
}
}

View File

@@ -32,6 +32,7 @@
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
#import "PropertiesUtilities.h"
#import <Carbon/Carbon.h>
@@ -358,9 +359,16 @@ extern bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, N
}
NSUInteger deviceIndependentModifierFlagsMask =
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
NSString *captureNextAppWinKey = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.captureNextAppWinKey"
withEnv:env];
if ([@"false" isCaseInsensitiveLike:captureNextAppWinKey]) {
return NO;
} else {
NSUInteger deviceIndependentModifierFlagsMask =
[event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
return isSystemShortcut_NextWindowInApplication(deviceIndependentModifierFlagsMask, [event characters]);
return isSystemShortcut_NextWindowInApplication(deviceIndependentModifierFlagsMask, [event characters]);
}
}
/**

View File

@@ -231,6 +231,15 @@ AWT_NS_WINDOW_IMPLEMENTATION
b:[event deltaY]];
}
- (void)pressureChangeWithEvent:(NSEvent *)event {
float pressure = event.pressure;
[self postGesture:event
as:com_apple_eawt_event_GestureHandler_PRESSURE
a:pressure
b:(([event respondsToSelector:@selector(stage)]) ? ((NSInteger)[event stage]) : -1)
];
}
- (void)moveTabToNewWindow:(id)sender {
AWT_ASSERT_APPKIT_THREAD;
@@ -1972,6 +1981,29 @@ JNI_COCOA_ENTER(env);
JNI_COCOA_EXIT(env);
}
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeRaiseLevel
(JNIEnv *env, jclass clazz, jlong windowPtr, jboolean popup, jboolean onlyIfParentIsActive)
{
JNI_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
if (onlyIfParentIsActive) {
AWTWindow *parent = window;
do {
parent = parent.ownerWindow;
} while (parent != nil && !parent.nsWindow.isMainWindow);
if (parent == nil) {
return;
}
}
[nsWindow setLevel: popup ? NSPopUpMenuWindowLevel : NSFloatingWindowLevel];
}];
JNI_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeDelayShowing

View File

@@ -125,11 +125,35 @@ canChooseDirectories:(BOOL)inChooseDirectories
}
[thePanel setDelegate:self];
NSMenuItem *editMenuItem = nil;
NSMenu *menu = [NSApp mainMenu];
if (menu != nil) {
if (menu.numberOfItems > 0) {
NSMenu *submenu = [[menu itemAtIndex:0] submenu];
if (submenu != nil) {
menu = submenu;
}
}
editMenuItem = [self createEditMenu];
if (menu.numberOfItems > 0) {
[menu insertItem:editMenuItem atIndex:0];
} else {
[menu addItem:editMenuItem];
}
[editMenuItem release];
}
fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile];
[thePanel setDelegate:nil];
CMenuBar *menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
[CMenuBar activate:menuBar modallyDisabled:NO];
if (editMenuItem != nil) {
[menu removeItem:editMenuItem];
}
if ([self userClickedOK]) {
if (fMode == java_awt_FileDialog_LOAD) {
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
@@ -144,6 +168,33 @@ canChooseDirectories:(BOOL)inChooseDirectories
[self disposer];
}
- (NSMenuItem *) createEditMenu {
NSMenu *editMenu = [[NSMenu alloc] initWithTitle:@"Edit"];
NSMenuItem *cutItem = [[NSMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"];
[editMenu addItem:cutItem];
[cutItem release];
NSMenuItem *copyItem = [[NSMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"];
[editMenu addItem:copyItem];
[copyItem release];
NSMenuItem *pasteItem = [[NSMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"];
[editMenu addItem:pasteItem];
[pasteItem release];
NSMenuItem *selectAllItem = [[NSMenuItem alloc] initWithTitle:@"Select All" action:@selector(selectAll:) keyEquivalent:@"a"];
[editMenu addItem:selectAllItem];
[selectAllItem release];
NSMenuItem *editMenuItem = [NSMenuItem new];
[editMenuItem setTitle:@"Edit"];
[editMenuItem setSubmenu:editMenu];
[editMenu release];
return editMenuItem;
}
- (BOOL) askFilenameFilter:(NSString *)filename {
JNIEnv *env = [ThreadUtilities getJNIEnv];
jstring jString = NormalizedPathJavaStringFromNSString(env, filename);

Some files were not shown because too many files have changed in this diff Show More