8145788: JVM crashes with -XX:+EnableTracing
authormgronlun
Tue, 12 Jan 2016 15:38:56 +0100
changeset 35473 cf27aeb0942d
parent 35471 deb38c83d759
child 35474 8333d76c7fee
8145788: JVM crashes with -XX:+EnableTracing Reviewed-by: dholmes, ysuenaga, mlarsson
hotspot/src/share/vm/trace/traceEventClasses.xsl
hotspot/src/share/vm/trace/traceStream.hpp
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl	Fri Jan 08 08:51:18 2016 -0800
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl	Tue Jan 12 15:38:56 2016 +0100
@@ -36,7 +36,6 @@
 // Some parts of traceEvent.hpp are used outside of
 // INCLUDE_TRACE
 
-#include "memory/resourceArea.hpp"
 #include "tracefiles/traceTypes.hpp"
 #include "trace/traceEvent.hpp"
 #include "utilities/macros.hpp"
@@ -136,7 +135,6 @@
 </xsl:text>
   <xsl:value-of select="concat('  Event', @id, '(EventStartTime timing=TIMED) : TraceEvent&lt;Event', @id, '&gt;(timing) {}', $newline)"/>
   void writeEvent(void) {
-    ResourceMark rm;
     if (UseLockedTracing) {
       ttyLocker lock;
       writeEventContent();
--- a/hotspot/src/share/vm/trace/traceStream.hpp	Fri Jan 08 08:51:18 2016 -0800
+++ b/hotspot/src/share/vm/trace/traceStream.hpp	Tue Jan 12 15:38:56 2016 +0100
@@ -27,6 +27,7 @@
 
 #include "utilities/macros.hpp"
 #if INCLUDE_TRACE
+#include "memory/resourceArea.hpp"
 #include "oops/klass.hpp"
 #include "oops/method.hpp"
 #include "oops/symbol.hpp"
@@ -79,11 +80,8 @@
     _st.print("%s = %f", label, val);
   }
 
-  // Caller is machine generated code located in traceEventClasses.hpp
-  // Event<TraceId>::writeEvent() (pseudocode) contains the
-  // necessary ResourceMark for the resource allocations below.
-  // See traceEventClasses.xsl for details.
   void print_val(const char* label, const Klass* const val) {
+    ResourceMark rm;
     const char* description = "NULL";
     if (val != NULL) {
       Symbol* name = val->name();
@@ -94,11 +92,8 @@
     _st.print("%s = %s", label, description);
   }
 
-  // Caller is machine generated code located in traceEventClasses.hpp
-  // Event<TraceId>::writeEvent() (pseudocode) contains the
-  // necessary ResourceMark for the resource allocations below.
-  // See traceEventClasses.xsl for details.
   void print_val(const char* label, const Method* const val) {
+    ResourceMark rm;
     const char* description = "NULL";
     if (val != NULL) {
       description = val->name_and_sig_as_C_string();