From bc38cf006136bf7d06c8b55a713061b06a11608f Mon Sep 17 00:00:00 2001 From: effectfully Date: Fri, 27 Sep 2024 04:25:00 +0200 Subject: [PATCH 1/2] [Builtins] Make all builtins strict --- plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs index 3c49589c171..43e8780ff3b 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs @@ -302,7 +302,7 @@ instance -- exception at any stage, that would be a bug regardless. toMonoF @val @args @res $! do (f, exF) <- getBoth - x <- readKnown arg + !x <- readKnown arg -- See Note [Strict application in runtime denotations]. let !exY = exF x pure (f x, exY) From 60fec252fbe401729701e65b7c1fabaef561d6e6 Mon Sep 17 00:00:00 2001 From: effectfully Date: Mon, 18 Nov 2024 19:06:48 +0100 Subject: [PATCH 2/2] Add a comment --- plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs index 43e8780ff3b..d5a043a7cde 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/Meaning.hs @@ -302,6 +302,10 @@ instance -- exception at any stage, that would be a bug regardless. toMonoF @val @args @res $! do (f, exF) <- getBoth + -- Force the argument that gets passed to the denotation. This seems to help performance + -- a bit (possibly due to its impact on strictness analysis), plus this way we ensure + -- that if computing the argument throws an exception (isn't supposed to happen), we'll + -- catch it in tests. !x <- readKnown arg -- See Note [Strict application in runtime denotations]. let !exY = exF x