pub fn charge_for(
state: PageState,
kind: PageKind,
is_write: bool,
) -> Result<(u64, PageState), HardFault>Expand description
The category-#3 charge and resulting state for one page touch.
Read-only page-in is free at the fault — the cost of bringing a
region into the working set is charged eagerly at the CALL that maps it
(crate::gas_const::call_frame_cost). Copy-on-write (the first write
to a writable page) is the only fault-driven #3 charge:
- first read (
NotPresent) →0, →PresentRo - first write (
NotPresent) →COW_COST, →PresentRw - write after read (
PresentRo) →COW_COST, →PresentRw - already present for this access kind →
0 - write to
PinnedCapRo→HardFault