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