On Wed, 3 Mar 2021 16:24:52 GMT, Coleen Phillimore <[email protected]> wrote:

>> David Holmes has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   More pointer declaration style fixups
>
> src/hotspot/share/runtime/synchronizer.hpp line 92:
> 
>> 90:   // This is the "slow path" version of monitor enter and exit.
>> 91:   static void enter(Handle obj, BasicLock* lock, JavaThread* current);
>> 92:   static void exit(oop obj, BasicLock* lock, TRAPS);
> 
> So are you suggesting that we should have the convention that if a function 
> takes a Thread/JavaThread argument as the last argument, to use "current" 
> rather than "THREAD", since the latter implies it is supposed to be used to 
> pass an argument for the parameter to TRAPS?  I think this is good.  It 
> manages some confusion about trailing THREAD arguments in some callers.  
> Specializing further to JavaThread from Thread is also a good change.

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).

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

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

Reply via email to