Replace the opcode at `index` in-place without changing the arg byte. Uses atomic Release store to ensure prior cache writes are visible to threads that subsequently read the new opcode with Acquire. # Safety - `index` must be in bounds. - `new_op` must have the same arg semantics as the original opcode.
(&self, index: usize, new_op: Instruction)
| 651 | /// - `index` must be in bounds. |
| 652 | /// - `new_op` must have the same arg semantics as the original opcode. |
| 653 | pub unsafe fn replace_op(&self, index: usize, new_op: Instruction) { |
| 654 | let units = unsafe { &*self.units.get() }; |
| 655 | let ptr = units.as_ptr().wrapping_add(index) as *const AtomicU8; |
| 656 | unsafe { &*ptr }.store(new_op.into(), Ordering::Release); |
| 657 | } |
| 658 | |
| 659 | /// Atomically replace opcode only if it still matches `expected`. |
| 660 | /// Returns true on success. Uses Release ordering on success. |
no test coverage detected