Fri, 25 Jan 2013 10:04:08 -0500
8000692: Remove old KERNEL code
Summary: Removed depreciated kernel VM source code from hotspot VM
Reviewed-by: dholmes, acorn
1 #
2 # Copyright (c) 2005, 2013, 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 # Rules to build jvm_db/dtrace, used by vm.make
27 # We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2
28 # but not for CORE configuration.
30 ifneq ("${TYPE}", "CORE")
32 ifeq ($(OS_VENDOR), Darwin)
33 # we build dtrace for macosx using USDT2 probes
35 DtraceOutDir = $(GENERATED)/dtracefiles
37 # Bsd does not build libjvm_db, does not compile on macosx
38 # disabled in build: rule in vm.make
39 JVM_DB = libjvm_db
40 LIBJVM_DB = libjvm_db.dylib
42 JVM_DTRACE = jvm_dtrace
43 LIBJVM_DTRACE = libjvm_dtrace.dylib
45 JVMOFFS = JvmOffsets
46 JVMOFFS.o = $(JVMOFFS).o
47 GENOFFS = generate$(JVMOFFS)
49 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace
50 DTRACE = dtrace
51 DTRACE.o = $(DTRACE).o
53 # to remove '-g' option which causes link problems
54 # also '-z nodefs' is used as workaround
55 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
57 ifdef LP64
58 DTRACE_OPTS = -D_LP64
59 endif
61 # making libjvm_db
63 # Use mapfile with libjvm_db.so
64 LIBJVM_DB_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_db
65 #LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE))
67 # Use mapfile with libjvm_dtrace.so
68 LIBJVM_DTRACE_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace
69 #LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE))
71 LFLAGS_JVM_DB += $(PICFLAG) # -D_REENTRANT
72 LFLAGS_JVM_DTRACE += $(PICFLAG) # -D_REENTRANT
74 ISA = $(subst i386,i486,$(BUILDARCH))
76 # Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so
77 ifneq ("${ISA}","${BUILDARCH}")
79 XLIBJVM_DB = 64/$(LIBJVM_DB)
80 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE)
81 XARCH = $(subst sparcv9,v9,$(shell echo $(ISA)))
83 $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
84 @echo Making $@
85 $(QUIETLY) mkdir -p 64/ ; \
86 $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \
87 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc
89 $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
90 @echo Making $@
91 $(QUIETLY) mkdir -p 64/ ; \
92 $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \
93 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
95 endif # ifneq ("${ISA}","${BUILDARCH}")
97 LFLAGS_GENOFFS += -L.
99 lib$(GENOFFS).dylib: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \
100 $(LIBJVM.o)
101 $(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \
102 $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -ljvm
104 $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).dylib
105 $(QUIETLY) $(LINK.CXX) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \
106 ./lib$(GENOFFS).dylib
108 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
109 $(JVMOFFS).h: $(GENOFFS)
110 $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \
111 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
112 then rm -f $@; mv $@.tmp $@; \
113 else rm -f $@.tmp; \
114 fi
116 $(JVMOFFS)Index.h: $(GENOFFS)
117 $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \
118 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
119 then rm -f $@; mv $@.tmp $@; \
120 else rm -f $@.tmp; \
121 fi
123 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
124 $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \
125 if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
126 then rm -f $@; mv $@.tmp $@; \
127 else rm -f $@.tmp; \
128 fi
130 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp
131 $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
133 $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
134 @echo Making $@
135 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
136 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc
138 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
139 @echo Making $@
140 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
141 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
143 #$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \
144 # $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
145 # $(QUIETLY) cat $^ > $@
147 $(DtraceOutDir):
148 mkdir $(DtraceOutDir)
150 $(DtraceOutDir)/hotspot.h: $(DTRACE_SRCDIR)/hotspot.d | $(DtraceOutDir)
151 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot.d
153 $(DtraceOutDir)/hotspot_jni.h: $(DTRACE_SRCDIR)/hotspot_jni.d | $(DtraceOutDir)
154 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot_jni.d
156 $(DtraceOutDir)/hs_private.h: $(DTRACE_SRCDIR)/hs_private.d | $(DtraceOutDir)
157 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hs_private.d
159 $(DtraceOutDir)/jhelper.h: $(DTRACE_SRCDIR)/jhelper.d $(JVMOFFS).o | $(DtraceOutDir)
160 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/jhelper.d
162 # jhelper currently disabled
163 dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
165 DTraced_Files = ciEnv.o \
166 classLoadingService.o \
167 compileBroker.o \
168 hashtable.o \
169 instanceKlass.o \
170 java.o \
171 jni.o \
172 jvm.o \
173 memoryManager.o \
174 nmethod.o \
175 objectMonitor.o \
176 runtimeService.o \
177 sharedRuntime.o \
178 synchronizer.o \
179 thread.o \
180 unsafe.o \
181 vmThread.o \
182 vmCMSOperations.o \
183 vmPSOperations.o \
184 vmGCOperations.o \
186 # Dtrace is available, so we build $(DTRACE.o)
187 #$(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
188 # @echo Compiling $(DTRACE).d
190 # $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
191 # $(DTraced_Files) ||\
192 # STATUS=$$?;\
193 # if [ x"$$STATUS" = x"1" -a \
194 # x`uname -r` = x"5.10" -a \
195 # x`uname -p` = x"sparc" ]; then\
196 # echo "*****************************************************************";\
197 # echo "* If you are building server compiler, and the error message is ";\
198 # echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\
199 # echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\
200 # echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\
201 # echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
202 # echo "* dtrace probes for this build.";\
203 # echo "*****************************************************************";\
204 # fi;\
205 # exit $$STATUS
206 # Since some DTraced_Files are in LIBJVM.o and they are touched by this
207 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will
208 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets*
209 # files, but it doesn't, so we touch the necessary files to prevent later
210 # recompilation. Note: we only touch the necessary files if they already
211 # exist in order to close a race where an empty file can be created
212 # before the real build rule is executed.
213 # But, we can't touch the *.h files: This rule depends
214 # on them, and that would cause an infinite cycle of rebuilding.
215 # Neither the *.h or *.ccp files need to be touched, since they have
216 # rules which do not update them when the generator file has not
217 # changed their contents.
218 # $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi
219 # $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi
220 # $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi
222 .PHONY: dtraceCheck
224 #SYSTEM_DTRACE_H = /usr/include/dtrace.h
225 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
226 #PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
227 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
228 #patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
229 #systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
231 #ifneq ("$(systemDtraceHdrFound)", "")
232 #CFLAGS += -DHAVE_DTRACE_H
233 #endif
235 #ifneq ("$(patchDtraceFound)", "")
236 #DTRACE_PROG=$(PATCH_DTRACE_PROG)
237 #DTRACE_INCL=-I/opt/SUNWdtrd/include
238 #else
239 ifneq ("$(systemDtraceFound)", "")
240 DTRACE_PROG=$(SYSTEM_DTRACE_PROG)
241 else
243 endif # ifneq ("$(systemDtraceFound)", "")
244 #endif # ifneq ("$(patchDtraceFound)", "")
246 ifneq ("${DTRACE_PROG}", "")
247 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
249 DTRACE_OBJS = $(DTRACE.o) #$(JVMOFFS.o)
250 CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL)
251 #clangCFLAGS += -DDTRACE_ENABLED -fno-optimize-sibling-calls
252 #MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE)
255 dtraceCheck:
257 dtrace_stuff: dtrace_gen_headers
258 $(QUIETLY) echo "dtrace headers generated"
261 else # manually disabled
263 dtraceCheck:
264 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
266 dtrace_stuff:
268 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
270 else # No dtrace program found
272 dtraceCheck:
273 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
275 dtrace_stuff:
277 endif # ifneq ("${dtraceFound}", "")
279 endif # ifeq ($(OS_VENDOR), Darwin)
282 else # CORE build
284 dtraceCheck:
285 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds"
287 endif # ifneq ("${TYPE}", "CORE")