Thu, 20 Nov 2008 16:56:09 -0800
6684579: SoftReference processing can be made more efficient
Summary: For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not.
Reviewed-by: jmasa
1 #
2 # Copyright 1995-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 # CA 95054 USA or visit www.sun.com if you need additional information or
21 # have any questions.
22 #
23 #
25 #
26 # Makefile to run various jdk tests
27 #
29 # Get OS/ARCH specifics
30 OSNAME = $(shell uname -s)
31 SLASH_JAVA = /java
32 ifeq ($(OSNAME), SunOS)
33 PLATFORM = solaris
34 ARCH = $(shell uname -p)
35 ifeq ($(ARCH), i386)
36 ARCH=i586
37 endif
38 endif
39 ifeq ($(OSNAME), Linux)
40 PLATFORM = linux
41 ARCH = $(shell uname -m)
42 ifeq ($(ARCH), i386)
43 ARCH = i586
44 endif
45 endif
46 ifeq ($(OSNAME), Windows_NT)
47 PLATFORM = windows
48 SLASH_JAVA = J:
49 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
50 ARCH = ia64
51 else
52 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
53 ARCH = x64
54 else
55 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
56 ARCH = x64
57 else
58 ARCH = i586
59 endif
60 endif
61 endif
62 EXESUFFIX = .exe
63 endif
65 # Utilities used
66 CD = cd
67 CP = cp
68 ECHO = echo
69 MKDIR = mkdir
70 ZIP = zip
72 # Root of this test area (important to use full paths in some places)
73 TEST_ROOT := $(shell pwd)
75 # Root of all test results
76 ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
77 ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput
79 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
80 ifndef PRODUCT_HOME
81 # Try to use j2sdk-image if it exists
82 ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
83 PRODUCT_HOME := \
84 $(shell \
85 if [ -d $(ABS_JDK_IMAGE) ] ; then \
86 $(ECHO) "$(ABS_JDK_IMAGE)"; \
87 else \
88 $(ECHO) "$(ABS_BUILD_ROOT)" ; \
89 fi)
90 endif
92 # Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
93 JAVA_OPTIONS =
94 ifdef JAVA_ARGS
95 JAVA_OPTIONS = $(JAVA_ARGS)
96 endif
98 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
99 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
100 ifdef JPRT_ARCHIVE_BUNDLE
101 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
102 endif
104 # How to create the test bundle (pass or fail, we want to create this)
105 BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \
106 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
107 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
108 BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} )
110 ################################################################
112 # Default make rule (runs jtreg_tests)
113 all: jtreg_tests
114 @$(ECHO) "Testing completed successfully"
116 # Prep for output
117 prep: clean
118 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
119 @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
121 # Cleanup
122 clean:
123 $(RM) -r $(ABS_TEST_OUTPUT_DIR)
124 $(RM) $(ARCHIVE_BUNDLE)
126 ################################################################
128 # jtreg tests
130 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
131 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
132 ifdef JPRT_JTREG_HOME
133 JT_HOME = $(JPRT_JTREG_HOME)
134 endif
136 # Expect JPRT to set TESTDIRS to the jtreg test dirs
137 JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof
138 ifdef TESTDIRS
139 JTREG_TESTDIRS = $(TESTDIRS)
140 endif
142 # Default JTREG to run (win32 script works for everybody)
143 JTREG = $(JT_HOME)/win32/bin/jtreg
145 # Option to tell jtreg to not run tests marked with "ignore"
146 ifeq ($(PLATFORM), windows)
147 JTREG_KEY_OPTION = -k:!ignore
148 else
149 JTREG_KEY_OPTION = -k:\!ignore
150 endif
152 #EXTRA_JTREG_OPTIONS =
154 jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
155 $(JTREG) -a -v:fail,error \
156 $(JTREG_KEY_OPTION) \
157 $(EXTRA_JTREG_OPTIONS) \
158 -r:$(ABS_TEST_OUTPUT_DIR)/JTreport \
159 -w:$(ABS_TEST_OUTPUT_DIR)/JTwork \
160 -jdk:$(PRODUCT_HOME) \
161 $(JAVA_OPTIONS:%=-vmoption:%) \
162 $(JTREG_TESTDIRS) \
163 || $(BUNDLE_UP_FAILED)
164 $(BUNDLE_UP)
166 PHONY_LIST += jtreg_tests
168 ################################################################
170 # packtest
172 # Expect JPRT to set JPRT_PACKTEST_HOME.
173 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
174 ifdef JPRT_PACKTEST_HOME
175 PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
176 endif
178 #EXTRA_PACKTEST_OPTIONS =
180 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
181 ( $(CD) $(PACKTEST_HOME) && \
182 $(PACKTEST_HOME)/ptest \
183 -t "$(PRODUCT_HOME)" \
184 $(PACKTEST_STRESS_OPTION) \
185 $(EXTRA_PACKTEST_OPTIONS) \
186 -W $(ABS_TEST_OUTPUT_DIR) \
187 $(JAVA_OPTIONS:%=-J %) \
188 ) || $(BUNDLE_UP_FAILED)
189 $(BUNDLE_UP)
191 packtest_stress: PACKTEST_STRESS_OPTION=-s
192 packtest_stress: packtest
194 PHONY_LIST += packtest packtest_stress
196 ################################################################
198 # Phony targets (e.g. these are not filenames)
199 .PHONY: all clean prep $(PHONY_LIST)
201 ################################################################