Skip to content
Permalink
Browse files

jthread not defined in jni.h, revert

  • Loading branch information
mgronlun committed Feb 6, 2020
1 parent 61e8c42 commit d52569ef1a4107c376dd14292c96d5c659b09ddc
@@ -74,15 +74,15 @@ void Jfr::on_thread_start(Thread* t) {
JfrThreadLocal::on_start(t);
}

void Jfr::on_thread_start(jthread carrier_thread, jthread vthread) {
void Jfr::on_thread_start(jobject carrier_thread, jobject vthread) {
JfrThreadLocal::on_vthread_start(JfrJavaSupport::java_thread(carrier_thread), vthread);
}

void Jfr::on_thread_exit(Thread* t) {
JfrThreadLocal::on_exit(t);
}

void Jfr::on_thread_exit(jthread carrier_thread, jthread vthread) {
void Jfr::on_thread_exit(jobject carrier_thread, jobject vthread) {
JfrThreadLocal::on_vthread_exit(JfrJavaSupport::java_thread(carrier_thread), vthread);
}

@@ -48,9 +48,9 @@ class Jfr : AllStatic {
static void on_create_vm_3();
static void on_unloading_classes();
static void on_thread_start(Thread* thread);
static void on_thread_start(jthread carrier_thread, jthread vthread);
static void on_thread_start(jobject carrier_thread, jobject vthread);
static void on_thread_exit(Thread* thread);
static void on_thread_exit(jthread carrier_thread, jthread vthread);
static void on_thread_exit(jobject carrier_thread, jobject vthread);
static void on_java_thread_dismantle(JavaThread* jt);
static void on_vm_shutdown(bool exception_handler = false);
static bool on_flight_recorder_option(const JavaVMOption** option, char* delimiter);
@@ -656,19 +656,19 @@ static int find_exclusion_thread_idx(Handle thread) {
return -1;
}

static Handle as_handle(jthread thread) {
static Handle as_handle(jobject thread) {
return Handle(Thread::current(), JfrJavaSupport::resolve_non_null(thread));
}

static bool thread_is_not_excluded(Handle thread) {
return -1 == find_exclusion_thread_idx(thread);
}

static bool thread_is_not_excluded(jthread thread) {
static bool thread_is_not_excluded(jobject thread) {
return thread_is_not_excluded(as_handle(thread));
}

static bool is_thread_excluded(jthread thread) {
static bool is_thread_excluded(jobject thread) {
return !thread_is_not_excluded(thread);
}

@@ -678,7 +678,7 @@ static bool is_thread_excluded(Handle thread) {
}
#endif // ASSERT

static int add_thread_to_exclusion_list(jthread thread) {
static int add_thread_to_exclusion_list(jobject thread) {
ThreadExclusionListAccess lock;
if (exclusion_list == NULL) {
exclusion_list = new (ResourceObj::C_HEAP, mtTracing) GrowableArray<jweak>(10, true, mtTracing);
@@ -707,7 +707,7 @@ static void remove_thread_from_exclusion_list(Handle thread) {
}
}

static void remove_thread_from_exclusion_list(jthread thread) {
static void remove_thread_from_exclusion_list(jobject thread) {
ThreadExclusionListAccess lock;
remove_thread_from_exclusion_list(as_handle(thread));
}
@@ -722,18 +722,18 @@ static bool check_exclusion_state_on_thread_start(Handle h_threadObj) {
return true;
}

JavaThread* JfrJavaSupport::java_thread(jthread thread) {
JavaThread* JfrJavaSupport::java_thread(jobject thread) {
ThreadsListHandle tlh;
JavaThread* t;
return tlh.cv_internal_thread_to_JavaThread(thread, &t, NULL) ? t : NULL;
}

jlong JfrJavaSupport::jfr_thread_id(jthread thread) {
jlong JfrJavaSupport::jfr_thread_id(jobject thread) {
JavaThread* const jt = java_thread(thread);
return jt != NULL ? JFR_THREAD_ID(jt) : 0;
}

void JfrJavaSupport::exclude(jthread thread) {
void JfrJavaSupport::exclude(jobject thread) {
JavaThread* const jt = java_thread(thread);
if (jt != NULL) {
JfrThreadLocal::exclude(jt);
@@ -743,7 +743,7 @@ void JfrJavaSupport::exclude(jthread thread) {
}
}

void JfrJavaSupport::include(jthread thread) {
void JfrJavaSupport::include(jobject thread) {
JavaThread* const jt = java_thread(thread);
if (jt != NULL) {
JfrThreadLocal::include(jt);
@@ -753,7 +753,7 @@ void JfrJavaSupport::include(jthread thread) {
}
}

bool JfrJavaSupport::is_excluded(jthread thread) {
bool JfrJavaSupport::is_excluded(jobject thread) {
JavaThread* const jt = java_thread(thread);
return jt != NULL ? jt->jfr_thread_local()->is_excluded() : is_thread_excluded(thread);
}
@@ -827,7 +827,7 @@ bool JfrJavaSupport::set_handler(jobject clazz, jobject handler, TRAPS) {
}


bool JfrJavaSupport::on_thread_start(JavaThread* jt, jthread vthread) {
bool JfrJavaSupport::on_thread_start(JavaThread* jt, jobject vthread) {
assert(jt != NULL, "invariant");
assert(Thread::current() == jt, "invariant");
DEBUG_ONLY(check_new_unstarted_java_thread(jt, vthread);)
@@ -99,12 +99,12 @@ class JfrJavaSupport : public AllStatic {
static bool is_jdk_jfr_module_available(outputStream* stream, TRAPS);

// thread
static JavaThread* java_thread(jthread thread);
static jlong jfr_thread_id(jthread thread);
static void exclude(jthread thread);
static void include(jthread thread);
static bool is_excluded(jthread thread);
static bool on_thread_start(JavaThread* jt, jthread vthread = NULL);
static JavaThread* java_thread(jobject thread);
static jlong jfr_thread_id(jobject thread);
static void exclude(jobject thread);
static void include(jobject thread);
static bool is_excluded(jobject thread);
static bool on_thread_start(JavaThread* jt, jobject vthread = NULL);

static jobject get_handler(jobject clazz, TRAPS);
static bool set_handler(jobject clazz, jobject handler, TRAPS);
@@ -195,7 +195,7 @@ void JfrThreadLocal::on_exit(Thread* t) {
release(tl, Thread::current()); // because it could be that Thread::current() != t
}

void JfrThreadLocal::on_vthread_exit(JavaThread* jt, jthread vthread) {
void JfrThreadLocal::on_vthread_exit(JavaThread* jt, jobject vthread) {
assert(vthread != NULL, "invariant");
const traceid static_tid = JfrThreadLocal::static_thread_id(jt);
const traceid id = JfrVirtualThread::thread_id(JfrJavaSupport::resolve_non_null(vthread), jt);
@@ -225,9 +225,9 @@ class JfrThreadLocal {
static void include(Thread* t);

static void on_start(Thread* t);
static void on_vthread_start(JavaThread* jt, jthread vthread);
static void on_vthread_start(JavaThread* jt, jobject vthread);
static void on_exit(Thread* t);
static void on_vthread_exit(JavaThread* jt, jthread vthread);
static void on_vthread_exit(JavaThread* jt, jobject vthread);

// Code generation
static ByteSize trace_id_offset();

0 comments on commit d52569e

Please sign in to comment.
You can’t perform that action at this time.