{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module PlutusCore.Evaluation.Machine.MachineParameters
where
import PlutusCore.Builtin
import Control.DeepSeq
import Control.Lens
import GHC.Exts (inline)
import GHC.Generics
import NoThunks.Class
data CostModel machinecosts builtincosts =
CostModel {
forall machinecosts builtincosts.
CostModel machinecosts builtincosts -> machinecosts
_machineCostModel :: machinecosts
, forall machinecosts builtincosts.
CostModel machinecosts builtincosts -> builtincosts
_builtinCostModel :: builtincosts
} deriving stock (CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
(CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool)
-> (CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool)
-> Eq (CostModel machinecosts builtincosts)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall machinecosts builtincosts.
(Eq machinecosts, Eq builtincosts) =>
CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
$c== :: forall machinecosts builtincosts.
(Eq machinecosts, Eq builtincosts) =>
CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
== :: CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
$c/= :: forall machinecosts builtincosts.
(Eq machinecosts, Eq builtincosts) =>
CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
/= :: CostModel machinecosts builtincosts
-> CostModel machinecosts builtincosts -> Bool
Eq, Int -> CostModel machinecosts builtincosts -> ShowS
[CostModel machinecosts builtincosts] -> ShowS
CostModel machinecosts builtincosts -> String
(Int -> CostModel machinecosts builtincosts -> ShowS)
-> (CostModel machinecosts builtincosts -> String)
-> ([CostModel machinecosts builtincosts] -> ShowS)
-> Show (CostModel machinecosts builtincosts)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
Int -> CostModel machinecosts builtincosts -> ShowS
forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
[CostModel machinecosts builtincosts] -> ShowS
forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
CostModel machinecosts builtincosts -> String
$cshowsPrec :: forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
Int -> CostModel machinecosts builtincosts -> ShowS
showsPrec :: Int -> CostModel machinecosts builtincosts -> ShowS
$cshow :: forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
CostModel machinecosts builtincosts -> String
show :: CostModel machinecosts builtincosts -> String
$cshowList :: forall machinecosts builtincosts.
(Show machinecosts, Show builtincosts) =>
[CostModel machinecosts builtincosts] -> ShowS
showList :: [CostModel machinecosts builtincosts] -> ShowS
Show)
makeLenses ''CostModel
data MachineParameters machinecosts fun val =
MachineParameters {
forall machinecosts fun val.
MachineParameters machinecosts fun val -> machinecosts
machineCosts :: machinecosts
, forall machinecosts fun val.
MachineParameters machinecosts fun val -> BuiltinsRuntime fun val
builtinsRuntime :: BuiltinsRuntime fun val
}
deriving stock (forall x.
MachineParameters machinecosts fun val
-> Rep (MachineParameters machinecosts fun val) x)
-> (forall x.
Rep (MachineParameters machinecosts fun val) x
-> MachineParameters machinecosts fun val)
-> Generic (MachineParameters machinecosts fun val)
forall x.
Rep (MachineParameters machinecosts fun val) x
-> MachineParameters machinecosts fun val
forall x.
MachineParameters machinecosts fun val
-> Rep (MachineParameters machinecosts fun val) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall machinecosts fun val x.
Rep (MachineParameters machinecosts fun val) x
-> MachineParameters machinecosts fun val
forall machinecosts fun val x.
MachineParameters machinecosts fun val
-> Rep (MachineParameters machinecosts fun val) x
$cfrom :: forall machinecosts fun val x.
MachineParameters machinecosts fun val
-> Rep (MachineParameters machinecosts fun val) x
from :: forall x.
MachineParameters machinecosts fun val
-> Rep (MachineParameters machinecosts fun val) x
$cto :: forall machinecosts fun val x.
Rep (MachineParameters machinecosts fun val) x
-> MachineParameters machinecosts fun val
to :: forall x.
Rep (MachineParameters machinecosts fun val) x
-> MachineParameters machinecosts fun val
Generic
deriving anyclass (MachineParameters machinecosts fun val -> ()
(MachineParameters machinecosts fun val -> ())
-> NFData (MachineParameters machinecosts fun val)
forall a. (a -> ()) -> NFData a
forall machinecosts fun val.
(NFData machinecosts, Bounded fun, Enum fun) =>
MachineParameters machinecosts fun val -> ()
$crnf :: forall machinecosts fun val.
(NFData machinecosts, Bounded fun, Enum fun) =>
MachineParameters machinecosts fun val -> ()
rnf :: MachineParameters machinecosts fun val -> ()
NFData)
instance (NoThunks machinecosts, Bounded fun, Enum fun) => NoThunks (MachineParameters machinecosts fun val) where
wNoThunks :: Context
-> MachineParameters machinecosts fun val -> IO (Maybe ThunkInfo)
wNoThunks Context
ctx (MachineParameters machinecosts
costs BuiltinsRuntime fun val
runtime) = [IO (Maybe ThunkInfo)] -> IO (Maybe ThunkInfo)
allNoThunks [ Context -> machinecosts -> IO (Maybe ThunkInfo)
forall a. NoThunks a => Context -> a -> IO (Maybe ThunkInfo)
noThunks Context
ctx machinecosts
costs, Context -> BuiltinsRuntime fun val -> IO (Maybe ThunkInfo)
forall a. NoThunks a => Context -> a -> IO (Maybe ThunkInfo)
noThunks Context
ctx BuiltinsRuntime fun val
runtime ]
mkMachineParameters ::
(
CostingPart uni fun ~ builtincosts
, HasMeaningIn uni val
, ToBuiltinMeaning uni fun
)
=> BuiltinSemanticsVariant fun
-> CostModel machinecosts builtincosts
-> MachineParameters machinecosts fun val
mkMachineParameters :: forall (uni :: * -> *) fun builtincosts val machinecosts.
(CostingPart uni fun ~ builtincosts, HasMeaningIn uni val,
ToBuiltinMeaning uni fun) =>
BuiltinSemanticsVariant fun
-> CostModel machinecosts builtincosts
-> MachineParameters machinecosts fun val
mkMachineParameters BuiltinSemanticsVariant fun
semvar (CostModel machinecosts
mchnCosts builtincosts
builtinCosts) =
machinecosts
-> BuiltinsRuntime fun val
-> MachineParameters machinecosts fun val
forall machinecosts fun val.
machinecosts
-> BuiltinsRuntime fun val
-> MachineParameters machinecosts fun val
MachineParameters machinecosts
mchnCosts ((BuiltinSemanticsVariant fun
-> builtincosts -> BuiltinsRuntime fun val)
-> BuiltinSemanticsVariant fun
-> builtincosts
-> BuiltinsRuntime fun val
forall a. a -> a
inline BuiltinSemanticsVariant fun
-> builtincosts -> BuiltinsRuntime fun val
forall cost (uni :: * -> *) fun val.
(cost ~ CostingPart uni fun, ToBuiltinMeaning uni fun,
HasMeaningIn uni val) =>
BuiltinSemanticsVariant fun -> cost -> BuiltinsRuntime fun val
toBuiltinsRuntime BuiltinSemanticsVariant fun
semvar builtincosts
builtinCosts)
{-# INLINE mkMachineParameters #-}