From 5c297ddf25fa496c324036284c716ff605f8a05d Mon Sep 17 00:00:00 2001 From: Paul Cadman Date: Thu, 17 Oct 2024 09:25:48 +0100 Subject: [PATCH] Update AnomaCallablePathId to match Anoma calling convention 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. --- 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