File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 40
40
#include " oops/oop.inline.hpp"
41
41
#include " runtime/java.hpp"
42
42
#include " runtime/nonJavaThread.hpp"
43
- #include " runtime/thread.inline.hpp"
44
43
45
44
ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL ;
46
45
ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL ;
@@ -929,8 +928,7 @@ inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt)
929
928
if (_discovery_is_mt) {
930
929
// During a multi-threaded discovery phase,
931
930
// each thread saves to its "own" list.
932
- Thread* thr = Thread::current ();
933
- id = thr->as_Worker_thread ()->id ();
931
+ id = WorkerThread::current ()->id ();
934
932
} else {
935
933
// single-threaded discovery, we save in round-robin
936
934
// fashion to each of the lists.
Original file line number Diff line number Diff line change @@ -103,6 +103,15 @@ class WorkerThread: public NamedThread {
103
103
private:
104
104
uint _id;
105
105
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
+
106
115
WorkerThread () : _id(0 ) { }
107
116
virtual bool is_Worker_thread () const { return true ; }
108
117
Original file line number Diff line number Diff line change @@ -356,7 +356,6 @@ class Thread: public ThreadShadow {
356
356
virtual bool is_active_Java_thread () const { return false ; }
357
357
358
358
// Casts
359
- inline const WorkerThread* as_Worker_thread () const ;
360
359
inline JavaThread* as_Java_thread ();
361
360
inline const JavaThread* as_Java_thread () const ;
362
361
Original file line number Diff line number Diff line change @@ -66,11 +66,6 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* new_list) {
66
66
Atomic::release_store_fence (&_threads_hazard_ptr, new_list);
67
67
}
68
68
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
-
74
69
#if defined(__APPLE__) && defined(AARCH64)
75
70
inline void Thread::init_wx () {
76
71
assert (this == Thread::current (), " should only be called for current thread" );
You can’t perform that action at this time.
0 commit comments