1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/runtime/positive/test009.c
Łukasz Czajka 3aaa8229cc
Merge stack and temporary variable groups in JuvixReg (#2579)
After this change there are only two types of variables in JuvixReg:
arguments and local variables. The previous distinction between stack
and temporary variables was spurious and complicated things
unnecessarily.
2024-01-17 19:11:40 +01:00

38 lines
773 B
C

/* Direct call */
#include <juvix/api.h>
#define JUVIX_DECL_ARGS \
DECL_ARG(0); \
DECL_ARG(1); \
DECL_ARG(2)
int main() {
JUVIX_DECL_ARGS;
JUVIX_PROLOGUE(3);
CALL(0, juvix_function_main, juvix_label_0);
goto juvix_program_end;
JUVIX_FUNCTION_NS(juvix_function_calculate);
{
DECL_TMP(0);
JUVIX_INT_MUL(TMP(0), ARG(2), ARG(1));
JUVIX_INT_ADD(TMP(0), TMP(0), ARG(0));
juvix_result = TMP(0);
RETURN_NS;
}
JUVIX_FUNCTION(juvix_function_main, 1);
{
ARG(2) = make_smallint(2);
ARG(1) = make_smallint(3);
ARG(0) = make_smallint(5);
CALL(1, juvix_function_calculate, juvix_label_1);
RETURN;
}
JUVIX_EPILOGUE;
return 0;
}