primal-memory-0.3.0.0: Unified interface for memory managemenet.
Copyright(c) Alexey Kuleshevich 2020
LicenseBSD3
MaintainerAlexey Kuleshevich <alexey@kuleshevi.ch>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Prim.Memory.Addr

Description

 
Synopsis

Immutable Addr

data Addr e Source #

Immutable read-only address

Constructors

Addr 

Instances

Instances details
PtrAccess s (Addr e) Source #

Read-only access, but it is not enforced.

Instance details

Defined in Data.Prim.Memory.Addr

Methods

toForeignPtr :: MonadPrim s m => Addr e -> m (ForeignPtr a) Source #

withPtrAccess :: MonadPrim s m => Addr e -> (Ptr a -> m b) -> m b Source #

withNoHaltPtrAccess :: MonadUnliftPrim s m => Addr e -> (Ptr a -> m b) -> m b Source #

Prim e => IsList (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Associated Types

type Item (Addr e) #

Methods

fromList :: [Item (Addr e)] -> Addr e #

fromListN :: Int -> [Item (Addr e)] -> Addr e #

toList :: Addr e -> [Item (Addr e)] #

(Eq e, Prim e) => Eq (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

(==) :: Addr e -> Addr e -> Bool #

(/=) :: Addr e -> Addr e -> Bool #

(Prim e, Ord e) => Ord (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

compare :: Addr e -> Addr e -> Ordering #

(<) :: Addr e -> Addr e -> Bool #

(<=) :: Addr e -> Addr e -> Bool #

(>) :: Addr e -> Addr e -> Bool #

(>=) :: Addr e -> Addr e -> Bool #

max :: Addr e -> Addr e -> Addr e #

min :: Addr e -> Addr e -> Addr e #

(Show e, Prim e) => Show (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

showsPrec :: Int -> Addr e -> ShowS #

show :: Addr e -> String #

showList :: [Addr e] -> ShowS #

IsString (Addr Char) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

fromString :: String -> Addr Char #

Semigroup (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

(<>) :: Addr e -> Addr e -> Addr e #

sconcat :: NonEmpty (Addr e) -> Addr e #

stimes :: Integral b => b -> Addr e -> Addr e #

Monoid (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

mempty :: Addr e #

mappend :: Addr e -> Addr e -> Addr e #

mconcat :: [Addr e] -> Addr e #

NFData (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

rnf :: Addr e -> () #

MemRead (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

isSameMem :: Addr e -> Addr e -> Bool

byteCountMem :: Addr e -> Count Word8 Source #

indexOffMem :: Prim e0 => Addr e -> Off e0 -> e0 Source #

indexByteOffMem :: Prim e0 => Addr e -> Off Word8 -> e0 Source #

copyByteOffToMBytesMem :: forall s m e0 (p :: Pinned). (MonadPrim s m, Prim e0) => Addr e -> Off Word8 -> MBytes p s -> Off Word8 -> Count e0 -> m () Source #

copyByteOffToPtrMem :: (MonadPrim s m, Prim e0) => Addr e -> Off Word8 -> Ptr e0 -> Off Word8 -> Count e0 -> m () Source #

compareByteOffToPtrMem :: (MonadPrim s m, Prim e0) => Addr e -> Off Word8 -> Ptr e0 -> Off Word8 -> Count e0 -> m Ordering Source #

compareByteOffToBytesMem :: forall e0 (p :: Pinned). Prim e0 => Addr e -> Off Word8 -> Bytes p -> Off Word8 -> Count e0 -> Ordering Source #

compareByteOffMem :: (MemRead mr', Prim e0) => mr' -> Off Word8 -> Addr e -> Off Word8 -> Count e0 -> Ordering Source #

type Item (Addr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

type Item (Addr e) = e

curOffAddr :: Prim e => Addr e -> Off e Source #

countAddr :: forall e. Prim e => Addr e -> Count e Source #

plusOffAddr :: Prim e => Addr e -> Off e -> Addr e Source #

indexAddr :: Prim e => Addr e -> e Source #

indexOffAddr :: Prim e => Addr e -> Off e -> e Source #

readAddr :: (MonadPrim s m, Prim e) => Addr e -> m e Source #

readOffAddr :: (MonadPrim s m, Prim e) => Addr e -> Off e -> m e Source #

readByteOffAddr :: (MonadPrim s m, Prim e) => Addr e -> Off Word8 -> m e Source #

thawAddr :: MonadPrim s m => Addr e -> m (MAddr e s) Source #

freezeMAddr :: MonadPrim s m => MAddr e s -> m (Addr e) Source #

withPtrAddr :: MonadPrim s m => Addr e -> (Ptr e -> m b) -> m b Source #

withAddrAddr# :: MonadPrim s m => Addr e -> (Addr# -> m b) -> m b Source #

withNoHaltPtrAddr :: MonadUnliftPrim s m => Addr e -> (Ptr e -> m b) -> m b Source #

Mutable MAddr

data MAddr e s Source #

Mutable address

Constructors

MAddr 

Instances

Instances details
PtrAccess s (MAddr e s) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

toForeignPtr :: MonadPrim s m => MAddr e s -> m (ForeignPtr a) Source #

withPtrAccess :: MonadPrim s m => MAddr e s -> (Ptr a -> m b) -> m b Source #

withNoHaltPtrAccess :: MonadUnliftPrim s m => MAddr e s -> (Ptr a -> m b) -> m b Source #

MemAlloc (MAddr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Associated Types

type FrozenMem (MAddr e) = (fm :: Type) Source #

Methods

getByteCountMutMem :: MonadPrim s m => MAddr e s -> m (Count Word8) Source #

allocMutMem :: (Prim e0, MonadPrim s m) => Count e0 -> m (MAddr e s) Source #

thawMem :: MonadPrim s m => FrozenMem (MAddr e) -> m (MAddr e s) Source #

freezeMutMem :: MonadPrim s m => MAddr e s -> m (FrozenMem (MAddr e)) Source #

reallocMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Count e0 -> m (MAddr e s) Source #

MemWrite (MAddr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

isSameMutMem :: MAddr e s -> MAddr e s -> Bool

readOffMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off e0 -> m e0 Source #

readByteOffMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off Word8 -> m e0 Source #

writeOffMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off e0 -> e0 -> m () Source #

writeByteOffMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off Word8 -> e0 -> m () Source #

moveByteOffToMBytesMutMem :: forall s m e0 (p :: Pinned). (MonadPrim s m, Prim e0) => MAddr e s -> Off Word8 -> MBytes p s -> Off Word8 -> Count e0 -> m () Source #

moveByteOffToPtrMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off Word8 -> Ptr e0 -> Off Word8 -> Count e0 -> m () Source #

copyByteOffMem :: (MonadPrim s m, MemRead mr, Prim e0) => mr -> Off Word8 -> MAddr e s -> Off Word8 -> Count e0 -> m () Source #

moveByteOffMutMem :: (MonadPrim s m, MemWrite mw', Prim e0) => mw' s -> Off Word8 -> MAddr e s -> Off Word8 -> Count e0 -> m () Source #

setMutMem :: (MonadPrim s m, Prim e0) => MAddr e s -> Off e0 -> Count e0 -> e0 -> m () Source #

NFData (MAddr e s) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

Methods

rnf :: MAddr e s -> () #

type FrozenMem (MAddr e) Source # 
Instance details

Defined in Data.Prim.Memory.Addr

type FrozenMem (MAddr e) = Addr e

castMAddr :: MAddr e s -> MAddr b s Source #

newMAddr :: forall e m s. (MonadPrim s m, Prim e) => e -> m (MAddr e s) Source #

allocMAddr :: forall e m s. (MonadPrim s m, Prim e) => Count e -> m (MAddr e s) Source #

allocAlignedMAddr :: forall e m s. (MonadPrim s m, Prim e) => Count e -> m (MAddr e s) Source #

allocZeroMAddr :: forall e m s. (MonadPrim s m, Prim e) => Count e -> m (MAddr e s) Source #

allocZeroAlignedMAddr :: forall e m s. (MonadPrim s m, Prim e) => Count e -> m (MAddr e s) Source #

reallocMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Count e -> m (MAddr e s) Source #

shrinkMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Count e -> m () Source #

Shrink mutable address to new specified size in number of elements. The new count must be less than or equal to the current as reported by getCountMAddr.

shrinkByteCountMAddr :: MonadPrim s m => MAddr e s -> Count Word8 -> m () Source #

Shrink mutable address to new specified size in bytes. The new count must be less than or equal to the current as reported by getByteCountMAddr.

setMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> Count e -> e -> m () Source #

curOffMAddr :: forall e s. Prim e => MAddr e s -> Off e Source #

getCountMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> m (Count e) Source #

plusOffMAddr :: Prim e => MAddr e s -> Off e -> MAddr e s Source #

readMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> m e Source #

readOffMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> m e Source #

readByteOffMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off Word8 -> m e Source #

writeMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> e -> m () Source #

writeOffMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> e -> m () Source #

writeByteOffMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off Word8 -> e -> m () Source #

copyAddrToMAddr :: (MonadPrim s m, Prim e) => Addr e -> Off e -> MAddr e s -> Off e -> Count e -> m () Source #

moveMAddrToMAddr :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> MAddr e s -> Off e -> Count e -> m () Source #

modifyMAddr :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> (a, b)) -> m b Source #

Apply a pure function to the contents of a mutable variable. Returns the artifact of computation.

Since: 0.2.0

modifyMAddr_ :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> a) -> m () Source #

Apply a pure function to the contents of a mutable variable.

Since: 0.1.0

modifyFetchOldMAddr :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> a) -> m a Source #

Apply a pure function to the contents of a mutable variable. Returns the old value.

Since: 2.0.0

modifyFetchNewMAddr :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> a) -> m a Source #

Apply a pure function to the contents of a mutable variable. Returns the new value.

Since: 2.0.0

modifyMAddrM :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> m (a, b)) -> m b Source #

Apply a monadic action to the contents of a mutable variable. Returns the artifact of computation.

Since: 0.2.0

modifyMAddrM_ :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> m a) -> m () Source #

Apply a monadic action to the contents of a mutable variable.

Since: 0.1.0

modifyFetchOldMAddrM :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> m a) -> m a Source #

Apply a monadic action to the contents of a mutable variable. Returns the old value.

Since: 2.0.0

modifyFetchNewMAddrM :: (MonadPrim s m, Prim a) => MAddr a s -> (a -> m a) -> m a Source #

Apply a monadic action to the contents of a mutable variable. Returns the new value.

Since: 2.0.0

swapMAddrs_ :: (MonadPrim s m, Prim a) => MAddr a s -> MAddr a s -> m () Source #

Swap contents of two mutable variables.

Since: 0.1.0

swapMAddrs :: (MonadPrim s m, Prim a) => MAddr a s -> MAddr a s -> m (a, a) Source #

Swap contents of two mutable variables. Returns their old values.

Since: 0.1.0

withPtrMAddr :: MonadPrim s m => MAddr e s -> (Ptr e -> m b) -> m b Source #

withAddrMAddr# :: MonadPrim s m => MAddr e s -> (Addr# -> m b) -> m b Source #

withNoHaltPtrMAddr :: MonadUnliftPrim s m => MAddr e s -> (Ptr e -> m b) -> m b Source #

fromForeignPtrAddr :: ForeignPtr e -> Maybe (Addr e) Source #

This is a unsafe cast therefore modification of ForeignPtr will be reflected in resulting immutable Addr. Pointer created with malloc cannot be converted to Addr and will result in Nothing

Since: 0.1.0

fromForeignPtrMAddr :: ForeignPtr e -> Maybe (MAddr e s) Source #

Discarding the original ForeignPtr will trigger finalizers that were attached to it, because MAddr does not retain any finalizers. Pointer created with malloc cannot be converted to MAddr and will result in Nothing

Since: 0.1.0

Conversion

ByteString

toByteStringAddr :: Addr Word8 -> ByteString Source #

O(1) - Cast an immutable Addr to an immutable ByteString

Since: 0.1.0

toShortByteStringAddr :: Addr Word8 -> (ShortByteString, Off Word8) Source #

O(1) - Cast an immutable Addr to an immutable ShortByteString

Since: 0.1.0

fromShortByteStringAddr :: ShortByteString -> Addr Word8 Source #

O(n) - Convert an immutable ShortByteString to an immutable Addr. In a most common case when ShortByteString is not backed by pinned memory, this function will return Nothing.

Since: 0.1.0

fromByteStringAddr :: ByteString -> (Addr Word8, Count Word8) Source #

O(1) - Cast an immutable ByteString to Addr. Also returns the original length of ByteString, which will be less or equal to countOfAddr in the produced Addr.

Since: 0.1.0

fromByteStringMAddr :: ByteString -> (MAddr Word8 s, Count Word8) Source #

O(1) - Cast an immutable ByteString to a mutable MAddr. Also returns the original length of ByteString, which will be less or equal to getCountOfMAddr in the produced MAddr.

Unsafe - Further modification of MAddr will affect the source ByteString

Since: 0.1.0

Atomic

casOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> e

Expected old value

-> e

New value

-> m e 

Perform atomic modification of an element in the MAddr at the supplied index. Returns the artifact of computation b. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

casBoolOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> e

Expected old value

-> e

New value

-> m Bool 

Perform atomic modification of an element in the MAddr at the supplied index. Returns True if swap was successfull and false otherwise. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

casBoolFetchOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> e

Expected old value

-> e

New value

-> m (Bool, e) 

Just like casBoolOffMAddr, but also returns the actual value, which will match the supplied expected value if the returned flag is True

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicReadOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> m e 

Perform atomic read of an element in the MAddr at the supplied offset. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicWriteOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> e 
-> m () 

Perform atomic write of an element in the MAddr at the supplied offset. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicModifyOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> (e -> (e, b))

Function that is applied to the old value and returns new value and some artifact of computation b

-> m b 

Perform atomic modification of an element in the MAddr at the supplied index. Returns the artifact of computation b. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicModifyOffMAddr_ Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> (e -> e)

Function that is applied to the current value

-> m () 

Perform atomic modification of an element in the MAddr at the supplied index. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicModifyFetchOldOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes.

-> (e -> e)

Function that is applied to the old value

-> m e

Returns the old value

Perform atomic modification of an element in the MAddr at the supplied index. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicModifyFetchNewOffMAddr Source #

Arguments

:: (MonadPrim s m, Atomic e) 
=> MAddr e s

Array to be mutated

-> Off e

Index is in elements of e, rather than bytes

-> (e -> e)

Function that is applied to the old value

-> m e

Returns the new value

Perform atomic modification of an element in the MAddr at the supplied index. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

Numeric

atomicAddFetchOldOffMAddr :: (MonadPrim s m, AtomicCount e) => MAddr e s -> Off e -> e -> m e Source #

Add a numeric value to an element of a MAddr, corresponds to (+) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicAddFetchNewOffMAddr :: (MonadPrim s m, AtomicCount e) => MAddr e s -> Off e -> e -> m e Source #

Add a numeric value to an element of a MAddr, corresponds to (+) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicSubFetchOldOffMAddr :: (MonadPrim s m, AtomicCount e) => MAddr e s -> Off e -> e -> m e Source #

Subtract a numeric value from an element of a MAddr, corresponds to (-) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicSubFetchNewOffMAddr :: (MonadPrim s m, AtomicCount e) => MAddr e s -> Off e -> e -> m e Source #

Subtract a numeric value from an element of a MAddr, corresponds to (-) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

Binary

atomicAndFetchOldOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary conjunction (AND) of an element of a MAddr with the supplied value, corresponds to (.&.) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicAndFetchNewOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary conjunction (AND) of an element of a MAddr with the supplied value, corresponds to (.&.) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicNandFetchOldOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Negation of binary conjunction (NAND) of an element of a MAddr with the supplied value, corresponds to \x y -> complement (x .&. y) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicNandFetchNewOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Negation of binary conjunction (NAND) of an element of a MAddr with the supplied value, corresponds to \x y -> complement (x .&. y) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicOrFetchOldOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary disjunction (OR) of an element of a MAddr with the supplied value, corresponds to (.|.) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicOrFetchNewOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary disjunction (OR) of an element of a MAddr with the supplied value, corresponds to (.|.) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicXorFetchOldOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary exclusive disjunction (XOR) of an element of a MAddr with the supplied value, corresponds to xor done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicXorFetchNewOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> e -> m e Source #

Binary exclusive disjunction (XOR) of an element of a MAddr with the supplied value, corresponds to xor done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicNotFetchOldOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> m e Source #

Binary negation (NOT) of an element of a MAddr, corresponds to (complement) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

atomicNotFetchNewOffMAddr :: (MonadPrim s m, AtomicBits e) => MAddr e s -> Off e -> m e Source #

Binary negation (NOT) of an element of a MAddr, corresponds to (complement) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.

Note - Bounds are not checked, therefore this function is unsafe.

Since: 0.1.0

Prefetch

Directly

prefetchAddr0 :: MonadPrim s m => Addr e -> m () Source #

prefetchMAddr0 :: MonadPrim s m => MAddr e s -> m () Source #

prefetchAddr1 :: MonadPrim s m => Addr e -> m () Source #

prefetchMAddr1 :: MonadPrim s m => MAddr e s -> m () Source #

prefetchAddr2 :: MonadPrim s m => Addr e -> m () Source #

prefetchMAddr2 :: MonadPrim s m => MAddr e s -> m () Source #

prefetchAddr3 :: MonadPrim s m => Addr e -> m () Source #

prefetchMAddr3 :: MonadPrim s m => MAddr e s -> m () Source #

With offset

prefetchOffAddr0 :: (MonadPrim s m, Prim e) => Addr e -> Off e -> m () Source #

prefetchOffMAddr0 :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> m () Source #

prefetchOffAddr1 :: (MonadPrim s m, Prim e) => Addr e -> Off e -> m () Source #

prefetchOffMAddr1 :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> m () Source #

prefetchOffAddr2 :: (MonadPrim s m, Prim e) => Addr e -> Off e -> m () Source #

prefetchOffMAddr2 :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> m () Source #

prefetchOffAddr3 :: (MonadPrim s m, Prim e) => Addr e -> Off e -> m () Source #

prefetchOffMAddr3 :: (MonadPrim s m, Prim e) => MAddr e s -> Off e -> m () Source #

Re-export

module Data.Prim