< prev index next >

make/Images.gmk

Print this page

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, _nocoh, _nocoops_nocoh, 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_NOCOH_OPTION := $(if $(findstring _nocoh, $2),-XX:-UseCompactObjectHeaders,-XX:+UseCompactObjectHeaders)
146   endif
147   $1_$2_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_NOCOH_OPTION)
148   $1_$2_DUMP_TYPE      := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _nocoh, $2),-NOCOH,)
149 
150   $1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
151 
152   ifeq ($(OPENJDK_TARGET_OS), windows)
153     $1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
154   else
155     $1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
156   endif
157 
158   ifneq ($(COMPARE_BUILD), )
159     DEBUG_CDS_ARCHIVE := true
160   endif
161 
162   ifeq ($(DEBUG_CDS_ARCHIVE), true)
163     $1_$2_CDS_DUMP_FLAGS += -Xlog:aot+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
164   endif
165 
166   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
167       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
168       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
169       DEPS := $$(jlink_jdk), \
170       OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
171       SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
172       COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
173           -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
174           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
175   ))
176 
177   JDK_TARGETS += $$($1_$2_gen_cds_archive_jdk)
178 
179   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jre, \
180       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jre image for $1, \
181       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
182       DEPS := $$(jlink_jre), \
183       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
184       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
185       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
186           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
187           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
188   ))
189 
190   JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
191 endef
192 
193 ifeq ($(BUILD_CDS_ARCHIVE), true)
194   $(foreach v, $(JVM_VARIANTS), \
195     $(eval $(call CreateCDSArchive,$v,)) \

196   )
197 
198   ifeq ($(call isTargetCpuBits, 64), true)
199     $(foreach v, $(JVM_VARIANTS), \
200       $(eval $(call CreateCDSArchive,$v,_nocoops)) \

201     )
202     ifeq ($(BUILD_CDS_ARCHIVE_NOCOH), true)
203       $(foreach v, $(JVM_VARIANTS), \
204         $(eval $(call CreateCDSArchive,$v,_nocoh)) \

205       )
206       $(foreach v, $(JVM_VARIANTS), \
207         $(eval $(call CreateCDSArchive,$v,_nocoops_nocoh)) \

208       )
209     endif
210   endif
211 endif
212 
213 ################################################################################
214 # src.zip
215 
216 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
217 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
218 	$(install-file)
219 
220 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
221 
222 ################################################################################
223 # /demo dir
224 # Avoid doing the expensive find unless called with "jdk" as target.
225 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
226 
227   DEMO_FILES := \

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, _nocoh, _nocoops_nocoh, or empty
141 # Param3 - _preview, 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_NOCOH_OPTION := $(if $(findstring _nocoh, $2),-XX:-UseCompactObjectHeaders,-XX:+UseCompactObjectHeaders)
147   endif
148   $1_$2_$3_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_NOCOH_OPTION) $(if $(findstring _preview, $3), --enable-preview,)
149   $1_$2_$3_DUMP_TYPE      := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _nocoh, $2),-NOCOH,)$(if $(findstring _preview, $3),-PREVIEW,)
150 
151   $1_$2_$3_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
152 
153   ifeq ($(OPENJDK_TARGET_OS), windows)
154     $1_$2_$3_CDS_ARCHIVE := bin/$1/classes$2$3.jsa
155   else
156     $1_$2_$3_CDS_ARCHIVE := lib/$1/classes$2$3.jsa
157   endif
158 
159   ifneq ($(COMPARE_BUILD), )
160     DEBUG_CDS_ARCHIVE := true
161   endif
162 
163   ifeq ($(DEBUG_CDS_ARCHIVE), true)
164     $1_$2_$3_CDS_DUMP_FLAGS += -Xlog:aot+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE).cdsmap:none:filesize=0
165   endif
166 
167   $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jdk, \
168       WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jdk image for $1, \
169       INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
170       DEPS := $$(jlink_jdk), \
171       OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
172       SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
173       COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
174           -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
175           -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
176   ))
177 
178   JDK_TARGETS += $$($1_$2_$3_gen_cds_archive_jdk)
179 
180   $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jre, \
181       WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jre image for $1, \
182       INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
183       DEPS := $$(jlink_jre), \
184       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
185       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
186       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
187           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
188           -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
189   ))
190 
191   JRE_TARGETS += $$($1_$2_$3_gen_cds_archive_jre)
192 endef
193 
194 ifeq ($(BUILD_CDS_ARCHIVE), true)
195   $(foreach v, $(JVM_VARIANTS), \
196     $(eval $(call CreateCDSArchive,$v,,)) \
197     $(eval $(call CreateCDSArchive,$v,,_preview)) \
198   )
199 
200   ifeq ($(call isTargetCpuBits, 64), true)
201     $(foreach v, $(JVM_VARIANTS), \
202       $(eval $(call CreateCDSArchive,$v,_nocoops,)) \
203       $(eval $(call CreateCDSArchive,$v,_nocoops,_preview)) \
204     )
205     ifeq ($(BUILD_CDS_ARCHIVE_NOCOH), true)
206       $(foreach v, $(JVM_VARIANTS), \
207         $(eval $(call CreateCDSArchive,$v,_nocoh)) \
208         $(eval $(call CreateCDSArchive,$v,_nocoh,_preview)) \
209       )
210       $(foreach v, $(JVM_VARIANTS), \
211         $(eval $(call CreateCDSArchive,$v,_nocoops_nocoh)) \
212         $(eval $(call CreateCDSArchive,$v,_nocoops_nocoh,_preview)) \
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
226 
227 ################################################################################
228 # /demo dir
229 # Avoid doing the expensive find unless called with "jdk" as target.
230 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
231 
232   DEMO_FILES := \
< prev index next >