src/share/vm/prims/jni.cpp
Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:
*** 74,85 ****
#include "runtime/signature.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vm_operations.hpp"
#include "services/memTracker.hpp"
#include "services/runtimeService.hpp"
- #include "trace/traceMacros.hpp"
- #include "trace/tracing.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/histogram.hpp"
#include "utilities/internalVMTests.hpp"
--- 74,83 ----
*** 89,98 ****
--- 87,100 ----
#endif // INCLUDE_ALL_GCS
#if INCLUDE_JVMCI
#include "jvmci/jvmciCompiler.hpp"
#include "jvmci/jvmciRuntime.hpp"
#endif
+ #if INCLUDE_TRACE
+ #include "trace/traceMacros.hpp"
+ #include "trace/tracing.hpp"
+ #endif
static jint CurrentVersion = JNI_VERSION_9;
#ifdef _WIN32
extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
*** 3823,3832 ****
--- 3825,3845 ----
jni_NativeInterface.GetDoubleField = (GetDoubleField_t)func;
}
}
}
+ #if INCLUDE_TRACE
+ static void post_thread_start_event(const JavaThread* jt) {
+ assert(jt != NULL, "invariant");
+ EventThreadStart event;
+ if (event.should_commit()) {
+ event.set_thread(THREAD_TRACE_ID(jt));
+ event.commit();
+ }
+ }
+ #endif
+
// Returns the function structure
struct JNINativeInterface_* jni_functions() {
#if INCLUDE_JNI_CHECK
if (CheckJNICalls) return jni_functions_check();
#endif // INCLUDE_JNI_CHECK
*** 3968,3982 ****
// Notify JVMTI
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
}
! EventThreadStart event;
! if (event.should_commit()) {
! event.set_thread(THREAD_TRACE_ID(thread));
! event.commit();
! }
#ifndef PRODUCT
// Check if we should compile all classes on bootclasspath
if (CompileTheWorld) ClassLoader::compile_the_world();
if (ReplayCompiles) ciReplay::replay(thread);
--- 3981,3991 ----
// Notify JVMTI
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
}
! TRACE_ONLY(post_thread_start_event(thread);)
#ifndef PRODUCT
// Check if we should compile all classes on bootclasspath
if (CompileTheWorld) ClassLoader::compile_the_world();
if (ReplayCompiles) ciReplay::replay(thread);
*** 4188,4202 ****
// Notify the debugger
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
}
! EventThreadStart event;
! if (event.should_commit()) {
! event.set_thread(THREAD_TRACE_ID(thread));
! event.commit();
! }
*(JNIEnv**)penv = thread->jni_environment();
// Now leaving the VM, so change thread_state. This is normally automatically taken care
// of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by
--- 4197,4207 ----
// Notify the debugger
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
}
! TRACE_ONLY(post_thread_start_event(thread);)
*(JNIEnv**)penv = thread->jni_environment();
// Now leaving the VM, so change thread_state. This is normally automatically taken care
// of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by