RFR: 8210119: Rename SubTasksDone::is_task_claimed

Kim Barrett kim.barrett at oracle.com
Wed Aug 29 15:33:27 UTC 2018


> On Aug 29, 2018, at 7:01 AM, coleen.phillimore at oracle.com wrote:
> 
> 
> Am I reading this right:
> 
> -bool SequentialSubTasksDone::is_task_claimed(uint& t) {
> +bool SequentialSubTasksDone::try_claim_task(uint& t) {
>   t = _n_claimed;
>   while (t < _n_tasks) {
>     uint res = Atomic::cmpxchg(t+1, &_n_claimed, t);
>     if (res == t) {
> - return false;
> + return true;
>     }
>     t = res;
>   }
> - return true;
> + return false;
> }
> 
> 
> is_task_claimed returned false if the task was claimed?  Oh, yeah, that's what the comment in workgroup.hpp says. wow.
> 
> http://cr.openjdk.java.net/~kbarrett/8210119/open.00/src/hotspot/share/runtime/safepoint.cpp.udiff.html
> 
> Yes, please, this makes much more sense!

Yes, is_task_claimed returned true if it was already claimed, false if it was newly claimed by the call.
I think I’ve initially gotten it backward every time I’ve tried to use it.

> Looks good.  I tried to check all the reversals of sense and all there. Thanks,

Thanks for reviewing.

> Coleen
> 
> On 8/28/18 8:55 PM, Kim Barrett wrote:
>> [Sending to hotspot-dev because, though this is a GC utility, it's also
>> being used in runtime/safepoint.cpp.]
>> 
>> Please review this small API naming cleanup.
>> 
>> CR:
>> https://bugs.openjdk.java.net/browse/JDK-8210119
>> 
>> Webrev:
>> http://cr.openjdk.java.net/~kbarrett/8210119/open.00/
>> 
>> Testing:
>> mach5 tier1-3




More information about the hotspot-dev mailing list