121 $(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
122 OUTPUT_DIR := $(JRE_IMAGE_DIR), \
123 SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
124 PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
125 COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
126 $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
127 ))
128
129 JLINK_JRE_TARGETS := $(jlink_jre)
130
131 # Optimize CDS shared heap for small heap sizes, which are typically used
132 # for small cloud-based apps that have the most critical start-up requirement.
133 # The trade-off is that when larger heap sizes are used, the shared heap
134 # may need to be relocated at runtime.
135 CDS_DUMP_FLAGS = -Xmx128M -Xms128M
136
137 # Helper function for creating the CDS archives for the JDK and JRE
138 #
139 # Param1 - VM variant (e.g., server, client, zero, ...)
140 # Param2 - _nocoops, _coh, _nocoops_coh, or empty
141 define CreateCDSArchive
142 $1_$2_COOPS_OPTION := $(if $(findstring _nocoops, $2),-XX:-UseCompressedOops)
143 # enable and also explicitly disable coh as needed.
144 ifeq ($(call isTargetCpuBits, 64), true)
145 $1_$2_COH_OPTION := -XX:+UnlockExperimentalVMOptions \
146 $(if $(findstring _coh, $2),-XX:+UseCompactObjectHeaders,-XX:-UseCompactObjectHeaders)
147 endif
148 $1_$2_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_COH_OPTION)
149 $1_$2_DUMP_TYPE := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _coh, $2),-COH,)
150
151 # Only G1 supports dumping the shared heap, so explicitly use G1 if the JVM supports it.
152 $1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
153
154 ifeq ($(OPENJDK_TARGET_OS), windows)
155 $1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
156 else
157 $1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
158 endif
159
160 ifneq ($(COMPARE_BUILD), )
161 DEBUG_CDS_ARCHIVE := true
162 endif
163
164 ifeq ($(DEBUG_CDS_ARCHIVE), true)
165 $1_$2_CDS_DUMP_FLAGS += -Xlog:cds+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
166 endif
167
168 $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
169 WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
170 INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
171 DEPS := $$(jlink_jdk), \
172 OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
173 SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
174 COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
175 -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
176 -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
177 ))
178
179 JDK_TARGETS += $$($1_$2_gen_cds_archive_jdk)
180
181 $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jre, \
182 WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jre image for $1, \
183 INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
184 DEPS := $$(jlink_jre), \
185 OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
186 SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
187 COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
188 -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
189 -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
190 ))
191
192 JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
193 endef
194
195 ifeq ($(BUILD_CDS_ARCHIVE), true)
196 $(foreach v, $(JVM_VARIANTS), \
197 $(eval $(call CreateCDSArchive,$v,)) \
198 )
199
200 ifeq ($(call isTargetCpuBits, 64), true)
201 $(foreach v, $(JVM_VARIANTS), \
202 $(eval $(call CreateCDSArchive,$v,_nocoops)) \
203 )
204 ifeq ($(BUILD_CDS_ARCHIVE_COH), true)
205 $(foreach v, $(JVM_VARIANTS), \
206 $(eval $(call CreateCDSArchive,$v,_coh)) \
207 )
208 $(foreach v, $(JVM_VARIANTS), \
209 $(eval $(call CreateCDSArchive,$v,_nocoops_coh)) \
210 )
211 endif
212 endif
213 endif
214
215 ################################################################################
216 # src.zip
217
218 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
219 $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
220 $(install-file)
221
222 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
|
121 $(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
122 OUTPUT_DIR := $(JRE_IMAGE_DIR), \
123 SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
124 PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
125 COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
126 $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
127 ))
128
129 JLINK_JRE_TARGETS := $(jlink_jre)
130
131 # Optimize CDS shared heap for small heap sizes, which are typically used
132 # for small cloud-based apps that have the most critical start-up requirement.
133 # The trade-off is that when larger heap sizes are used, the shared heap
134 # may need to be relocated at runtime.
135 CDS_DUMP_FLAGS = -Xmx128M -Xms128M
136
137 # Helper function for creating the CDS archives for the JDK and JRE
138 #
139 # Param1 - VM variant (e.g., server, client, zero, ...)
140 # Param2 - _nocoops, _coh, _nocoops_coh, or empty
141 # Param3 - _valhalla, or empty
142 define CreateCDSArchive
143 $1_$2_COOPS_OPTION := $(if $(findstring _nocoops, $2),-XX:-UseCompressedOops)
144 # enable and also explicitly disable coh as needed.
145 ifeq ($(call isTargetCpuBits, 64), true)
146 $1_$2_COH_OPTION := -XX:+UnlockExperimentalVMOptions \
147 $(if $(findstring _coh, $2),-XX:+UseCompactObjectHeaders,-XX:-UseCompactObjectHeaders)
148 endif
149 $1_$2_$3_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_COH_OPTION) $(if $(findstring _valhalla, $3), --enable-preview,)
150 $1_$2_$3_DUMP_TYPE := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _coh, $2),-COH,)$(if $(findstring _valhalla, $3), -VALHALLA,)
151
152 # Only G1 supports dumping the shared heap, so explicitly use G1 if the JVM supports it.
153 $1_$2_$3_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
154
155 ifeq ($(OPENJDK_TARGET_OS), windows)
156 $1_$2_$3_CDS_ARCHIVE := bin/$1/classes$2$3.jsa
157 else
158 $1_$2_$3_CDS_ARCHIVE := lib/$1/classes$2$3.jsa
159 endif
160
161 ifneq ($(COMPARE_BUILD), )
162 DEBUG_CDS_ARCHIVE := true
163 endif
164
165 ifeq ($(DEBUG_CDS_ARCHIVE), true)
166 $1_$2_CDS_DUMP_FLAGS += -Xlog:cds+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
167 endif
168
169 $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jdk, \
170 WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jdk image for $1, \
171 INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
172 DEPS := $$(jlink_jdk), \
173 OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
174 SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
175 COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
176 -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
177 -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
178 ))
179
180 JDK_TARGETS += $$($1_$2_$3_gen_cds_archive_jdk)
181
182 $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jre, \
183 WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jre image for $1, \
184 INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
185 DEPS := $$(jlink_jre), \
186 OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
187 SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
188 COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
189 -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
190 -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
191 ))
192
193 JRE_TARGETS += $$($1_$2_$3_gen_cds_archive_jre)
194 endef
195
196 ifeq ($(BUILD_CDS_ARCHIVE), true)
197 $(foreach v, $(JVM_VARIANTS), \
198 $(eval $(call CreateCDSArchive,$v,,)) \
199 $(eval $(call CreateCDSArchive,$v,,_valhalla)) \
200 )
201
202 ifeq ($(call isTargetCpuBits, 64), true)
203 $(foreach v, $(JVM_VARIANTS), \
204 $(eval $(call CreateCDSArchive,$v,_nocoops,)) \
205 $(eval $(call CreateCDSArchive,$v,_nocoops,_valhalla)) \
206 )
207 ifeq ($(BUILD_CDS_ARCHIVE_COH), true)
208 $(foreach v, $(JVM_VARIANTS), \
209 $(eval $(call CreateCDSArchive,$v,_coh)) \
210 )
211 $(foreach v, $(JVM_VARIANTS), \
212 $(eval $(call CreateCDSArchive,$v,_nocoops_coh)) \
213 )
214 endif
215 endif
216 endif
217
218 ################################################################################
219 # src.zip
220
221 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
222 $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
223 $(install-file)
224
225 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
|