RFR: 8351651: Cleanup LockStack::is_owning_thread [v3]
Stefan Karlsson
stefank at openjdk.org
Tue Mar 11 13:34:11 UTC 2025
On Tue, 11 Mar 2025 13:06:37 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/runtime/lockStack.hpp line 70:
>>
>>> 68:
>>> 69: // Tests if the calling thread is the thread that owns this lock-stack.
>>> 70: bool is_owning_thread(JavaThread* current) const PRODUCT_RETURN;
>>
>> This will not work in product builds.
>>
>> Even if this is fixed, I think it is somewhat dangerous to leave this function available in product builds if it gives the wrong answer.
>>
>> I'm voting for keeping this in as a product function. Or, alternatively, compile out the entire declaration in product builds. Thought, I do prefer the former since there's no obvious (to me) need to compile this out.
>
> The reason I was here was that I was trying to find wasted code in product mode, then I realized it's not used anywhere in product mode. So I'd rather it not exist in product mode. I'll compile it out of PRODUCT, that's a better thing to do.
Won't the linker simply remove this? Keep it if you want, but to me these PRODUCT_ONLY / PRODUCT_RETURN / ASSERT just adds noise without giving us anything substantial.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23981#discussion_r1989283783
More information about the hotspot-runtime-dev
mailing list