RFR: Reimplement TsanOopMap support using WeakHandle and ResizeableResourceHashtable [v6]

Jiangli Zhou jiangli at openjdk.org
Sat Jul 27 00:49:39 UTC 2024


On Fri, 26 Jul 2024 23:31:45 GMT, Man Cao <manc at openjdk.org> wrote:

>> I just reread your earlier suggestion more closely. 
>> 
>>> is it better to do oopDesc* obj = _wh.peek()?
>> 
>> WeakHandle only defines `peek()` with `oop` as return type (see `inline oop peek() const;`). With `CHECK_UNHANDLED_OOPS`, the implicit cast from `oop` to `oopDesc*` is handled by the `oopDesc* ()` operator. I think we should keep `oop obj = _wh.peek();` for consistency with the return type declared in `peek`. 
>> 
>> For the issue with `obj != _obj`, changing `obj != cast_to_oop(_obj)` resolves it.
>
> Yes, I'm aware `oopDesc* obj = _wh.peek()` will do the cast with the `oopDesc* ()` operator under `CHECK_UNHANDLED_OOPS`.
> 
> The point is to avoid unnecessary type casting and conversion if possible.  `oopDesc* obj = _wh.peek()` will just do the cast once, and avoid later casting with `obj != _obj` and `_obj = obj`.
> 
> Alternative is to declare `TsanOopMapTableKey::_obj` as an `oop`, which is probably cleaner.

> For the issue with obj != _obj, changing obj != cast_to_oop(_obj) resolves it.

`cast_to_oop(_obj)` is not needed. This is addressed by changing `_obj` to `oop`.

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

PR Review Comment: https://git.openjdk.org/tsan/pull/19#discussion_r1693711455


More information about the tsan-dev mailing list