Skip to content

Commit e79f3e2

Browse files
Merge branch 'master' into JDK-8333664
2 parents ec97732 + cc3a366 commit e79f3e2

File tree

309 files changed

+3861
-2758
lines changed

Some content is hidden

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

309 files changed

+3861
-2758
lines changed

doc/building.html

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,29 @@ <h3 id="special-considerations">Special Considerations</h3>
282282
having slow disk access will significantly increase build times. If you
283283
need to use a network share for the source code, see below for
284284
suggestions on how to keep the build artifacts on a local disk.</p></li>
285-
<li><p>On Windows, if using <a href="#cygwin">Cygwin</a>, extra care
286-
must be taken to make sure the environment is consistent. It is
287-
recommended that you follow this procedure:</p>
285+
<li><p>On Windows, extra care must be taken to have a smooth building
286+
experience:</p>
287+
<ul>
288+
<li><p>Make sure that all relevant paths have short names. Short names
289+
are used by the build system to create space-free alternative paths.
290+
Short name creation is enabled per volume. The default setting can be
291+
checked with the command: <code>fsutil 8dot3name query</code>. If short
292+
name creation was turned off when a directory was created, it will not
293+
have a short name. Whether a short name exists can be checked by running
294+
<code>dir /X</code> in the containing directory (in cmd.exe). If a short
295+
path is present you should see something like 'ASDF~1' being displayed
296+
in one of the columns of the ouput. If a directory is missing a short
297+
name, the safest way to get one is to enable short names for that
298+
particular volume with
299+
<code>fsutil 8dot3name set &lt;drive letter&gt;: 0</code> (note that
300+
you need to run as administrator for this), and then re-create the
301+
particular directory. A short name should be generated automatically
302+
then. Another option is to manually assign a short name to the directory
303+
using
304+
<code>fsutil file setShortName &lt;path&gt; &lt;short name&gt;</code>.</p></li>
305+
<li><p>If using <a href="#cygwin">Cygwin</a>, you must make sure the
306+
file permissions and attributes between Windows and Cygwin are
307+
consistent. It is recommended that you follow this procedure:</p>
288308
<ul>
289309
<li><p>Create the directory that is going to contain the top directory
290310
of the JDK clone by using the <code>mkdir</code> command in the Cygwin
@@ -294,6 +314,9 @@ <h3 id="special-considerations">Special Considerations</h3>
294314
<li><p>Do not put the JDK clone in a path under your Cygwin home
295315
directory. This is especially important if your user name contains
296316
spaces and/or mixed upper and lower case letters.</p></li>
317+
</ul>
318+
<p>Failure to follow these procedures might result in hard-to-debug
319+
build problems.</p></li>
297320
<li><p>You need to install a git client. You have two choices, Cygwin
298321
git or Git for Windows. Unfortunately there are pros and cons with each
299322
choice.</p>
@@ -311,9 +334,7 @@ <h3 id="special-considerations">Special Considerations</h3>
311334
line ending problems, make sure you set <code>core.autocrlf</code> to
312335
<code>false</code> (this is asked during installation).</p></li>
313336
</ul></li>
314-
</ul>
315-
<p>Failure to follow this procedure might result in hard-to-debug build
316-
problems.</p></li>
337+
</ul></li>
317338
</ul>
318339
<h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
319340
<p>The JDK is a massive project, and require machines ranging from

doc/building.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,39 @@ on where and how to check out the source code.
8383
for the source code, see below for suggestions on how to keep the build
8484
artifacts on a local disk.
8585

