On Thu, 30 May 2024 06:51:54 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> Hopefully the ports will catch up someday and the alternative implementation >> can be removed. >> >> We decided not to rename java.lang.VirtualThread when introducing the >> alternative implementation as it's just too disruptive. The super class that >> both implementations extend is BaseVirtualThread so testing for an instance >> of that is correct for the two implementations. >> >> If it helps the readability then introducing a function to test if a thread >> is a virtual thread might help. It could use VMContinuations if needed but >> right now, testing for an instanceof BaseVirtualThread is okay. > > Okay. I still think that should be hidden behind the > `java_lang_VirtualThread::is_instance` as it is an implementation detail the > JVMTI and thread code shouldn't need to know about IMO. Once the alternative > implementation is removed I expect these explicit checks for > `BaseVirtualThread` will need to be reverted and we could avoid that if we > make a change now. java_lang_VirtualThread::is_instance returning true when the top is not an instance of that class would be a bit strange. java_lang_Thread::is_virtual_thread_instance might be less surprising. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19405#discussion_r1620105401