-
Notifications
You must be signed in to change notification settings - Fork 81
Description
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->keep asis_pin_bit_setis_pinned, or removepin_object->set_pin_bitset_pinnedunpin_object->clear_pin_bitunset_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.