From 7a2678acb27d003f262c6aeb8ffeb593511ea33f Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 3 Dec 2011 23:34:09 +0100 Subject: [PATCH] Compiler macros optimize first, second,... --- src/cmp/cmpopt-cons.lsp | 9 +++++++++ src/cmp/sysfun.lsp | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cmp/cmpopt-cons.lsp b/src/cmp/cmpopt-cons.lsp index 94f7cace8..3105c2d04 100644 --- a/src/cmp/cmpopt-cons.lsp +++ b/src/cmp/cmpopt-cons.lsp @@ -120,6 +120,15 @@ (t whole)) whole)) +;;; +;;; FIRST, SECOND, THIRD, ... +;;; + +(progn . + #.(loop for n in '(first second third fourth fifth sixth seventh eighth ninth tenth) + for i from 0 + collect `(define-compiler-macro ,n (x) (list 'nth ,i x)))) + ;;; ;;; POP ;;; diff --git a/src/cmp/sysfun.lsp b/src/cmp/sysfun.lsp index 93c213ce2..0a0e51428 100644 --- a/src/cmp/sysfun.lsp +++ b/src/cmp/sysfun.lsp @@ -360,17 +360,6 @@ (def-inline nth :unsafe (t t) t "ecl_nth(fix(#0),#1)") (def-inline nth :unsafe (fixnum t) t "ecl_nth(#0,#1)") -(def-inline first :always (t) t "ecl_car(#0)") -(def-inline second :always (t) t "ecl_cadr(#0)") -(def-inline third :always (t) t "ecl_caddr(#0)") -(def-inline fourth :always (t) t "ecl_cadddr(#0)") - -(def-inline first :unsafe (cons) t "ECL_CONS_CAR(#0)") -(def-inline first :unsafe (t) t "_ecl_car(#0)") -(def-inline second :unsafe (t) t "_ecl_cadr(#0)") -(def-inline third :unsafe (t) t "_ecl_caddr(#0)") -(def-inline fourth :unsafe (t) t "_ecl_cadddr(#0)") - (def-inline rest :always (t) t "ecl_cdr(#0)") (def-inline rest :unsafe (cons) t "ECL_CONS_CDR(#0)") (def-inline rest :unsafe (t) t "_ecl_cdr(#0)")