From 6a9f1c3d9312d54d3d605566de804c4873197d1a Mon Sep 17 00:00:00 2001 From: Paul Cadman Date: Thu, 17 Oct 2024 10:26:53 +0100 Subject: [PATCH] Update AnomaCallablePathId to match Anoma calling convention (#3107) The `StandardLibrary` constructor of `AnomaCallablePathId` must be last. This is because Anoma will replace the tail of the main function with the resource machine standard library when it calls it. See: * https://github.com/anoma/juvix/issues/3106 for more details. --- src/Juvix/Compiler/Nockma/Translation/FromTree.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Juvix/Compiler/Nockma/Translation/FromTree.hs b/src/Juvix/Compiler/Nockma/Translation/FromTree.hs index 2fea37e6a5..3deb328d49 100644 --- a/src/Juvix/Compiler/Nockma/Translation/FromTree.hs +++ b/src/Juvix/Compiler/Nockma/Translation/FromTree.hs @@ -152,19 +152,23 @@ data CompilerFunction = CompilerFunction _compilerFunction :: Sem '[Reader CompilerCtx, Reader FunctionCtx] (Term Natural) } --- | The Code and Args constructors must be first and second respectively. This is --- because the stack must have the structure of a Nock function, --- i.e [code args env] +-- | The FunCode and ArgsTuple constructors must be first and second +-- respectively. This is because the stack must have the structure of a Nock +-- function, i.e [code args env] +-- +-- The StandardLibrary constructor must be last. Anoma will replace the tail of +-- the main function with the Anoma Resource Machine standard library when it +-- calls it. data AnomaCallablePathId = FunCode | ArgsTuple | --- FunctionsLibrary - | StandardLibrary | ClosureTotalArgsNum | ClosureArgsNum | ClosureArgs | AnomaGetOrder + | StandardLibrary deriving stock (Enum, Bounded, Eq, Show) indexStack :: Natural -> Path