diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 7d882741..bea2a041 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -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); diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 56ad93b8..94ee2e9d 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -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))) diff --git a/scheme/cyclone/primitives.sld b/scheme/cyclone/primitives.sld index 66a4cac3..fe241d51 100644 --- a/scheme/cyclone/primitives.sld +++ b/scheme/cyclone/primitives.sld @@ -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?