MCPcopy Index your code
hub / github.com/RustPython/RustPython / write_cache_ptr

Method write_cache_ptr

crates/compiler-core/src/bytecode.rs:756–758  ·  view source on GitHub ↗

Store a pointer-sized value atomically in the pointer cache at `index`. Uses a single `AtomicUsize` store to prevent torn writes when multiple threads specialize the same instruction concurrently. # Safety - `index` must be in bounds. - `value` must be `0` or a valid `*const PyObject` encoded as `usize`. - Callers must follow the cache invalidation/upgrade protocol: invalidate the version guard

(&self, index: usize, value: usize)

Source from the content-addressed store, hash-verified

754 /// invalidate the version guard before writing and publish the new
755 /// version after writing.
756 pub unsafe fn write_cache_ptr(&self, index: usize, value: usize) {
757 self.pointer_cache[index].store(value, Ordering::Relaxed);
758 }
759
760 /// Load a pointer-sized value atomically from the pointer cache at `index`.
761 ///

Calls 1

storeMethod · 0.45

Tested by

no test coverage detected