mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Speed up vector
for five args or less
This commit is contained in:
parent
36aac15dd5
commit
1edb877c5f
7 changed files with 27 additions and 0 deletions
|
@ -10,6 +10,7 @@ Features
|
|||
- Arthur Maciel added instructions for building Cyclone on FreeBSD.
|
||||
- Added support for delays and promises to `(cyclone concurrent)`. Note functions/macros for both types of objects are prefixed with `shared-` to differentiate them from R7RS definitions from `(scheme lazy)`.
|
||||
- Added platform (linux, bsd, etc) to the list of emitted by `(features)` and to the features recognized by `cond-expand`.
|
||||
- Optimize compilation of `vector` for five arguments or less.
|
||||
|
||||
Bug Fixes
|
||||
|
||||
|
|
|
@ -411,6 +411,7 @@ object Cyc_fast_list_4(object ptr, object a1, object a2, object a3, object a4);
|
|||
object Cyc_fast_vector_2(object ptr, object a1, object a2);
|
||||
object Cyc_fast_vector_3(object ptr, object a1, object a2, object a3);
|
||||
object Cyc_fast_vector_4(object ptr, object a1, object a2, object a3, object a4);
|
||||
object Cyc_fast_vector_5(object ptr, object a1, object a2, object a3, object a4, object a5);
|
||||
object Cyc_bit_unset(void *data, object n1, object n2);
|
||||
object Cyc_bit_set(void *data, object n1, object n2);
|
||||
object Cyc_num_op_va_list(void *data, int argc,
|
||||
|
|
|
@ -1083,6 +1083,7 @@ typedef vector_type *vector;
|
|||
typedef struct { vector_type v; object arr[2]; } vector_2_type;
|
||||
typedef struct { vector_type v; object arr[3]; } vector_3_type;
|
||||
typedef struct { vector_type v; object arr[4]; } vector_4_type;
|
||||
typedef struct { vector_type v; object arr[5]; } vector_5_type;
|
||||
|
||||
/** Create a new vector in the nursery */
|
||||
#define make_empty_vector(v) \
|
||||
|
|
17
runtime.c
17
runtime.c
|
@ -1366,6 +1366,23 @@ object Cyc_fast_vector_4(object ptr, object a1, object a2, object a3, object a4)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
object Cyc_fast_vector_5(object ptr, object a1, object a2, object a3, object a4, object a5)
|
||||
{
|
||||
vector_5_type *v = (vector_5_type *)ptr;
|
||||
v->v.hdr.mark = gc_color_red;
|
||||
v->v.hdr.grayed = 0;
|
||||
v->v.hdr.immutable = 0;
|
||||
v->v.tag = vector_tag;
|
||||
v->v.num_elements = 5;
|
||||
v->v.elements = v->arr;
|
||||
v->v.elements[0] = a1;
|
||||
v->v.elements[1] = a2;
|
||||
v->v.elements[2] = a3;
|
||||
v->v.elements[3] = a4;
|
||||
v->v.elements[4] = a5;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// Internal function, do not use this anywhere outside the runtime
|
||||
object Cyc_heap_alloc_port(void *data, port_type *stack_p)
|
||||
{
|
||||
|
|
|
@ -1164,6 +1164,7 @@
|
|||
Cyc-fast-vector-2
|
||||
Cyc-fast-vector-3
|
||||
Cyc-fast-vector-4
|
||||
Cyc-fast-vector-5
|
||||
)))
|
||||
|
||||
(define (prim-calls-inlinable? prim-calls)
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
Cyc-fast-vector-2
|
||||
Cyc-fast-vector-3
|
||||
Cyc-fast-vector-4
|
||||
Cyc-fast-vector-5
|
||||
Cyc-fast-list-1
|
||||
Cyc-fast-list-2
|
||||
Cyc-fast-list-3
|
||||
|
@ -268,6 +269,7 @@
|
|||
(Cyc-fast-vector-2 2 2)
|
||||
(Cyc-fast-vector-3 3 3)
|
||||
(Cyc-fast-vector-4 4 4)
|
||||
(Cyc-fast-vector-5 5 5)
|
||||
(Cyc-fast-list-1 1 1)
|
||||
(Cyc-fast-list-2 2 2)
|
||||
(Cyc-fast-list-3 3 3)
|
||||
|
@ -657,6 +659,7 @@
|
|||
((eq? p 'Cyc-fast-vector-2) "Cyc_fast_vector_2")
|
||||
((eq? p 'Cyc-fast-vector-3) "Cyc_fast_vector_3")
|
||||
((eq? p 'Cyc-fast-vector-4) "Cyc_fast_vector_4")
|
||||
((eq? p 'Cyc-fast-vector-5) "Cyc_fast_vector_5")
|
||||
((eq? p 'Cyc-fast-list-1) "set_cell_as_expr")
|
||||
((eq? p 'Cyc-fast-list-2) "Cyc_fast_list_2")
|
||||
((eq? p 'Cyc-fast-list-3) "Cyc_fast_list_3")
|
||||
|
@ -773,6 +776,7 @@
|
|||
((eq? p 'Cyc-fast-vector-2) "vector_2_type")
|
||||
((eq? p 'Cyc-fast-vector-3) "vector_3_type")
|
||||
((eq? p 'Cyc-fast-vector-4) "vector_4_type")
|
||||
((eq? p 'Cyc-fast-vector-5) "vector_5_type")
|
||||
((eq? p 'Cyc-fast-list-1) "pair_type")
|
||||
((eq? p 'Cyc-fast-list-2) "list_2_type")
|
||||
((eq? p 'Cyc-fast-list-3) "list_3_type")
|
||||
|
|
|
@ -1103,6 +1103,8 @@ if (acc) {
|
|||
(cons 'Cyc-fast-vector-3 (map (lambda (a) (convert a renamed)) (cdr ast))))
|
||||
((and (eq? (car ast) 'vector) (= (length ast) 5))
|
||||
(cons 'Cyc-fast-vector-4 (map (lambda (a) (convert a renamed)) (cdr ast))))
|
||||
((and (eq? (car ast) 'vector) (= (length ast) 6))
|
||||
(cons 'Cyc-fast-vector-5 (map (lambda (a) (convert a renamed)) (cdr ast))))
|
||||
((and (eq? (car ast) 'list) (= (length ast) 2))
|
||||
(cons 'Cyc-fast-list-1 (map (lambda (a) (convert a renamed)) (cdr ast))))
|
||||
((and (eq? (car ast) 'list) (= (length ast) 3))
|
||||
|
|
Loading…
Add table
Reference in a new issue