RFR: 8273597: Rectify Thread::is_ConcurrentGC_thread() [v2]

Per Liden pliden at openjdk.java.net
Mon Sep 13 12:13:51 UTC 2021


On Fri, 10 Sep 2021 14:34:05 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Per Liden has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix constructor call
>>  - Add ConcurrentGCThread::cast()
>
> src/hotspot/share/gc/z/zCollectedHeap.cpp line 84:
> 
>> 82:   virtual void do_thread(Thread* thread) {
>> 83:     if (thread->is_ConcurrentGC_thread()) {
>> 84:       static_cast<ConcurrentGCThread*>(thread)->stop();
> 
> Should you have a cast function like JavaThread does  ?
>   static JavaThread* cast(Thread* t) {
>     assert(t->is_Java_thread(), "incorrect cast to JavaThread");
>     return static_cast<JavaThread*>(t);
>   }
> 
> At one point @dholmes replaced all the thread->as_Java_thread() with JavaThread::cast() so this would be consistent with that and nice.

Sounds like a good idea. Added `ConcurrentGCThread::cast()`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5463


More information about the shenandoah-dev mailing list