--- old/test/hotspot/gtest/threadHelper.inline.hpp 2018-12-20 23:35:48.721018462 -0500 +++ new/test/hotspot/gtest/threadHelper.inline.hpp 2018-12-20 23:35:46.704903263 -0500 @@ -48,8 +48,11 @@ public: Semaphore _ready; Semaphore _unblock; - VMThreadBlocker() {} + VMThreadBlocker() { } virtual ~VMThreadBlocker() {} + const char* get_thread_name_string(char* buf, int buflen) const { + return (char*) "VMThreadBlocker"; + } void run() { this->set_thread_state(_thread_in_vm); { @@ -58,9 +61,15 @@ } VM_StopSafepoint ss(&_ready, &_unblock); VMThread::execute(&ss); + } + + // Override as JavaThread::post_run() calls JavaThread::exit which + // expects a valid thread object oop. + virtual void post_run() { Threads::remove(this); this->smr_delete(); } + void doit() { if (os::create_thread(this, os::os_thread)) { os::start_thread(this); @@ -85,7 +94,11 @@ } virtual ~JavaTestThread() {} - void prerun() { + const char* get_thread_name_string(char* buf, int buflen) const { + return (char*) "JavaTestThread"; + } + + void pre_run() { this->set_thread_state(_thread_in_vm); { MutexLocker ml(Threads_lock); @@ -99,12 +112,12 @@ virtual void main_run() = 0; void run() { - prerun(); main_run(); - postrun(); } - void postrun() { + // Override as JavaThread::post_run() calls JavaThread::exit which + // expects a valid thread object oop. And we need to call signal. + void post_run() { Threads::remove(this); _post->signal(); this->smr_delete();