On Thu, 15 Jul 2021 23:43:38 GMT, Vladimir Kozlov <k...@openjdk.org> wrote:

>> Sorry, I sent the wrong godbolt link: https://godbolt.org/z/1665fWzff
>
> @JornVernee I have small correct to your comment. We use simple inheritance 
> for Thread subclasses. Their instances have **one** vtbl pointer at the same 
> offset as in base class. But this pointer will point to separate vtable for 
> each subclass (and base class). The layout (sequence) of methods pointers in 
> vtable is the same in base class and subclasses. But subclass specific 
> methods pointers will be different.
> 
> The only issue is that you have to make sure to cast passed object pointer to 
> correct subclass (or base class). Otherwise you will get incorrect vtable and 
> incorrect virtual methods pointers.
> 
> R15 is used by our JIT compiled code and Interpreter code which are executed 
> only in JavaThread so the pinter it contains is JavaThread*

Thanks Vladimir. This also matches what I was seeing in compiler explorer, but 
I wasn't sure if we could assume it always worked like that with every C++ 
compiler.

It sound like R15 is expected to hold a `JavaThread*` though, so making the 
return type of `on_entry` be `JavaThread*` as David suggested seems correct.

Thanks

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

PR: https://git.openjdk.java.net/jdk17/pull/149

Reply via email to