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