86-
* On Windows, if using [Cygwin](#cygwin), extra care must be taken to make sure
87-
the environment is consistent. It is recommended that you follow this
88-
procedure:
89-
90-
* Create the directory that is going to contain the top directory of the JDK
91-
clone by using the `mkdir` command in the Cygwin bash shell. That is, do
92-
*not* create it using Windows Explorer. This will ensure that it will have
93-
proper Cygwin attributes, and that it's children will inherit those
94-
attributes.
95-
96-
* Do not put the JDK clone in a path under your Cygwin home directory. This
97-
is especially important if your user name contains spaces and/or mixed
98-
upper and lower case letters.
86+
* On Windows, extra care must be taken to have a smooth building experience:
87+
88+
* Make sure that all relevant paths have short names. Short names are used by
89+
the build system to create space-free alternative paths. Short name
90+
creation is enabled per volume. The default setting can be checked with the
91+
command: `fsutil 8dot3name query`. If short name creation was turned off
92+
when a directory was created, it will not have a short name. Whether a
93+
short name exists can be checked by running `dir /X` in the containing
94+
directory (in cmd.exe). If a short path is present you should see something
95+
like 'ASDF~1' being displayed in one of the columns of the ouput. If a
96+
directory is missing a short name, the safest way to get one is to enable
97+
short names for that particular volume with `fsutil 8dot3name set <drive
98+
letter>: 0` (note that you need to run as administrator for this), and then
99+
re-create the particular directory. A short name should be generated
100+
automatically then. Another option is to manually assign a short name to
101+
the directory using `fsutil file setShortName <path> <short name>`.
102+
103+
* If using [Cygwin](#cygwin), you must make sure the file permissions and
104+
attributes between Windows and Cygwin are consistent. It is recommended
105+
that you follow this procedure:
106+
107+
* Create the directory that is going to contain the top directory of the
108+
JDK clone by using the `mkdir` command in the Cygwin bash shell. That is,
109+
do *not* create it using Windows Explorer. This will ensure that it will
110+
have proper Cygwin attributes, and that it's children will inherit those
111+
attributes.
112+
113+
* Do not put the JDK clone in a path under your Cygwin home directory. This
114+
is especially important if your user name contains spaces and/or mixed
115+
upper and lower case letters.
116+
117+
Failure to follow these procedures might result in hard-to-debug build
118+
problems.
99119

100120
* You need to install a git client. You have two choices, Cygwin git or Git
101121
for Windows. Unfortunately there are pros and cons with each choice.
@@ -113,9 +133,6 @@ on where and how to check out the source code.
113133
make sure you set `core.autocrlf` to `false` (this is asked during
114134
installation).
115135

116-
Failure to follow this procedure might result in hard-to-debug build
117-
problems.
118-
119136
## Build Hardware Requirements
120137

121138
The JDK is a massive project, and require machines ranging from decent to

doc/hotspot-unit-tests.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ <h3 id="nearness">Nearness</h3>
189189
<p>Prefer having checks inside test code.</p>
190190
<p>Not only does having test logic outside, e.g. verification method,
191191
depending on asserts in product code contradict with several items above
192-
but also decreases tests readability and stability. It is much easier
192+
but also decreases test's readability and stability. It is much easier
193193
to understand that a test is testing when all testing logic is located
194194
inside a test or nearby in shared test libraries. As a rule of thumb,
195195
the closer a check to a test, the better.</p>
@@ -198,7 +198,7 @@ <h3 id="several-checks">Several checks</h3>
198198
<p>Prefer <code>EXPECT</code> over <code>ASSERT</code> if possible.</p>
199199
<p>This is related to the <a href="#informativeness">informativeness</a>
200200
property of tests, information for other checks can help to better
201-
localize a defects root-cause. One should use <code>ASSERT</code> if it
201+
localize a defect's root-cause. One should use <code>ASSERT</code> if it
202202
is impossible to continue test execution or if it does not make much
203203
sense. Later in the text, <code>EXPECT</code> forms will be used to
204204
refer to both <code>ASSERT/EXPECT</code>.</p>
@@ -235,7 +235,7 @@ <h3 id="floating-point-comparison">Floating-point comparison</h3>
235235
<code>eps</code>.</p>
236236
<h3 id="c-string-comparison">C string comparison</h3>
237237
<p>Use string special macros for C strings comparisons.</p>
238-
<p><code>EXPECT_EQ</code> just compares pointers values, which is
238+
<p><code>EXPECT_EQ</code> just compares pointers' values, which is
239239
hardly what one wants comparing C strings. GoogleTest provides
240240
<code>EXPECT_STREQ</code> and <code>EXPECT_STRNE</code> macros to
241241
compare C string contents. There are also case-insensitive versions
@@ -293,7 +293,7 @@ <h3 id="test-group-names">Test group names</h3>
293293
<p>This naming scheme helps to find tests, filter them and simplifies
294294
test failure analysis. For example, class <code>Foo</code> - test group
295295
<code>Foo</code>, compiler logging subsystem - test group
296-
<code>CompilerLogging</code>, G1 GC test group <code>G1GC</code>, and
296+
<code>CompilerLogging</code>, G1 GC - test group <code>G1GC</code>, and
297297
so forth.</p>
298298
<h3 id="filename">Filename</h3>
299299
<p>A test file must have <code>test_</code> prefix and <code>.cpp</code>
@@ -345,7 +345,7 @@ <h3 id="fixture-classes">Fixture classes</h3>
345345
<h3 id="friend-classes">Friend classes</h3>
346346
<p>All test purpose friends should have either <code>Test</code> or
347347
<code>Testable</code> suffix.</p>
348-
<p>It greatly simplifies understanding of friendships purpose and
348+
<p>It greatly simplifies understanding of friendship's purpose and
349349
allows statically check that private members are not exposed
350350
unexpectedly. Having <code>FooTest</code> as a friend of
351351
<code>Foo</code> without any comments will be understood as a necessary
@@ -435,7 +435,7 @@ <h3 id="test-specific-flags">Test-specific flags</h3>
435435
<h3 id="flag-restoring">Flag restoring</h3>
436436
<p>Restore changed flags.</p>
437437
<p>It is quite common for tests to configure JVM in a certain way
438-
changing flags values. GoogleTest provides two ways to set up
438+
changing flags' values. GoogleTest provides two ways to set up
439439
environment before a test and restore it afterward: using either
440440
constructor and destructor or <code>SetUp</code> and
441441
<code>TearDown</code> functions. Both ways require to use a test fixture
@@ -444,7 +444,7 @@ <h3 id="flag-restoring">Flag restoring</h3>
444444
be used in such cases to restore/set values.</p>
445445
<p>Caveats:</p>
446446
<ul>
447-
<li><p>Changing a flags value could break the invariants between flags'
447+
<li><p>Changing a flag's value could break the invariants between flags'
448448
values and hence could lead to unexpected/unsupported JVM
449449
state.</p></li>
450450
<li><p><code>FLAG_SET_*</code> macros can change more than one flag (in

doc/testing.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ <h4 id="jcov">JCOV</h4>
411411
special target <code>jcov-test</code> instead of <code>test</code>, e.g.
412412
<code>make jcov-test TEST=jdk_lang</code>. This will make sure the JCov
413413
image is built, and that JCov reporting is enabled.</p>
414+
<p>To include JCov coverage for just a subset of all modules, you can
415+
use the <code>--with-jcov-modules</code> arguments to
416+
<code>configure</code>, e.g.
417+
<code>--with-jcov-modules=jdk.compiler,java.desktop</code>.</p>
418+
<p>For more fine-grained control, you can pass arbitrary filters to JCov
419+
using <code>--with-jcov-filters</code>, and you can specify a specific
420+
JDK to instrument using <code>--with-jcov-input-jdk</code>.</p>
414421
<p>The JCov report is stored in
415422
<code>build/$BUILD/test-results/jcov-output/report</code>.</p>
416423
<p>Please note that running with JCov reporting can be very memory

doc/testing.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ The simplest way to run tests with JCov coverage report is to use the special
345345
target `jcov-test` instead of `test`, e.g. `make jcov-test TEST=jdk_lang`. This
346346
will make sure the JCov image is built, and that JCov reporting is enabled.
347347

348+
To include JCov coverage for just a subset of all modules, you can use the
349+
`--with-jcov-modules` arguments to `configure`, e.g.
350+
`--with-jcov-modules=jdk.compiler,java.desktop`.
351+
352+
For more fine-grained control, you can pass arbitrary filters to JCov using
353+
`--with-jcov-filters`, and you can specify a specific JDK to instrument
354+
using `--with-jcov-input-jdk`.
355+
348356
The JCov report is stored in `build/$BUILD/test-results/jcov-output/report`.
349357

350358
Please note that running with JCov reporting can be very memory intensive.

make/Coverage.gmk

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,28 @@ else
3434
JCOV_INPUT_IMAGE_DIR := $(JDK_IMAGE_DIR)
3535
endif
3636

37+
JCOV_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/jcov
38+
3739
#moving instrumented jdk image in and out of jcov_temp because of CODETOOLS-7902299
38-
JCOV_TEMP := $(SUPPORT_OUTPUTDIR)/jcov_temp
40+
JCOV_TEMP := $(JCOV_SUPPORT_DIR)/temp
41+
42+
ifneq ($(JCOV_MODULES), )
43+
JCOV_MODULES_FILTER := $(foreach m, $(JCOV_MODULES), -include_module $m)
44+
endif
3945

4046
$(JCOV_IMAGE_DIR)/release: $(JCOV_INPUT_IMAGE_DIR)/release
4147
$(call LogWarn, Creating instrumented jdk image with JCov)
4248
$(call MakeDir, $(JCOV_TEMP) $(IMAGES_OUTPUTDIR))
4349
$(RM) -r $(JCOV_IMAGE_DIR) $(JCOV_TEMP)/*
4450
$(CP) -r $(JCOV_INPUT_IMAGE_DIR) $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)
45-
$(JAVA) -Xmx3g -jar $(JCOV_HOME)/lib/jcov.jar JREInstr \
51+
$(call ExecuteWithLog, $(JCOV_SUPPORT_DIR)/run-jcov, \
52+
$(JAVA) -Xmx3g -jar $(JCOV_HOME)/lib/jcov.jar JREInstr \
4653
-t $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)/template.xml \
4754
-rt $(JCOV_HOME)/lib/jcov_network_saver.jar \
4855
-exclude 'java.lang.Object' \
4956
-exclude jdk.test.Main -exclude '**\$Proxy*' \
50-
$(JCOV_FILTERS) \
51-
$(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)
57+
$(JCOV_MODULES_FILTER) $(JCOV_FILTERS) \
58+
$(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR))
5259
$(MV) $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR) $(JCOV_IMAGE_DIR)
5360
$(RMDIR) $(JCOV_TEMP)
5461

make/Docs.gmk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ define create_overview_file
262262
$$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
263263
$$(call LogInfo, Creating overview.html for $1)
264264
$$(call MakeDir, $$(@D))
265-
$$(ECHO) -n '$$($1_OVERVIEW_TEXT)' > $$@
265+
$$(PRINTF) "%s" '$$($1_OVERVIEW_TEXT)' > $$@
266266
endef
267267

268268
################################################################################

make/MainSupport.gmk

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ define SetupTargetBody
5757
endef
5858

5959
define CleanDocs
60-
@$(ECHO) -n "Cleaning docs ..."
60+
@$(PRINTF) "Cleaning docs ..."
6161
@$(ECHO) "" $(LOG_DEBUG)
6262
$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
6363
$(RM) -r $(SUPPORT_OUTPUTDIR)/javadoc
@@ -67,28 +67,28 @@ endef
6767

6868
# Cleans the dir given as $1
6969
define CleanDir
70-
@$(ECHO) -n "Cleaning $(strip $1) build artifacts ..."
70+
@$(PRINTF) "Cleaning %s build artifacts ..." "$(strip $1)"
7171
@$(ECHO) "" $(LOG_DEBUG)
7272
($(CD) $(OUTPUTDIR) && $(RM) -r $1)
7373
@$(ECHO) " done"
7474
endef
7575

7676
define CleanSupportDir
77-
@$(ECHO) -n "Cleaning$(strip $1) build artifacts ..."
77+
@$(PRINTF) "Cleaning %s build artifacts ..." "$(strip $1)"
7878
@$(ECHO) "" $(LOG_DEBUG)
7979
$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1)
8080
@$(ECHO) " done"
8181
endef
8282

8383
define CleanMakeSupportDir
84-
@$(ECHO) -n "Cleaning $(strip $1) make support artifacts ..."
84+
@$(PRINTF) "Cleaning %s make support artifacts ..." "$(strip $1)"
8585
@$(ECHO) "" $(LOG_DEBUG)
8686
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/$(strip $1)
8787
@$(ECHO) " done"
8888
endef
8989

9090
define CleanTest
91-
@$(ECHO) -n "Cleaning test $(strip $1) ..."
91+
@$(PRINTF) "Cleaning test %s ..." "$(strip $1)"
9292
@$(ECHO) "" $(LOG_DEBUG)
9393
$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
9494
# Remove as much of the test directory structure as is empty
@@ -97,25 +97,25 @@ define CleanTest
9797
endef
9898

9999
define Clean-gensrc
100-
@$(ECHO) -n "Cleaning gensrc $(if $1,for $(strip $1) )..."
100+
@$(PRINTF) "Cleaning gensrc %s..." "$(if $1,for $(strip $1) )"
101101
@$(ECHO) "" $(LOG_DEBUG)
102102
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
103103
@$(ECHO) " done"
104104
endef
105105

106106
define Clean-java
107-
@$(ECHO) -n "Cleaning java $(if $1,for $(strip $1) )..."
107+
@$(PRINTF) "Cleaning java %s..." "$(if $1,for $(strip $1) )"
108108
@$(ECHO) "" $(LOG_DEBUG)
109109
$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
110110
$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1)
111111
$(ECHO) " done"
112-
$(ECHO) -n "Cleaning headers $(if $1,for $(strip $1) )..."
112+
$(PRINTF) "Cleaning headers %s..." "$(if $1,for $(strip $1) )"
113113
$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
114114
@$(ECHO) " done"
115115
endef
116116

117117
define Clean-native
118-
@$(ECHO) -n "Cleaning native $(if $1,for $(strip $1) )..."
118+
@$(PRINTF) "Cleaning native %s..." "$(if $1,for $(strip $1) )"
119119
@$(ECHO) "" $(LOG_DEBUG)
120120
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
121121
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
@@ -124,7 +124,7 @@ define Clean-native
124124
endef
125125

126126
define Clean-include
127-
@$(ECHO) -n "Cleaning include $(if $1,for $(strip $1) )..."
127+
@$(PRINTF) "Cleaning include %s..." "$(if $1,for $(strip $1) )"
128128
@$(ECHO) "" $(LOG_DEBUG)
129129
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
130130
@$(ECHO) " done"

make/RunTests.gmk

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ JTREG_COV_OPTIONS :=
115115

116116
ifeq ($(TEST_OPTS_JCOV), true)
117117
JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
118+
JCOV_SUPPORT_DIR := $(TEST_SUPPORT_DIR)/jcov-support
118119
JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
119120
JCOV_RESULT_FILE := $(JCOV_OUTPUT_DIR)/result.xml
120121
JCOV_REPORT := $(JCOV_OUTPUT_DIR)/report
@@ -1363,18 +1364,23 @@ ifeq ($(TEST_OPTS_JCOV), true)
13631364
$(JAVA) -jar $(JCOV_HOME)/lib/jcov.jar GrabberManager -stop -stoptimeout 3600
13641365

13651366
JCOV_REPORT_TITLE := JDK code coverage report<br/>
1367+
ifneq ($(JCOV_MODULES), )
1368+
JCOV_MODULES_FILTER := $(foreach m, $(JCOV_MODULES), -include_module $m)
1369+
JCOV_REPORT_TITLE += Included modules: $(JCOV_MODULES)<br>
1370+
endif
13661371
ifneq ($(JCOV_FILTERS), )
13671372
JCOV_REPORT_TITLE += Code filters: $(JCOV_FILTERS)<br>
13681373
endif
13691374
JCOV_REPORT_TITLE += Tests: $(TEST)
13701375

13711376
jcov-gen-report: jcov-stop-grabber
13721377
$(call LogWarn, Generating JCov report ...)
1373-
$(JAVA) $(JCOV_VM_OPTS) -jar $(JCOV_HOME)/lib/jcov.jar RepGen -sourcepath \
1378+
$(call ExecuteWithLog, $(JCOV_SUPPORT_DIR)/run-jcov-repgen, \
1379+
$(JAVA) $(JCOV_VM_OPTS) -jar $(JCOV_HOME)/lib/jcov.jar RepGen -sourcepath \
13741380
`$(ECHO) $(TOPDIR)/src/*/share/classes/ | $(TR) ' ' ':'` -fmt html \
1375-
$(JCOV_FILTERS) \
1381+
$(JCOV_MODULES_FILTER) $(JCOV_FILTERS) \
13761382
-mainReportTitle "$(JCOV_REPORT_TITLE)" \
1377-
-o $(JCOV_REPORT) $(JCOV_RESULT_FILE)
1383+
-o $(JCOV_REPORT) $(JCOV_RESULT_FILE))
13781384

13791385
TARGETS += jcov-do-start-grabber jcov-start-grabber jcov-stop-grabber \
13801386
jcov-gen-report

make/RunTestsPrebuilt.gmk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
217217
else ifeq ($(OPENJDK_TARGET_OS), windows)
218218
NUM_CORES := $(NUMBER_OF_PROCESSORS)
219219
MEMORY_SIZE := $(shell \
220-
$(EXPR) `wmic computersystem get totalphysicalmemory -value \
221-
| $(GREP) = | $(SED) 's/\\r//g' \
222-
| $(CUT) -d "=" -f 2-` / 1024 / 1024 \
220+
$(EXPR) `powershell -Command \
221+
"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory" \
222+
| $(SED) 's/\\r//g' ` / 1024 / 1024 \
223223
)
224224
endif
225225
ifeq ($(NUM_CORES), )

0 commit comments

Comments
 (0)