8334598: Default classlist in JDK is not deterministic after JDK-8293980

Reviewed-by: ccheung, dholmes, stuefe, erikj
This commit is contained in:
Ioi Lam 2024-06-25 16:44:41 +00:00
parent 9c89f0861c
commit 7429c37e63

View File

@ -62,14 +62,14 @@ ifeq ($(EXTERNAL_BUILDJDK), true)
INTERIM_IMAGE_DIR := $(BUILD_JDK)
endif
# These are needed for deterministic classlist:
# To make the classlist deterministic:
# - The classlist can be influenced by locale. Always set it to en/US.
# - Run with -Xint, as the compiler can speculatively resolve constant pool entries.
# - ForkJoinPool parallelism can cause constant pool resolution to be non-deterministic.
# - Concurrency in the core libraries can cause constant pool resolution
# to be non-deterministic. Since the benefits of resolved CP references in the
# default classlist is minimal, let's filter out the '@cp' lines until we can
# find a proper solution.
CLASSLIST_FILE_VM_OPTS = \
-Duser.language=en -Duser.country=US \
-Xint \
-Djava.util.concurrent.ForkJoinPool.common.parallelism=0
-Duser.language=en -Duser.country=US
# Save the stderr output of the command and print it along with stdout in case
# something goes wrong.
@ -101,9 +101,10 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
exit $$exitcode \
)
$(GREP) -v HelloClasslist $@.raw.2 > $@.raw.3
$(GREP) -v @cp $@.raw.3 > $@.raw.4
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
build.tools.classlist.SortClasslist $@.raw.3 > $@
build.tools.classlist.SortClasslist $@.raw.4 > $@
# The jli trace is created by the same recipe as classlist. By declaring these
# dependencies, make will correctly rebuild both jli trace and classlist