From b8ed7225c0c4ecf76741783b94ad8d38d5297ac3 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 27 Jul 2017 18:59:46 -0400 Subject: [PATCH] Issue #142 - Statically allocate closure0 Statically allocate closure0 objects since they are immutable and contain no free variables, so all copies of them would be identical. --- include/cyclone/types.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/cyclone/types.h b/include/cyclone/types.h index ccdbfcf2..e7f31e79 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -1002,13 +1002,8 @@ typedef closure0_type *macro; c.fn = f; \ c.num_args = -1; -#define mclosure0(c,f) \ - closure0_type c; \ - c.hdr.mark = gc_color_red; \ - c.hdr.grayed = 0; \ - c.tag = closure0_tag; \ - c.fn = f; \ - c.num_args = -1; +#define mclosure0(c, f) \ + static closure0_type c = { .hdr.mark = gc_color_red, .hdr.grayed = 0, .tag = closure0_tag, .fn = f, .num_args = -1 }; /* TODO: need a new macro that initializes num_args */ #define mclosure1(c,f,a) \ closure1_type c; \