summaryrefslogtreecommitdiff
path: root/src/lisp/ao_lisp_mem.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-15 20:18:59 -0800
committerKeith Packard <keithp@keithp.com>2016-11-17 22:18:39 -0800
commitddb16207e736647ee5b1f023c1b8810effa18234 (patch)
treeaddbe49cb4dc694fe55207a732bb0e0fcfd8d59b /src/lisp/ao_lisp_mem.c
parent8e4d467b21b0df987234cd7fd09d763021c6e288 (diff)
altos/lisp: re-use small frames
This saves a pile more use of the allocator by noting when frames have not been referenced from another frame and freeing them when they go out of scope. Frames with references are left to the allocator to deal with. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_mem.c')
-rw-r--r--src/lisp/ao_lisp_mem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lisp/ao_lisp_mem.c b/src/lisp/ao_lisp_mem.c
index e7ece960..7e7464c4 100644
--- a/src/lisp/ao_lisp_mem.c
+++ b/src/lisp/ao_lisp_mem.c
@@ -214,8 +214,16 @@ static const struct ao_lisp_root ao_lisp_root[] = {
static const void ** const ao_lisp_cache[] = {
(const void **) &ao_lisp_cons_free_list,
(const void **) &ao_lisp_stack_free_list,
+ (const void **) &ao_lisp_frame_free_list[0],
+ (const void **) &ao_lisp_frame_free_list[1],
+ (const void **) &ao_lisp_frame_free_list[2],
+ (const void **) &ao_lisp_frame_free_list[3],
};
+#if AO_LISP_FRAME_FREE != 4
+#error Unexpected AO_LISP_FRAME_FREE value
+#endif
+
#define AO_LISP_CACHE (sizeof (ao_lisp_cache) / sizeof (ao_lisp_cache[0]))
#define AO_LISP_BUSY_SIZE ((AO_LISP_POOL + 31) / 32)