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

Method read_op

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

Atomically read the opcode at `index` with Acquire ordering. Pairs with `replace_op` (Release) to ensure cache data visibility.

(&self, index: usize)

Source from the content-addressed store, hash-verified

682 /// Atomically read the opcode at `index` with Acquire ordering.
683 /// Pairs with `replace_op` (Release) to ensure cache data visibility.
684 pub fn read_op(&self, index: usize) -> Instruction {
685 let units = unsafe { &*self.units.get() };
686 let ptr = units.as_ptr().wrapping_add(index) as *const AtomicU8;
687 let byte = unsafe { &*ptr }.load(Ordering::Acquire);
688 // SAFETY: Only valid Instruction values are stored via replace_op/compare_exchange_op.
689 unsafe { mem::transmute::<u8, Instruction>(byte) }
690 }
691
692 /// Atomically read the arg byte at `index` with Relaxed ordering.
693 pub fn read_arg(&self, index: usize) -> OpArgByte {

Callers 4

runMethod · 0.80
specialize_callMethod · 0.80
original_bytesMethod · 0.80
quickenMethod · 0.80

Calls 3

getMethod · 0.45
as_ptrMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected