altos/lisp: Make ao_lisp_ref and ao_lisp_poly non-inline
authorKeith Packard <keithp@keithp.com>
Sat, 12 Nov 2016 05:07:09 +0000 (21:07 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 18 Nov 2016 06:18:39 +0000 (22:18 -0800)
These functions are pretty large and end up consuming quite a bit of
space if inlined everywhere they are used.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/lisp/ao_lisp.h
src/lisp/ao_lisp_poly.c

index 86a5ddcff018f4a2feb0e33c42a5f9de8d400432..7a165cd8b47ef1bcf94004eec2aeb0813426fb52 100644 (file)
@@ -99,26 +99,11 @@ ao_lisp_is_const(ao_poly poly) {
 #define AO_LISP_IS_CONST(a)    (ao_lisp_const <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_lisp_const + AO_LISP_POOL_CONST)
 #define AO_LISP_IS_POOL(a)     (ao_lisp_pool <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_lisp_pool + AO_LISP_POOL)
 
-static inline void *
-ao_lisp_ref(ao_poly poly) {
-       if (poly == 0xBEEF)
-               ao_lisp_abort();
-       if (poly == AO_LISP_NIL)
-               return NULL;
-       if (poly & AO_LISP_CONST)
-               return (void *) (AO_LISP_CONST_BASE + (poly & AO_LISP_REF_MASK));
-       return (void *) (AO_LISP_POOL_BASE + (poly & AO_LISP_REF_MASK));
-}
+void *
+ao_lisp_ref(ao_poly poly);
 
-static inline ao_poly
-ao_lisp_poly(const void *addr, ao_poly type) {
-       const uint8_t   *a = addr;
-       if (a == NULL)
-               return AO_LISP_NIL;
-       if (AO_LISP_IS_CONST(a))
-               return AO_LISP_CONST | (a - AO_LISP_CONST_BASE) | type;
-       return (a - AO_LISP_POOL_BASE) | type;
-}
+ao_poly
+ao_lisp_poly(const void *addr, ao_poly type);
 
 struct ao_lisp_type {
        int     (*size)(void *addr);
index bfd75ae3b629a1ad9e235277418f3d528e73d6a1..9717fd73131b30712bf7a033f874417b8016034c 100644 (file)
@@ -84,3 +84,21 @@ ao_lisp_poly_patom(ao_poly p)
                f->patom(p);
 }
 
+void *
+ao_lisp_ref(ao_poly poly) {
+       if (poly == AO_LISP_NIL)
+               return NULL;
+       if (poly & AO_LISP_CONST)
+               return (void *) (AO_LISP_CONST_BASE + (poly & AO_LISP_REF_MASK));
+       return (void *) (AO_LISP_POOL_BASE + (poly & AO_LISP_REF_MASK));
+}
+
+ao_poly
+ao_lisp_poly(const void *addr, ao_poly type) {
+       const uint8_t   *a = addr;
+       if (a == NULL)
+               return AO_LISP_NIL;
+       if (AO_LISP_IS_CONST(a))
+               return AO_LISP_CONST | (a - AO_LISP_CONST_BASE) | type;
+       return (a - AO_LISP_POOL_BASE) | type;
+}