Refactoring

This commit is contained in:
Justin Ethier 2016-04-27 03:30:29 -04:00
parent e892ed2270
commit ef4ad29969

View file

@ -74,37 +74,37 @@ void Cyc_check_bounds(void *data, const char *label, int len, int index) {
/* END error checking */ /* END error checking */
/* These macros are hardcoded here to support functions in this module. */ /* These macros are hardcoded here to support functions in this module. */
#define closcall1(td, clo,a1) \ #define closcall1(td, clo, a1) \
if (type_of(clo) == pair_tag || prim(clo)) { \ if (type_of(clo) == pair_tag || prim(clo)) { \
Cyc_apply(td, 0, (closure)(a1), clo); \ Cyc_apply(td, 0, (closure)(a1), clo); \
} else { \ } else { \
((clo)->fn)(td, 1, clo,a1);\ ((clo)->fn)(td, 1, clo, a1);\
} }
#define return_closcall1(td, clo,a1) { \ #define return_closcall1(td, clo, a1) { \
char top; \ char top; \
if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
object buf[1]; buf[0] = a1;\ object buf[1]; buf[0] = a1;\
GC(td, clo, buf, 1); \ GC(td, clo, buf, 1); \
return; \ return; \
} else {\ } else {\
closcall1(td, (closure) (clo),a1); \ closcall1(td, (closure) (clo), a1); \
return;\ return;\
} \ } \
} }
#define closcall2(td, clo,a1,a2) \ #define closcall2(td, clo, a1, a2) \
if (type_of(clo) == pair_tag || prim(clo)) { \ if (type_of(clo) == pair_tag || prim(clo)) { \
Cyc_apply(td, 1, (closure)(a1), clo,a2); \ Cyc_apply(td, 1, (closure)(a1), clo,a2); \
} else { \ } else { \
((clo)->fn)(td, 2, clo,a1,a2);\ ((clo)->fn)(td, 2, clo, a1, a2);\
} }
#define return_closcall2(td, clo,a1,a2) { \ #define return_closcall2(td, clo, a1, a2) { \
char top; \ char top; \
if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
object buf[2]; buf[0] = a1;buf[1] = a2;\ object buf[2]; buf[0] = a1;buf[1] = a2;\
GC(td, clo, buf, 2); \ GC(td, clo, buf, 2); \
return; \ return; \
} else {\ } else {\
closcall2(td, (closure) (clo),a1,a2); \ closcall2(td, (closure) (clo), a1, a2); \
return;\ return;\
} \ } \
} }