RFR: 8299274: Add elements to resolved_references consistently
Coleen Phillimore
coleenp at openjdk.org
Wed Jan 4 14:41:56 UTC 2023
On Wed, 4 Jan 2023 12:24:49 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
>> src/hotspot/share/oops/constantPool.cpp line 181:
>>
>>> 179:
>>> 180: // Use a CAS for multithreaded access
>>> 181: oop ConstantPool::set_resolved_references_at(int index, oop new_result, oop old_result) {
>>
>> This function should be called `set_resolved_reference_at` - singular - as it sets one reference. Thanks.
>
> We never overwrite anything. I.e. we only store if the index is null.
> From what I have seen in the code, anything else would be a bug? (as in we never change an object in the array)
>
> So I think this method is a bit to generic:
> bool set_resolved_reference_at(int index, oop value)
> Where we return false if that index already contains an oop?
The reason I made it resolved_references plural is so you can grep on resolved_references and see all operations on this array.
We do not overwrite anything. We may have multiple threads writing the same string to it. There's an assert in string_at_put:
assert(result == nullptr || result == str, "Only set once or to the same string.");
I need it to return the existing value for the code in resolve_constant_at_impl().
-------------
PR: https://git.openjdk.org/jdk/pull/11834
More information about the hotspot-dev
mailing list