#[percore]
static VALUE: ExceptionLock<RefCell<T>> = ExceptionLock::new(RefCell::new(initial_value));
This creates one initialised value on the primary core, and then copies it byte-by-byte (ldp/stp) to each secondary core's percore area. However, there is no guarantee that it is sound to duplicate T.
E.g. if T = &'static mut u64, all cores will have their own RefCell instance, so all cores can successfully borrow it at the same time, and will have mutable access to the same memory location.
Note: Codex gave me the hint for this, while I was reviewing the integration of the new percore-derive feature in RF-A
This creates one initialised value on the primary core, and then copies it byte-by-byte (
ldp/stp) to each secondary core's percore area. However, there is no guarantee that it is sound to duplicateT.E.g. if
T = &'static mut u64, all cores will have their ownRefCellinstance, so all cores can successfully borrow it at the same time, and will have mutable access to the same memory location.Note: Codex gave me the hint for this, while I was reviewing the integration of the new percore-derive feature in RF-A