mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8268164: Adopt cast notation for WorkerThread conversions
Reviewed-by: stefank, dholmes
This commit is contained in:
parent
9fc914b963
commit
58bdabcd40
4 changed files with 10 additions and 9 deletions
|
@ -40,7 +40,6 @@
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/nonJavaThread.hpp"
|
#include "runtime/nonJavaThread.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
|
||||||
|
|
||||||
ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
|
ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
|
||||||
ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL;
|
ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL;
|
||||||
|
@ -929,8 +928,7 @@ inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt)
|
||||||
if (_discovery_is_mt) {
|
if (_discovery_is_mt) {
|
||||||
// During a multi-threaded discovery phase,
|
// During a multi-threaded discovery phase,
|
||||||
// each thread saves to its "own" list.
|
// each thread saves to its "own" list.
|
||||||
Thread* thr = Thread::current();
|
id = WorkerThread::current()->id();
|
||||||
id = thr->as_Worker_thread()->id();
|
|
||||||
} else {
|
} else {
|
||||||
// single-threaded discovery, we save in round-robin
|
// single-threaded discovery, we save in round-robin
|
||||||
// fashion to each of the lists.
|
// fashion to each of the lists.
|
||||||
|
|
|
@ -103,6 +103,15 @@ class WorkerThread: public NamedThread {
|
||||||
private:
|
private:
|
||||||
uint _id;
|
uint _id;
|
||||||
public:
|
public:
|
||||||
|
static WorkerThread* current() {
|
||||||
|
return WorkerThread::cast(Thread::current());
|
||||||
|
}
|
||||||
|
|
||||||
|
static WorkerThread* cast(Thread* t) {
|
||||||
|
assert(t->is_Worker_thread(), "incorrect cast to WorkerThread");
|
||||||
|
return static_cast<WorkerThread*>(t);
|
||||||
|
}
|
||||||
|
|
||||||
WorkerThread() : _id(0) { }
|
WorkerThread() : _id(0) { }
|
||||||
virtual bool is_Worker_thread() const { return true; }
|
virtual bool is_Worker_thread() const { return true; }
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,6 @@ class Thread: public ThreadShadow {
|
||||||
virtual bool is_active_Java_thread() const { return false; }
|
virtual bool is_active_Java_thread() const { return false; }
|
||||||
|
|
||||||
// Casts
|
// Casts
|
||||||
inline const WorkerThread* as_Worker_thread() const;
|
|
||||||
inline JavaThread* as_Java_thread();
|
inline JavaThread* as_Java_thread();
|
||||||
inline const JavaThread* as_Java_thread() const;
|
inline const JavaThread* as_Java_thread() const;
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,6 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* new_list) {
|
||||||
Atomic::release_store_fence(&_threads_hazard_ptr, new_list);
|
Atomic::release_store_fence(&_threads_hazard_ptr, new_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const WorkerThread* Thread::as_Worker_thread() const {
|
|
||||||
assert(is_Worker_thread(), "incorrect cast to const WorkerThread");
|
|
||||||
return static_cast<const WorkerThread*>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(AARCH64)
|
#if defined(__APPLE__) && defined(AARCH64)
|
||||||
inline void Thread::init_wx() {
|
inline void Thread::init_wx() {
|
||||||
assert(this == Thread::current(), "should only be called for current thread");
|
assert(this == Thread::current(), "should only be called for current thread");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue