RFR: 8299274: Add elements to resolved_references consistently

Frederic Parain fparain at openjdk.org
Wed Jan 4 14:47:55 UTC 2023


On Wed, 4 Jan 2023 14:38:05 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

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

Shouldn't this method check the validity of the index argument?

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

PR: https://git.openjdk.org/jdk/pull/11834


More information about the hotspot-dev mailing list