tested and seems to be working

This commit is contained in:
Yehowshua Immanuel 2025-03-23 18:45:32 -04:00
parent 35fc49382d
commit 76e542ff36
3 changed files with 37 additions and 12 deletions

View file

@ -1,5 +1,6 @@
package TagEngine(
TagEngine(..),
Util.BasicResult(..),
mkTagEngine) where
import Vector
@ -9,7 +10,7 @@ import Util
interface (TagEngine :: # -> *) numTags =
requestTag :: ActionValue UIntLog2N(numTags)
retireTag :: UIntLog2N(numTags) -> Action
retireTag :: UIntLog2N(numTags) -> ActionValue BasicResult
-- The tag engine returns a tag that is unique for the duration of
-- the lifetime of the tag. Useful when you need to tag transactions
@ -56,7 +57,11 @@ mkTagEngine =
when
Just sampledStackPtr <- stackPtr
retireTag :: UIntLog2N(numTags) -> Action
-- retireTag isn't guarded so its up to external module to only attempt to
-- retire valid tags... At any rate, we can notify the requestor of failures
-- to retire tags - although the requestor can merely ignore this
-- notification.
retireTag :: UIntLog2N(numTags) -> ActionValue BasicResult
retireTag tag =
do
let
@ -71,4 +76,6 @@ mkTagEngine =
(select inUseVec tag) := False
(select freeStackVec nextStackPtrUint) := tag
stackPtr := Just nextStackPtrUint
else action {}
return Success
else do
return Failure