< prev index next >

make/Images.gmk

Print this page

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, \
159       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
160       DEPS := $$(jlink_jdk), \
161       OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
162       SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
163       COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
164           -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
165           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
166   ))
167 
168   JDK_TARGETS += $$($1_$2_gen_cds_archive_jdk)
169 
170   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jre, \
171       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jre image for $1, \
172       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
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), \

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 # Param3 - _valhalla, or empty
137 define CreateCDSArchive
138   $1_$2_$3_DUMP_EXTRA_ARG := $(if $(filter _nocoops, $2), -XX:-UseCompressedOops,) $(if $(filter _valhalla, $3), --enable-preview,)
139   $1_$2_$3_DUMP_TYPE      := $(if $(filter _nocoops, $2), -NOCOOPS,)$(if $(filter _valhalla, $3), -VALHALLA,)
140 
141   # Only G1 supports dumping the shared heap, so explicitly use G1 if the JVM supports it.
142   $1_$2_$3_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
143 
144   ifeq ($(OPENJDK_TARGET_OS), windows)
145     $1_$2_$3_CDS_ARCHIVE := bin/$1/classes$2$3.jsa
146   else
147     $1_$2_$3_CDS_ARCHIVE := lib/$1/classes$2$3.jsa
148   endif
149 
150   ifneq ($(COMPARE_BUILD), )
151     DEBUG_CDS_ARCHIVE := true
152   endif
153 
154   ifeq ($(DEBUG_CDS_ARCHIVE), true)
155     $1_$2_CDS_DUMP_FLAGS += -Xlog:cds+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
156   endif
157 
158   $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jdk, \
159       WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jdk image for $1, \
160       INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
161       DEPS := $$(jlink_jdk), \
162       OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
163       SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
164       COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
165           -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
166           -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
167   ))
168 
169   JDK_TARGETS += $$($1_$2_$3_gen_cds_archive_jdk)
170 
171   $$(eval $$(call SetupExecute, $1_$2_$3_gen_cds_archive_jre, \
172       WARN := Creating CDS$$($1_$2_$3_DUMP_TYPE) archive for jre image for $1, \
173       INFO := Using CDS flags for $1: $$($1_$2_$3_CDS_DUMP_FLAGS), \
174       DEPS := $$(jlink_jre), \
175       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE), \
176       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
177       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
178           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_$3_CDS_ARCHIVE) \
179           -$1 $$($1_$2_$3_DUMP_EXTRA_ARG) $$($1_$2_$3_CDS_DUMP_FLAGS) $$(LOG_INFO), \
180   ))
181 
182   JRE_TARGETS += $$($1_$2_$3_gen_cds_archive_jre)
183 endef
184 
185 ifeq ($(BUILD_CDS_ARCHIVE), true)
186   $(foreach v, $(JVM_VARIANTS), \
187     $(eval $(call CreateCDSArchive,$v,,)) \
188     $(eval $(call CreateCDSArchive,$v,,_valhalla)) \
189   )
190 
191   ifeq ($(call isTargetCpuBits, 64), true)
192     $(foreach v, $(JVM_VARIANTS), \
193       $(eval $(call CreateCDSArchive,$v,_nocoops,)) \
194       $(eval $(call CreateCDSArchive,$v,_nocoops,_valhalla)) \
195     )
196   endif
197 endif
198 
199 ################################################################################
200 # src.zip
201 
202 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
203 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
204 	$(install-file)
205 
206 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
207 
208 ################################################################################
209 # /demo dir
210 # Avoid doing the expensive find unless called with "jdk" as target.
211 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
212 
213   DEMO_FILES := \
214       $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
< prev index next >