< prev index next >

make/Images.gmk

Print this page

  1 #
  2 # Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
  3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4 #
  5 # This code is free software; you can redistribute it and/or modify it
  6 # under the terms of the GNU General Public License version 2 only, as
  7 # published by the Free Software Foundation.  Oracle designates this
  8 # particular file as subject to the "Classpath" exception as provided
  9 # by Oracle in the LICENSE file that accompanied this code.
 10 #
 11 # This code is distributed in the hope that it will be useful, but WITHOUT
 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14 # version 2 for more details (a copy is included in the LICENSE file that
 15 # accompanied this code).
 16 #
 17 # You should have received a copy of the GNU General Public License version
 18 # 2 along with this work; if not, write to the Free Software Foundation,
 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20 #
 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22 # or visit www.oracle.com if you need additional information or have any

114         $(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
115     OUTPUT_DIR := $(JRE_IMAGE_DIR), \
116     SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
117     PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
118     COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
119         $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
120 ))
121 
122 JLINK_JRE_TARGETS := $(jlink_jre)
123 
124 # Optimize CDS shared heap for small heap sizes, which are typically used
125 # for small cloud-based apps that have the most critical start-up requirement.
126 # The trade-off is that when larger heap sizes are used, the shared heap
127 # may need to be relocated at runtime.
128 CDS_DUMP_FLAGS = -Xmx128M -Xms128M
129 
130 # Helper function for creating the CDS archives for the JDK and JRE
131 #
132 # Param1 - VM variant (e.g., server, client, zero, ...)
133 # Param2 - _nocoops, or empty

134 define CreateCDSArchive
135   $1_$2_DUMP_EXTRA_ARG := $(if $(filter _nocoops, $2),-XX:-UseCompressedOops,)
136   $1_$2_DUMP_TYPE      := $(if $(filter _nocoops, $2),-NOCOOPS,)
137 
138   # Only G1 supports dumping the shared heap, so explicitly use G1 if the JVM supports it.
139   $1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)),-XX:+UseG1GC)
140 
141   ifeq ($(OPENJDK_TARGET_OS), windows)
142     $1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
143   else
144     $1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
145   endif
146 
147   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
148       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
149       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
150       DEPS := $$(jlink_jdk), \
151       OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
152       SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
153       COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
154           -XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
155           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
156   ))
157 
158   JDK_TARGETS += $$($1_$2_gen_cds_archive_jdk)
159 
160   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jre, \
161       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jre image for $1, \
162       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
163       DEPS := $$(jlink_jre), \
164       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
165       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
166       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
167           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
168           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
169   ))
170 
171   JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
172 endef
173 




174 ifeq ($(BUILD_CDS_ARCHIVE), true)
175   $(foreach v, $(JVM_VARIANTS), \
176     $(eval $(call CreateCDSArchive,$v,)) \
177   )
178 
179   ifeq ($(call isTargetCpuBits, 64), true)
180     $(foreach v, $(JVM_VARIANTS), \
181       $(eval $(call CreateCDSArchive,$v,_nocoops)) \
182     )
183   endif
184 endif
185 
186 ################################################################################
187 # src.zip
188 
189 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
190 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
191 	$(install-file)
192 
193 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
194 
195 ################################################################################
196 # /demo dir
197 # Avoid doing the expensive find unless called with "jdk" as target.
198 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
199 
200   DEMO_FILES := \
201       $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \

  1 #
  2 # Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
  3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4 #
  5 # This code is free software; you can redistribute it and/or modify it
  6 # under the terms of the GNU General Public License version 2 only, as
  7 # published by the Free Software Foundation.  Oracle designates this
  8 # particular file as subject to the "Classpath" exception as provided
  9 # by Oracle in the LICENSE file that accompanied this code.
 10 #
 11 # This code is distributed in the hope that it will be useful, but WITHOUT
 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14 # version 2 for more details (a copy is included in the LICENSE file that
 15 # accompanied this code).
 16 #
 17 # You should have received a copy of the GNU General Public License version
 18 # 2 along with this work; if not, write to the Free Software Foundation,
 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20 #
 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22 # or visit www.oracle.com if you need additional information or have any

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