tqchen opened a new pull request, #731:
URL: https://github.com/apache/tvm-ffi/pull/731

   ## Summary
   
   - Make `Object::unique()` require one strong reference and no external weak 
references by comparing the packed count with `kCombinedRefCountBothOne`.
   - Delegate `ObjectPtr<T>::unique()` to the object-level implementation while 
leaving strong-only `use_count()` semantics unchanged.
   - Add focused coverage for uniqueness while a `WeakObjectPtr` is live.
   
   ## Rationale
   
   `unique()` gates copy-on-write and in-place mutation. A live weak pointer 
can still upgrade while the object has a strong owner, so strong-only 
uniqueness is insufficient for safely choosing in-place mutation. Comparing the 
combined counter also observes both halves in one atomic load.
   
   ## Compatibility
   
   Out-of-tree users that retain weak references may now copy instead of 
mutating in place. Current production call sites without weak references retain 
their existing behavior.
   
   ## Validation
   
   - `clang-format --dry-run` on the touched files
   - Focused weak-pointer object tests
   - Complete C++ CTest suite


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to