src/share/vm/runtime/sharedRuntime.cpp

Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:

@@ -59,20 +59,22 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/vframe.hpp"
 #include "runtime/vframeArray.hpp"
-#include "trace/tracing.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/hashtable.inline.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/xmlstream.hpp"
 #ifdef COMPILER1
 #include "c1/c1_Runtime1.hpp"
 #endif
+#if INCLUDE_TRACE
+#include "trace/tracing.hpp"
+#endif
 
 // Shared stub locations
 RuntimeStub*        SharedRuntime::_wrong_method_blob;
 RuntimeStub*        SharedRuntime::_wrong_method_abstract_blob;
 RuntimeStub*        SharedRuntime::_ic_miss_blob;

@@ -3127,10 +3129,20 @@
   assert(thread->is_Java_thread(), "Only Java threads have a stack reserved zone");
   thread->enable_stack_reserved_zone();
   thread->set_reserved_stack_activation(thread->stack_base());
 JRT_END
 
+#if INCLUDE_TRACE
+static void post_stack_reservation_event(const Method* method) {
+  EventReservedStackActivation event;
+  if (event.should_commit()) {
+    event.set_method(method);
+    event.commit();
+  }
+}
+#endif
+
 frame SharedRuntime::look_for_reserved_stack_annotated_method(JavaThread* thread, frame fr) {
   frame activation;
   CompiledMethod* nm = NULL;
   int count = 1;
 

@@ -3151,20 +3163,15 @@
       ResourceMark rm(thread);
       activation = fr;
       warning("Potentially dangerous stack overflow in "
               "ReservedStackAccess annotated method %s [%d]",
               method->name_and_sig_as_C_string(), count++);
-      EventReservedStackActivation event;
-      if (event.should_commit()) {
-        event.set_method(method);
-        event.commit();
-      }
+      TRACE_ONLY(post_stack_reservation_event(method);)
     }
     if (fr.is_first_java_frame()) {
       break;
     } else {
       fr = fr.java_sender();
     }
   }
   return activation;
 }
-