| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PlutusCore.Evaluation.Machine.ExMemoryUsage
Synopsis
- data CostRose = CostRose !CostingInteger ![CostRose]
- singletonRose :: CostingInteger -> CostRose
- class ExMemoryUsage a where
- memoryUsage :: a -> CostRose
- flattenCostRose :: CostRose -> CostStream
- newtype NumBytesCostedAsNumWords = NumBytesCostedAsNumWords {}
- newtype IntegerCostedLiterally = IntegerCostedLiterally {}
- newtype ValueTotalSize = ValueTotalSize {}
- newtype ValueMaxDepth = ValueMaxDepth {}
- newtype DataNodeCount = DataNodeCount Data
Documentation
A lazy tree of costs. Convenient for calculating the costs of values of built-in types, because
they may have arbitrary branching (in particular a Data object can contain a list of Data
objects inside of it).
CostRose gets collapsed to a lazy linear structure down the pipeline, so that we can
stream the costs to the outside where, say, the CEK machine picks them up one by one and handles
somehow (in particular, subtracts from the remaining budget).
Constructors
| CostRose !CostingInteger ![CostRose] |
singletonRose :: CostingInteger -> CostRose Source #
Create a CostRose containing a single cost.
class ExMemoryUsage a where Source #
Methods
memoryUsage :: a -> CostRose Source #
Instances
flattenCostRose :: CostRose -> CostStream Source #
newtype NumBytesCostedAsNumWords Source #
When invoking a built-in function, a value of type NumBytesCostedAsNumWords
can be used transparently as a built-in Integer but with a different size
measure: see Note [Integral types as Integer]. This is required by the
integerToByteString builtin, which takes an argument w specifying the
width (in bytes) of the output bytestring (zero-padded to the desired size).
The memory consumed by the function is given by w, *not* the size of w.
The NumBytesCostedAsNumWords type wraps an Int w in a newtype whose
ExMemoryUsage is equal to the number of eight-byte words required to
contain w bytes, allowing its costing function to work properly. We also
use this for replicateByte. If this is used to wrap an argument in the
denotation of a builtin then it *MUST* also be used to wrap the same argument
in the relevant budgeting benchmark.
Constructors
| NumBytesCostedAsNumWords | |
Fields | |
Instances
newtype IntegerCostedLiterally Source #
A wrapper for Integers whose "memory usage" for costing purposes is the
absolute value of the Integer. This is used for costing built-in functions
such as shiftByteString and rotateByteString, where the cost may depend
on the actual value of the shift argument, not its size. If this is used to
wrap an argument in the denotation of a builtin then it *MUST* also be used
to wrap the same argument in the relevant budgeting benchmark.
Constructors
| IntegerCostedLiterally | |
Fields | |
Instances
| ExMemoryUsage IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage Methods | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods makeKnown :: IntegerCostedLiterally -> BuiltinResult term Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM IntegerCostedLiterally Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| type IsBuiltin DefaultUni IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToBinds DefaultUni acc IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToHoles DefaultUni hole IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
newtype ValueTotalSize Source #
Constructors
| ValueTotalSize | |
Fields | |
Instances
| ExMemoryUsage ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage Methods memoryUsage :: ValueTotalSize -> CostRose Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods makeKnown :: ValueTotalSize -> BuiltinResult term Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM ValueTotalSize Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| type IsBuiltin DefaultUni ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToBinds DefaultUni acc ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToHoles DefaultUni hole ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
newtype ValueMaxDepth Source #
Constructors
| ValueMaxDepth | |
Fields | |
Instances
| ExMemoryUsage ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage Methods memoryUsage :: ValueMaxDepth -> CostRose Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods makeKnown :: ValueMaxDepth -> BuiltinResult term Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM ValueMaxDepth Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| type IsBuiltin DefaultUni ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToBinds DefaultUni acc ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToHoles DefaultUni hole ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
newtype DataNodeCount Source #
A wrapper for Data whose ExMemoryUsage counts nodes via lazy traversal.
Used by UnValueData builtin: measures INPUT Data node count. The actual memory
formula (slope × nodeCount + intercept) is applied in the JSON cost model.
Constructors
| DataNodeCount Data |
Instances
| ExMemoryUsage DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage Methods memoryUsage :: DataNodeCount -> CostRose Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods makeKnown :: DataNodeCount -> BuiltinResult term Source # | |||||||||||||
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM DataNodeCount Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| type IsBuiltin DefaultUni DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToBinds DefaultUni acc DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||
| type ToHoles DefaultUni hole DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe | |||||||||||||