Refactoring

Use a macro name that makes more sense, as we are trying to determine if obj is a closure.
This commit is contained in:
Justin Ethier 2019-08-22 21:28:57 -04:00
parent aed49c49e4
commit e099fe7860
4 changed files with 8 additions and 8 deletions

View file

@ -63,13 +63,13 @@ enum object_tag {
/**
* Returns a true value if object is not a closure, or false otherwise
*/
#define type_is_not_closure(clo) \
((clo == NULL) || is_value_type(clo) || (type_of(clo) > macro_tag))
#define obj_is_not_closure(obj) \
((obj == NULL) || is_value_type(obj) || (type_of(obj) > macro_tag))
/**
* Returns a true value if object is not a closure, or false otherwise
*/
#define type_is_pair_prim(clo) (type_is_not_closure(clo))
#define type_is_pair_prim(clo) (obj_is_not_closure(clo))
/**

View file

@ -14,7 +14,7 @@
/* These macros are hardcoded here to support functions in this module. */
#define closcall1(td, clo, a1) \
if (type_is_pair_prim(clo)) { \
if (obj_is_not_closure(clo)) { \
Cyc_apply(td, 0, (closure)(a1), clo); \
} else { \
((clo)->fn)(td, 1, clo, a1);\

View file

@ -103,7 +103,7 @@ void Cyc_check_bounds(void *data, const char *label, int len, int index)
/* These macros are hardcoded here to support functions in this module. */
#define closcall1(td, clo, a1) \
if (type_is_pair_prim(clo)) { \
if (obj_is_not_closure(clo)) { \
Cyc_apply(td, 0, (closure)(a1), clo); \
} else { \
((clo)->fn)(td, 1, clo, a1);\
@ -131,7 +131,7 @@ if (type_is_pair_prim(clo)) { \
} \
}
#define closcall2(td, clo, a1, a2) \
if (type_is_pair_prim(clo)) { \
if (obj_is_not_closure(clo)) { \
Cyc_apply(td, 1, (closure)(a1), clo,a2); \
} else { \
((clo)->fn)(td, 2, clo, a1, a2);\
@ -5391,7 +5391,7 @@ void Cyc_start_trampoline(gc_thread_data * thd)
printf("Done with GC\n");
#endif
if (type_is_pair_prim(thd->gc_cont)) {
if (obj_is_not_closure(thd->gc_cont)) {
Cyc_apply_from_buf(thd, thd->gc_num_args, thd->gc_cont, thd->gc_args);
} else {
do_dispatch(thd, thd->gc_num_args, ((closure) (thd->gc_cont))->fn,

View file

@ -231,7 +231,7 @@
(wrap (lambda (s) (if (> num-args 0) s ""))))
(string-append
"#define closcall" n "(td, clo" args ") \\\n"
(wrap (string-append "if (type_is_pair_prim(clo)) { \\\n"
(wrap (string-append "if (obj_is_not_closure(clo)) { \\\n"
" Cyc_apply(td, " n-1 ", (closure)(a1), clo" (if (> num-args 1) (substring args 3 (string-length args)) "") "); \\\n"
"}"))
(wrap " else { \\\n")