mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
8252476: as_Worker_thread() doesn't check what it intends
Co-authored-by: David Holmes <dholmes@openjdk.org> Reviewed-by: iklam, kbarrett
This commit is contained in:
parent
37bc4e2e3c
commit
bfa46f0af3
4 changed files with 8 additions and 6 deletions
|
@ -40,6 +40,7 @@
|
|||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/nonJavaThread.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
|
||||
ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
|
||||
ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL;
|
||||
|
|
|
@ -106,11 +106,6 @@ class WorkerThread: public NamedThread {
|
|||
WorkerThread() : _id(0) { }
|
||||
virtual bool is_Worker_thread() const { return true; }
|
||||
|
||||
virtual WorkerThread* as_Worker_thread() const {
|
||||
assert(is_Worker_thread(), "Dubious cast to WorkerThread*?");
|
||||
return (WorkerThread*) this;
|
||||
}
|
||||
|
||||
void set_id(uint work_id) { _id = work_id; }
|
||||
uint id() const { return _id; }
|
||||
};
|
||||
|
|
|
@ -355,7 +355,7 @@ class Thread: public ThreadShadow {
|
|||
virtual bool is_active_Java_thread() const { return false; }
|
||||
|
||||
// Casts
|
||||
virtual WorkerThread* as_Worker_thread() const { return NULL; }
|
||||
inline const WorkerThread* as_Worker_thread() const;
|
||||
inline JavaThread* as_Java_thread();
|
||||
inline const JavaThread* as_Java_thread() const;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "runtime/orderAccess.hpp"
|
||||
#include "runtime/safepoint.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
#include "runtime/nonJavaThread.hpp"
|
||||
|
||||
#if defined(__APPLE__) && defined(AARCH64)
|
||||
#include "runtime/os.hpp"
|
||||
|
@ -64,6 +65,11 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* 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)
|
||||
inline void Thread::init_wx() {
|
||||
assert(this == Thread::current(), "should only be called for current thread");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue