The strong-count decrement in `dec_ref` used `Relaxed`, so the Acquire fence 
before the deleter had no Release to pair with: writes made by another owner 
before it dropped its reference were not guaranteed to be visible to the thread 
running the destructor. This uses `Release`, matching C++ `Object::DecRef` and 
`std::sync::Arc`.

`strong_count` now loads with `Acquire`. A count of 1 gates in-place mutation 
(error context, backtrace append, `Array::push`, structural mutate), and the 
load must synchronize with the other owners' releasing decrements, as in 
`Arc::get_mut`.

You can view, comment on, or merge this pull request online at:

  https://github.com/apache/tvm-ffi/pull/943

-- Commit Summary --

  * [Rust][FIX] Release ordering on object dec-ref

-- File Changes --

    M rust/tvm-ffi/src/object.rs (7)

-- Patch Links --

https://github.com/apache/tvm-ffi/pull/943.patch
https://github.com/apache/tvm-ffi/pull/943.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm-ffi/pull/943
You are receiving this because you are subscribed to this thread.

Message ID: <apache/tvm-ffi/pull/[email protected]>

Reply via email to