From a918f2cb2d910d26996eab7f853b5b35aefa1bfe Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 29 Nov 2018 13:36:07 -0500 Subject: [PATCH] issue #282 - Put numeric operations in body This avoids ordering issues. But I think we still have trouble with other primtives. Is there ever a legitimate need to declare a c var for a prim??? I am not seeing it, especially with our changes now for Cyc-seq. --- scheme/cyclone/cgen.sld | 4 +++- scheme/cyclone/primitives.sld | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 15ddc2e7..56ad93b8 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -803,7 +803,9 @@ (list (string-append c-func "(" cv-name tdata-comma tdata))))) (else - (c-code (string-append c-func "(" tdata)))))) + (c-code/vars + (string-append c-func "(" tdata tptr-comma tptr) + (list tptr-decl)))))) ;; END primitives ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scheme/cyclone/primitives.sld b/scheme/cyclone/primitives.sld index 63da05de..eeadfe1b 100644 --- a/scheme/cyclone/primitives.sld +++ b/scheme/cyclone/primitives.sld @@ -765,10 +765,11 @@ ((eq? p 'Cyc-stderr) "port_type") ((eq? p 'open-input-file) "port_type") ((eq? p 'open-output-file) "port_type") - ((eq? p 'Cyc-fast-plus) "object") - ((eq? p 'Cyc-fast-sub) "object") - ((eq? p 'Cyc-fast-mul) "object") - ((eq? p 'Cyc-fast-div) "object") + ; TODO: can we remove all of these?? What actually needs to remain? + ;((eq? p 'Cyc-fast-plus) "object") + ;((eq? p 'Cyc-fast-sub) "object") + ;((eq? p 'Cyc-fast-mul) "object") + ;((eq? p 'Cyc-fast-div) "object") ((eq? p '+) "object") ((eq? p '-) "object") ((eq? p '*) "object") @@ -836,10 +837,11 @@ make-vector list->vector symbol->string number->string substring - Cyc-fast-plus - Cyc-fast-sub - Cyc-fast-mul - Cyc-fast-div + ; TODO: can we remove all of these?? What actually needs to remain? + ;Cyc-fast-plus + ;Cyc-fast-sub + ;Cyc-fast-mul + ;Cyc-fast-div Cyc-fast-eq Cyc-fast-gt Cyc-fast-lt @@ -850,7 +852,8 @@ Cyc-fast-char-lt Cyc-fast-char-gte Cyc-fast-char-lte - + - * / apply + + - * / + apply Cyc-fast-apply = > < >= <= command-line-arguments