File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 4040#include " oops/oop.inline.hpp"
4141#include " runtime/java.hpp"
4242#include " runtime/nonJavaThread.hpp"
43- #include " runtime/thread.inline.hpp"
4443
4544ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL ;
4645ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL ;
@@ -929,8 +928,7 @@ inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt)
929928 if (_discovery_is_mt) {
930929 // During a multi-threaded discovery phase,
931930 // each thread saves to its "own" list.
932- Thread* thr = Thread::current ();
933- id = thr->as_Worker_thread ()->id ();
931+ id = WorkerThread::current ()->id ();
934932 } else {
935933 // single-threaded discovery, we save in round-robin
936934 // fashion to each of the lists.
Original file line number Diff line number Diff line change @@ -103,6 +103,15 @@ class WorkerThread: public NamedThread {
103103 private:
104104 uint _id;
105105 public:
106+ static WorkerThread* current () {
107+ return WorkerThread::cast (Thread::current ());
108+ }
109+
110+ static WorkerThread* cast (Thread* t) {
111+ assert (t->is_Worker_thread (), " incorrect cast to WorkerThread" );
112+ return static_cast <WorkerThread*>(t);
113+ }
114+
106115 WorkerThread () : _id(0 ) { }
107116 virtual bool is_Worker_thread () const { return true ; }
108117
Original file line number Diff line number Diff line change @@ -356,7 +356,6 @@ class Thread: public ThreadShadow {
356356 virtual bool is_active_Java_thread () const { return false ; }
357357
358358 // Casts
359- inline const WorkerThread* as_Worker_thread () const ;
360359 inline JavaThread* as_Java_thread ();
361360 inline const JavaThread* as_Java_thread () const ;
362361
Original file line number Diff line number Diff line change @@ -66,11 +66,6 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* new_list) {
6666 Atomic::release_store_fence (&_threads_hazard_ptr, new_list);
6767}
6868
69- inline const WorkerThread* Thread::as_Worker_thread () const {
70- assert (is_Worker_thread (), " incorrect cast to const WorkerThread" );
71- return static_cast <const WorkerThread*>(this );
72- }
73-
7469#if defined(__APPLE__) && defined(AARCH64)
7570inline void Thread::init_wx () {
7671 assert (this == Thread::current (), " should only be called for current thread" );
You can’t perform that action at this time.
0 commit comments