mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
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:
parent
aed49c49e4
commit
e099fe7860
4 changed files with 8 additions and 8 deletions
|
@ -63,13 +63,13 @@ enum object_tag {
|
||||||
/**
|
/**
|
||||||
* Returns a true value if object is not a closure, or false otherwise
|
* Returns a true value if object is not a closure, or false otherwise
|
||||||
*/
|
*/
|
||||||
#define type_is_not_closure(clo) \
|
#define obj_is_not_closure(obj) \
|
||||||
((clo == NULL) || is_value_type(clo) || (type_of(clo) > macro_tag))
|
((obj == NULL) || is_value_type(obj) || (type_of(obj) > macro_tag))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a true value if object is not a closure, or false otherwise
|
* 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))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
/* 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_is_pair_prim(clo)) { \
|
if (obj_is_not_closure(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);\
|
||||||
|
|
|
@ -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. */
|
/* These macros are hardcoded here to support functions in this module. */
|
||||||
#define closcall1(td, clo, a1) \
|
#define closcall1(td, clo, a1) \
|
||||||
if (type_is_pair_prim(clo)) { \
|
if (obj_is_not_closure(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);\
|
||||||
|
@ -131,7 +131,7 @@ if (type_is_pair_prim(clo)) { \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define closcall2(td, clo, a1, a2) \
|
#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); \
|
Cyc_apply(td, 1, (closure)(a1), clo,a2); \
|
||||||
} else { \
|
} else { \
|
||||||
((clo)->fn)(td, 2, clo, a1, a2);\
|
((clo)->fn)(td, 2, clo, a1, a2);\
|
||||||
|
@ -5391,7 +5391,7 @@ void Cyc_start_trampoline(gc_thread_data * thd)
|
||||||
printf("Done with GC\n");
|
printf("Done with GC\n");
|
||||||
#endif
|
#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);
|
Cyc_apply_from_buf(thd, thd->gc_num_args, thd->gc_cont, thd->gc_args);
|
||||||
} else {
|
} else {
|
||||||
do_dispatch(thd, thd->gc_num_args, ((closure) (thd->gc_cont))->fn,
|
do_dispatch(thd, thd->gc_num_args, ((closure) (thd->gc_cont))->fn,
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
(wrap (lambda (s) (if (> num-args 0) s ""))))
|
(wrap (lambda (s) (if (> num-args 0) s ""))))
|
||||||
(string-append
|
(string-append
|
||||||
"#define closcall" n "(td, clo" args ") \\\n"
|
"#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"
|
" Cyc_apply(td, " n-1 ", (closure)(a1), clo" (if (> num-args 1) (substring args 3 (string-length args)) "") "); \\\n"
|
||||||
"}"))
|
"}"))
|
||||||
(wrap " else { \\\n")
|
(wrap " else { \\\n")
|
||||||
|
|
Loading…
Add table
Reference in a new issue