WIP, seq safe allocation/assignment of pairs

This commit is contained in:
Justin Ethier 2018-11-30 13:38:10 -05:00
parent e6e6527be7
commit 8ccd2b3525
3 changed files with 14 additions and 5 deletions

View file

@ -1140,6 +1140,14 @@ typedef pair_type *pair;
n->pair_car = a; \
n->pair_cdr = d;
#define set_pair_as_expr(n,a,d) \
(((pair)(n))->hdr.mark = gc_color_red, \
((pair)(n))->hdr.grayed = 0, \
((pair)(n))->tag = pair_tag, \
((pair)(n))->pair_car = a, \
((pair)(n))->pair_cdr = d, \
(n))
#define make_list_1(l, a1) \
make_pair(l, a1, NULL);

View file

@ -733,8 +733,8 @@
(tptr-type (prim/c-var-pointer p))
(tptr-comma
(cond
((and tptr-type use-alloca?) ",")
(tptr-type ",&")
((and tptr-type use-alloca?) tdata-comma)
(tptr-type (string-append tdata-comma "&"))
(else "")))
(tptr (cond
(tptr-type (mangle (gensym 'local)))

View file

@ -481,7 +481,7 @@
;; created via alloca or such, and cannot be declared as stack vars.
;; This is to support C loops in place of recursion.
(cond
((eq? p 'cons) "alloca_pair")
;((eq? p 'cons) "alloca_pair")
((eq? p 'Cyc-fast-list-1) "alloca_list_1")
((eq? p 'Cyc-fast-list-2) "alloca_list_2")
((eq? p 'Cyc-fast-list-3) "alloca_list_3")
@ -640,7 +640,7 @@
((eq? p 'string?) "Cyc_is_string")
((eq? p 'eof-object?) "Cyc_is_eof_object")
((eq? p 'symbol?) "Cyc_is_symbol")
((eq? p 'cons) "make_pair")
((eq? p 'cons) "set_pair_as_expr")
((eq? p 'Cyc-fast-list-1) "make_list_1")
((eq? p 'Cyc-fast-list-2) "make_list_2")
((eq? p 'Cyc-fast-list-3) "make_list_3")
@ -752,6 +752,7 @@
;; Determine if primitive receives a pointer to a local C variable
(define (prim/c-var-pointer p)
(cond
((eq? p 'cons) "pair_type")
((eq? p 'Cyc-fast-plus) "complex_num_type")
((eq? p 'Cyc-fast-sub) "complex_num_type")
((eq? p 'Cyc-fast-mul) "complex_num_type")
@ -869,7 +870,7 @@
Cyc-fast-list-2
Cyc-fast-list-3
Cyc-fast-list-4
cons cell))
cell))
(member exp *udf-prims*))))
;; Pass continuation as the function's first parameter?