From abd6af11cd1ab62c2f337dcd23a9d9c37b9d169e Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 14 Feb 2009 00:24:32 +0100 Subject: generate the fixed-offset accessors at compile-time * module/language/scheme/compile-ghil.scm (define-scheme-translator): Only add an else clause if the transformer didn't have one. * module/oop/goops.scm (min-fixnum, max-fixnum): Define at compile-time as well. (@slot-ref, @slot-set!): Only define transformers for these at compile-time. Avoids loading up the compiler unnecessarily. Also, allow for the `n' to be determined lexically, in which case we dispatch to the primitive. (num-standard-pre-cache, define-standard-accessor-method) (bound-check-get, standard-get, standard-set): Rework the fixed-offset getters and setters so that they can be computed at compile-time. Accessors to fields with n > num-standard-pre-cache will be dispatched to the primitive instead of within the VM. --- module/language/scheme/compile-ghil.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/language/scheme/compile-ghil.scm') diff --git a/module/language/scheme/compile-ghil.scm b/module/language/scheme/compile-ghil.scm index f27ae7a43..2821c1e70 100644 --- a/module/language/scheme/compile-ghil.scm +++ b/module/language/scheme/compile-ghil.scm @@ -174,8 +174,9 @@ (define syntax-error (@ (system base compile) syntax-error)) (pmatch (cdr exp) ,@clauses - (else - (syntax-error l (format #f "bad ~A" ',sym) exp)))))) + ,@(if (assq 'else clauses) '() + '((else + (syntax-error l (format #f "bad ~A" ',sym) exp)))))))) (define-scheme-translator quote ;; (quote OBJ) -- cgit v1.2.3