Experimenting with faster versions of (list)

This commit is contained in:
Justin Ethier 2018-06-19 13:18:14 -04:00
parent dfff00b35a
commit f2704eb5e4
2 changed files with 34 additions and 0 deletions

View file

@ -1064,6 +1064,24 @@ typedef pair_type *pair;
n->pair_car = a; \ n->pair_car = a; \
n->pair_cdr = d; n->pair_cdr = d;
#define make_list_1(l, a1) \
make_pair(l, a1, NULL);
#define make_list_2(l, a1, a2) \
make_pair(l##__2, a2, NULL); \
make_pair(l, a1, l##__2);
#define make_list_3(l, a1, a2, a3) \
make_pair(l##__3, a3, NULL); \
make_pair(l##__2, a2, l##__3); \
make_pair(l, a1, l##__2);
#define make_list_4(l, a1, a2, a3, a4) \
make_pair(l##__4, a4, NULL); \
make_pair(l##__3, a3, l##__4); \
make_pair(l##__2, a2, l##__3); \
make_pair(l, a1, l##__2);
/** /**
* Create a pair with a single value. * Create a pair with a single value.
* This is useful to create an object that can be modified. * This is useful to create an object that can be modified.

View file

@ -115,6 +115,10 @@
Cyc-default-exception-handler Cyc-default-exception-handler
Cyc-current-exception-handler Cyc-current-exception-handler
cons cons
Cyc-fast-list-1
Cyc-fast-list-2
Cyc-fast-list-3
Cyc-fast-list-4
cell-get cell-get
set-global! set-global!
set-cell! set-cell!
@ -251,6 +255,10 @@
(Cyc-default-exception-handler 1 1) (Cyc-default-exception-handler 1 1)
(Cyc-current-exception-handler 0 0) (Cyc-current-exception-handler 0 0)
(cons 2 2) (cons 2 2)
(Cyc-fast-list-1 1 1)
(Cyc-fast-list-2 2 2)
(Cyc-fast-list-3 3 3)
(Cyc-fast-list-4 4 4)
(cell-get 1 1) (cell-get 1 1)
(set-global! 2 2) (set-global! 2 2)
(set-cell! 2 2) (set-cell! 2 2)
@ -598,6 +606,10 @@
((eq? p 'eof-object?) "Cyc_is_eof_object") ((eq? p 'eof-object?) "Cyc_is_eof_object")
((eq? p 'symbol?) "Cyc_is_symbol") ((eq? p 'symbol?) "Cyc_is_symbol")
((eq? p 'cons) "make_pair") ((eq? p 'cons) "make_pair")
((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")
((eq? p 'Cyc-fast-list-4) "make_list_4")
((eq? p 'cell) "make_cell") ((eq? p 'cell) "make_cell")
((eq? p 'cell-get) "car") ;; Unsafe as cell gets added by compiler ((eq? p 'cell-get) "car") ;; Unsafe as cell gets added by compiler
((eq? p 'set-cell!) "Cyc_set_cell") ((eq? p 'set-cell!) "Cyc_set_cell")
@ -812,6 +824,10 @@
command-line-arguments command-line-arguments
Cyc-read-line Cyc-read-line
Cyc-read-char Cyc-peek-char Cyc-read-char Cyc-peek-char
Cyc-fast-list-1
Cyc-fast-list-2
Cyc-fast-list-3
Cyc-fast-list-4
cons cell)) cons cell))
(member exp *udf-prims*)))) (member exp *udf-prims*))))