On Fri, 6 Jan 2023 14:13:05 GMT, Coleen Phillimore <[email protected]> wrote:
>> The issue is not the underlying RHT methods but the semantics of the
>> `jvmtiTagMap` methods. If a call to add always expects to add then it should
>> be a fatal error if it actually did an update as that indicates something is
>> broken. Similarly if an update actually does an add.
>
> The JvmtiTagMap code adds/updates and removes the entries like below in two
> places which could probably be simplified, but I think that's outside the
> scope of this RFE. I suggest removing the bool return from add, remove and
> update, and add the assert(true) in the remove case. There's already an
> assert that add/update happened in the other cases.
>
> ``` // if the object is not already tagged then we tag it
> if (found_tag == 0) {
> if (tag != 0) {
> hashmap->add(o, tag);
> } else {
> // no-op
> }
> } else {
> // if the object is already tagged then we either update
> // the tag (if a new tag value has been provided)
> // or remove the object if the new tag value is 0.
> if (tag == 0) {
> hashmap->remove(o);
> } else {
> hashmap->update(o, tag);
> }
> }
The methods of HashmapTable are void and have assert to verify the expected
function (add/update/remove) is done.
-------------
PR: https://git.openjdk.org/jdk/pull/11288