Fri, 20 Sep 2013 10:53:28 +0200
8024974: Incorrect use of GC_locker::is_active()
Summary: SymbolTable and StringTable can make calls to GC_locker::is_active() outside a safepoint. This isn't safe because the GC_locker active state (lock count) is only updated at a safepoint and only remains valid as long as _needs_gc is true. However, outside a safepoint_needs_gc can change to false at any time, which makes it impossible to do a correct call to is_active() in that context. In this case these calls can just be removed since the input argument to basic_add() should never be on the heap and so there's no need to check the GC_locker state. This change also adjusts the assert() in is_active() to makes sure all calls to this function are always done under a safepoint.
Reviewed-by: brutisso, dcubed
Contributed-by: per.liden@oracle.com
1 #
2 # Copyright (c) 2003, 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 # This makefile (trace.make) is included from the trace.make in the
26 # build directories.
27 #
28 # It knows how to build and run the tools to generate trace files.
30 !include $(WorkSpace)/make/windows/makefiles/rules.make
32 # #########################################################################
35 TraceAltSrcDir = $(WorkSpace)/src/closed/share/vm/trace
36 TraceSrcDir = $(WorkSpace)/src/share/vm/trace
38 TraceGeneratedNames = \
39 traceEventClasses.hpp \
40 traceEventIds.hpp \
41 traceTypes.hpp
44 !if "$(OPENJDK)" != "true"
45 TraceGeneratedNames = $(TraceGeneratedNames) \
46 traceRequestables.hpp \
47 traceEventControl.hpp \
48 traceProducer.cpp
49 !endif
52 #Note: TraceGeneratedFiles must be kept in sync with TraceGeneratedNames by hand.
53 #Should be equivalent to "TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)"
54 TraceGeneratedFiles = \
55 $(TraceOutDir)/traceEventClasses.hpp \
56 $(TraceOutDir)/traceEventIds.hpp \
57 $(TraceOutDir)/traceTypes.hpp
59 !if "$(OPENJDK)" != "true"
60 TraceGeneratedFiles = $(TraceGeneratedFiles) \
61 $(TraceOutDir)/traceRequestables.hpp \
62 $(TraceOutDir)/traceEventControl.hpp \
63 $(TraceOutDir)/traceProducer.cpp
64 !endif
66 XSLT = $(QUIETLY) $(REMOTE) $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen
68 XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
69 $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
71 !if "$(OPENJDK)" != "true"
72 XML_DEPS = $(XML_DEPS) $(TraceAltSrcDir)/traceevents.xml
73 !endif
75 .PHONY: all clean cleanall
77 # #########################################################################
79 default::
80 @if not exist $(TraceOutDir) mkdir $(TraceOutDir)
82 $(TraceOutDir)/traceEventIds.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS)
83 @echo Generating $@
84 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceEventIds.xsl -OUT $(TraceOutDir)/traceEventIds.hpp
86 $(TraceOutDir)/traceTypes.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS)
87 @echo Generating $@
88 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceTypes.xsl -OUT $(TraceOutDir)/traceTypes.hpp
90 !if "$(OPENJDK)" == "true"
92 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS)
93 @echo Generating OpenJDK $@
94 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp
96 !else
98 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
99 @echo Generating AltSrc $@
100 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp
102 $(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
103 @echo Generating AltSrc $@
104 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceProducer.xsl -OUT $(TraceOutDir)/traceProducer.cpp
106 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
107 @echo Generating AltSrc $@
108 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp
110 $(TraceOutDir)/traceEventControl.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS)
111 @echo Generating AltSrc $@
112 @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventControl.xsl -OUT $(TraceOutDir)/traceEventControl.hpp
114 !endif
116 # #########################################################################
118 cleanall :
119 rm $(TraceGeneratedFiles)