RFR: 8262910: Cleanup THREAD/TRAPS/naming and typing issues in ObjectMonitor and related code [v3]

David Holmes david.holmes at oracle.com
Fri Mar 5 04:03:58 UTC 2021


On 5/03/2021 8:54 am, Ioi Lam wrote:
> On Thu, 4 Mar 2021 22:25:39 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> 
>>> A suggestion (perhaps as a future RFE), if a function never throws:
>>>
>>> void foo(Class* c, Method*m, Thread* current);
>>>
>>> maybe we should move the last `thread` argument to first:
>>>
>>> void foo(Thread* current, Class* c, Method*m);
>>>
>>> This will make it absolutely sure that `foo` will never throw an exception -- when you are reading a caller of `foo`, you don't need to refer to the declaration of `foo` to know that.
>>>
>>> Also, this will be consistent with our usual convention of passing "bigger" arguments first (Process > Thread -> Class -> method -> bci, etc).
>>
>> I agree, but I've been and think we should change these as we modified the code, and not wholesale.
> 
> Then maybe we should do the reordering in this PR, since we are changing the parameters anyway.

I don't agree with this general "rule". Most of the time the Thread* is 
not truly a part of the API, just "tramp data" that needs to get passed 
through so that we minimise the need to manifest Thread::current. So to 
me it is appropriate that this goes at the end.

Cheers,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/2802
> 


More information about the hotspot-runtime-dev mailing list