Skip to content

Rename is_pinned, pin_object and unpin_object #917

@wks

Description

@wks

In the memory_manager module, there are functions is_pinned, pin_object and unpin_object. Those functions operate on the pin bit metadata.

One problem with those functions is that those function names give the user an impression that it is "the right way" or "the only way" to pin object. However, with the PR #897, it will no longer be true. The preferred way to pin an object and also keep the object alive is adding those objects into the non-transitively pining root set (previously known as "black" roots). The pinning bits are still useful for pinning objects while not keeping them alive.

We should rename those functions so that it is clear that those functions operate on the "pin bits" metadata.

  • is_pinned -> is_pin_bit_set keep as is_pinned, or remove
  • pin_object -> set_pin_bit set_pinned
  • unpin_object -> clear_pin_bit unset_pinned

Since it is an API-breaking change, we can move those functions to the util::metadata::pin_bit module and make those functions public in order to make the API idiomatic to Rust (#658).

Update: Instead of mentioning "pin bit" in the API, we can tell the user that each object has a "pinned" state which can be set and unset. The state may be implemented as the pin bit (ObjectModel::LOCAL_PINNING_BIT_SPEC), but it is a local metadata, and spaces don't necessarily use it.

Update: We may consider removing the is_pinned function. See comments below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-normalPriority: Normal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions