RFR: 8299274: Add elements to resolved_references consistently
Robbin Ehn
rehn at openjdk.org
Wed Jan 4 12:28:00 UTC 2023
On Wed, 4 Jan 2023 01:39:19 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> I added a resolved_references_at and set_resolved_references_at() functions to use for accesses to the resolved_references array, except for the CDS usages. This has an assert that the element is an oop and oob checks and setting elements use a CAS consistently.
>> These asserts seem useful for finding the bug causing https://bugs.openjdk.org/browse/JDK-8296915.
>> Tested with tiers1-4.
>
> 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?
So I think this method is a bit to generic:
bool set_resolved_reference_at(int index, oop value)
Where we return false is that index already contains an oop?
-------------
PR: https://git.openjdk.org/jdk/pull/11834
More information about the hotspot-dev
mailing list