src/share/vm/runtime/java.cpp
Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:
@@ -64,12 +64,10 @@
#include "runtime/task.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/timer.hpp"
#include "runtime/vm_operations.hpp"
#include "services/memTracker.hpp"
-#include "trace/traceMacros.hpp"
-#include "trace/tracing.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/histogram.hpp"
#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
@@ -86,10 +84,14 @@
#include "compiler/methodLiveness.hpp"
#include "opto/compile.hpp"
#include "opto/indexSet.hpp"
#include "opto/runtime.hpp"
#endif
+#if INCLUDE_TRACE
+#include "trace/traceMacros.hpp"
+#include "trace/tracing.hpp"
+#endif
GrowableArray<Method*>* collected_profiled_methods;
int compare_methods(Method** a, Method** b) {
// %%% there can be 32-bit overflow here
@@ -397,10 +399,20 @@
}
}
#endif
+#if INCLUDE_TRACE
+static void post_thread_end_event(const JavaThread* jt) {
+ EventThreadEnd event;
+ if (event.should_commit()) {
+ event.set_thread(THREAD_TRACE_ID(jt));
+ event.commit();
+ }
+}
+#endif
+
// Note: before_exit() can be executed only once, if more than one threads
// are trying to shutdown the VM at the same time, only one thread
// can run before_exit() and all other threads must wait.
void before_exit(JavaThread* thread) {
#define BEFORE_EXIT_NOT_RUN 0
@@ -446,16 +458,11 @@
// Hang forever on exit if we're reporting an error.
if (ShowMessageBoxOnError && is_error_reported()) {
os::infinite_sleep();
}
- EventThreadEnd event;
- if (event.should_commit()) {
- event.set_thread(THREAD_TRACE_ID(thread));
- event.commit();
- }
-
+ TRACE_ONLY(post_thread_end_event(thread);)
TRACE_VM_EXIT();
// Stop the WatcherThread. We do this before disenrolling various
// PeriodicTasks to reduce the likelihood of races.
if (PeriodicTask::num_tasks() > 0) {