Fri, 03 Sep 2010 17:51:07 -0700
6953144: Tiered compilation
Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation.
Reviewed-by: kvn, never, phh, twisti
1 #
2 # Copyright (c) 1998, 2010, 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.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
23 #
25 # This makefile creates a build tree and lights off a build.
26 # You can go back into the build tree and perform rebuilds or
27 # incremental builds as desired. Be sure to reestablish
28 # environment variable settings for LD_LIBRARY_PATH and JAVA_HOME.
30 # The make process now relies on java and javac. These can be
31 # specified either implicitly on the PATH, by setting the
32 # (JDK-inherited) ALT_BOOTDIR environment variable to full path to a
33 # JDK in which bin/java and bin/javac are present and working (e.g.,
34 # /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited)
35 # default BOOTDIR path value. Note that one of ALT_BOOTDIR
36 # or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc.
37 # from the PATH.
39 # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
40 # JDI binding on SA produces two binaries:
41 # 1. sa-jdi.jar - This is build before building libjvm[_g].so
42 # Please refer to ./makefiles/sa.make
43 # 2. libsaproc[_g].so - Native library for SA - This is built after
44 # libjsig[_g].so (signal interposition library)
45 # Please refer to ./makefiles/vm.make
46 # If $(GAMMADIR)/agent dir is not present, SA components are not built.
48 ifeq ($(GAMMADIR),)
49 include ../../make/defs.make
50 else
51 include $(GAMMADIR)/make/defs.make
52 endif
53 include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make
55 ifndef CC_INTERP
56 FORCE_TIERED=1
57 endif
59 ifdef LP64
60 ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
61 _JUNK_ := $(shell echo >&2 \
62 $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!")
63 @exit 1
64 endif
65 endif
67 # The following renders pathnames in generated Makefiles valid on
68 # machines other than the machine containing the build tree.
69 #
70 # For example, let's say my build tree lives on /files12 on
71 # exact.east.sun.com. This logic will cause GAMMADIR to begin with
72 # /net/exact/files12/...
73 #
74 # We only do this on SunOS variants, for a couple of reasons:
75 # * It is extremely rare that source trees exist on other systems
76 # * It has been claimed that the Linux automounter is flakey, so
77 # changing GAMMADIR in a way that exercises the automounter could
78 # prove to be a source of unreliability in the build process.
79 # Obviously, this Makefile is only relevant on SunOS boxes to begin
80 # with, but the SunOS conditionalization will make it easier to
81 # combine Makefiles in the future (assuming we ever do that).
83 ifeq ($(OSNAME),solaris)
85 # prepend current directory to relative pathnames.
86 NEW_GAMMADIR := \
87 $(shell echo $(GAMMADIR) | \
88 sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \
89 )
90 unexport NEW_GAMMADIR
92 # If NEW_GAMMADIR doesn't already start with "/net/":
93 ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),)
94 # prepend /net/$(HOST)
95 # remove /net/$(HOST) if name already began with /home/
96 # remove /net/$(HOST) if name already began with /java/
97 # remove /net/$(HOST) if name already began with /lab/
98 NEW_GAMMADIR := \
99 $(shell echo $(NEW_GAMMADIR) | \
100 sed -e "s=^\(.*\)=/net/$(HOST)\1=" \
101 -e "s=^/net/$(HOST)/home/=/home/=" \
102 -e "s=^/net/$(HOST)/java/=/java/=" \
103 -e "s=^/net/$(HOST)/lab/=/lab/=" \
104 )
105 # Don't use the new value for GAMMADIR unless a file with the new
106 # name actually exists.
107 ifneq ($(wildcard $(NEW_GAMMADIR)),)
108 GAMMADIR := $(NEW_GAMMADIR)
109 endif
110 endif
112 endif
115 # There is a (semi-) regular correspondence between make targets and actions:
116 #
117 # Target Tree Type Build Dir
118 #
119 # debug compiler2 <os>_<arch>_compiler2/debug
120 # fastdebug compiler2 <os>_<arch>_compiler2/fastdebug
121 # jvmg compiler2 <os>_<arch>_compiler2/jvmg
122 # optimized compiler2 <os>_<arch>_compiler2/optimized
123 # profiled compiler2 <os>_<arch>_compiler2/profiled
124 # product compiler2 <os>_<arch>_compiler2/product
125 #
126 # debug1 compiler1 <os>_<arch>_compiler1/debug
127 # fastdebug1 compiler1 <os>_<arch>_compiler1/fastdebug
128 # jvmg1 compiler1 <os>_<arch>_compiler1/jvmg
129 # optimized1 compiler1 <os>_<arch>_compiler1/optimized
130 # profiled1 compiler1 <os>_<arch>_compiler1/profiled
131 # product1 compiler1 <os>_<arch>_compiler1/product
132 #
133 # debugcore core <os>_<arch>_core/debug
134 # fastdebugcore core <os>_<arch>_core/fastdebug
135 # jvmgcore core <os>_<arch>_core/jvmg
136 # optimizedcore core <os>_<arch>_core/optimized
137 # profiledcore core <os>_<arch>_core/profiled
138 # productcore core <os>_<arch>_core/product
139 #
140 # What you get with each target:
141 #
142 # debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher
143 # fastdebug* - optimized compile, but with asserts enabled
144 # jvmg* - "fat" libjvm_g - debug info linked into libjvm_g.so
145 # optimized* - optimized compile, no asserts
146 # profiled* - gprof
147 # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT
149 # This target list needs to be coordinated with the usage message
150 # in the build.sh script:
151 TARGETS = debug jvmg fastdebug optimized profiled product
153 SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs
154 SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS))
155 SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS))
156 SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
157 SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
158 SUBDIRS_KERNEL = $(addprefix $(OSNAME)_$(BUILDARCH)_kernel/,$(TARGETS))
160 TARGETS_C2 = $(TARGETS)
161 TARGETS_C1 = $(addsuffix 1,$(TARGETS))
162 TARGETS_TIERED = $(addsuffix tiered,$(TARGETS))
163 TARGETS_CORE = $(addsuffix core,$(TARGETS))
164 TARGETS_KERNEL = $(addsuffix kernel,$(TARGETS))
166 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
167 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
168 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
170 BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
172 #-------------------------------------------------------------------------------
174 # Could make everything by default, but that would take a while.
175 all:
176 @echo "Try '$(MAKE) <target> ...' where <target> is one or more of"
177 @echo " $(TARGETS_C2)"
178 @echo " $(TARGETS_C1)"
179 @echo " $(TARGETS_CORE)"
181 checks: check_os_version check_j2se_version
183 # We do not want people accidentally building on old systems (e.g. Linux 2.2.x,
184 # Solaris 2.5.1, 2.6).
185 # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
187 SUPPORTED_OS_VERSION = 5.7 5.8 5.9 5.10 5.11
188 OS_VERSION := $(shell uname -r)
189 EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
191 check_os_version:
192 ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
193 $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
194 endif
196 # jvmti.make requires XSLT (J2SE 1.4.x or newer):
197 XSLT_CHECK = $(RUN.JAVAP) javax.xml.transform.TransformerFactory
198 # If not found then fail fast.
199 check_j2se_version:
200 $(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
201 if [ $$? -ne 0 ]; then \
202 $(RUN.JAVA) -version; \
203 echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
204 "to bootstrap this build" 1>&2; \
205 exit 1; \
206 fi
208 $(SUBDIRS_TIERED): $(BUILDTREE_MAKE)
209 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
210 $(BUILDTREE) VARIANT=tiered
212 $(SUBDIRS_C2): $(BUILDTREE_MAKE)
213 ifdef FORCE_TIERED
214 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
215 $(BUILDTREE) VARIANT=tiered FORCE_TIERED=1
216 else
217 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
218 $(BUILDTREE) VARIANT=compiler2
219 endif
221 $(SUBDIRS_C1): $(BUILDTREE_MAKE)
222 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
223 $(BUILDTREE) VARIANT=compiler1
225 $(SUBDIRS_CORE): $(BUILDTREE_MAKE)
226 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
227 $(BUILDTREE) VARIANT=core
229 $(SUBDIRS_KERNEL): $(BUILDTREE_MAKE)
230 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
231 $(BUILDTREE) VARIANT=kernel
233 # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME
235 $(TARGETS_C2): $(SUBDIRS_C2)
236 cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
237 cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma
238 ifdef INSTALL
239 cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
240 endif
242 $(TARGETS_TIERED): $(SUBDIRS_TIERED)
243 cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
244 cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma
245 ifdef INSTALL
246 cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
247 endif
249 $(TARGETS_C1): $(SUBDIRS_C1)
250 cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
251 cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma
252 ifdef INSTALL
253 cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
254 endif
256 $(TARGETS_CORE): $(SUBDIRS_CORE)
257 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
258 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma
259 ifdef INSTALL
260 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
261 endif
263 $(TARGETS_KERNEL): $(SUBDIRS_KERNEL)
264 cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS)
265 cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && ./test_gamma
266 ifdef INSTALL
267 cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS) install
268 endif
270 # Just build the tree, and nothing else:
271 tree: $(SUBDIRS_C2)
272 tree1: $(SUBDIRS_C1)
273 treecore: $(SUBDIRS_CORE)
274 treekernel: $(SUBDIRS_KERNEL)
276 # Doc target. This is the same for all build options.
277 # Hence create a docs directory beside ...$(ARCH)_[...]
278 docs: checks
279 $(QUIETLY) mkdir -p $(SUBDIR_DOCS)
280 $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) jvmtidocs
282 # Synonyms for win32-like targets.
283 compiler2: jvmg product
285 compiler1: jvmg1 product1
287 core: jvmgcore productcore
289 clean_docs:
290 rm -rf $(SUBDIR_DOCS)
292 clean_compiler1 clean_compiler2 clean_core clean_kernel:
293 rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
295 clean: clean_compiler2 clean_compiler1 clean_core clean_docs clean_kernel
297 include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make
299 #-------------------------------------------------------------------------------
301 .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE)
302 .PHONY: tree tree1 treecore
303 .PHONY: all compiler1 compiler2 core
304 .PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs
305 .PHONY: checks check_os_version check_j2se_version