[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 07/07: Improve compilation of make-vector without init
From: |
Andy Wingo |
Subject: |
[Guile-commits] 07/07: Improve compilation of make-vector without init |
Date: |
Fri, 5 Jan 2018 09:25:25 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 7486806ba3981df0a862054054fee2f41731329f
Author: Andy Wingo <address@hidden>
Date: Fri Jan 5 15:18:16 2018 +0100
Improve compilation of make-vector without init
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add
expansion for one-argument make-vector.
---
module/language/tree-il/primitives.scm | 11 +++++++++++
module/srfi/srfi-43.scm | 14 +++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/module/language/tree-il/primitives.scm
b/module/language/tree-il/primitives.scm
index 934b5c7..89bf48a 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -470,6 +470,17 @@
(x y) (logand x y)
(x y z ... last) (logand (logand x y . z) last))
+(hashq-set!
+ *primitive-expand-table*
+ 'make-vector
+ (match-lambda*
+ ((src len)
+ (make-primcall src 'make-vector (list len (make-const src *unspecified*))))
+ ((src len init)
+ (make-primcall src 'make-vector (list len init)))
+ ((src . args)
+ (make-call src (make-primitive-ref src 'make-vector) args))))
+
(define-primitive-expander caar (x) (car (car x)))
(define-primitive-expander cadr (x) (car (cdr x)))
(define-primitive-expander cdar (x) (cdr (car x)))
diff --git a/module/srfi/srfi-43.scm b/module/srfi/srfi-43.scm
index 153b0cb..e1bf19e 100644
--- a/module/srfi/srfi-43.scm
+++ b/module/srfi/srfi-43.scm
@@ -1,6 +1,6 @@
;;; srfi-43.scm -- SRFI 43 Vector library
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -41,10 +41,14 @@
(cond-expand-provide (current-module) '(srfi-43))
-(define (error-from who msg . args)
- (apply error
- (string-append (symbol->string who) ": " msg)
- args))
+(define-syntax error-from
+ (lambda (stx)
+ (syntax-case stx (quote)
+ ((_ 'who msg arg ...)
+ #`(error #,(string-append (symbol->string (syntax->datum #'who))
+ ": "
+ (syntax->datum #'msg))
+ arg ...)))))
(define-syntax-rule (assert-nonneg-exact-integer k who)
(unless (and (exact-integer? k)
- [Guile-commits] branch master updated (118f516 -> 7486806), Andy Wingo, 2018/01/05
- [Guile-commits] 03/07: Prevent LICM of memory accesses guarded by effect-free predicates, Andy Wingo, 2018/01/05
- [Guile-commits] 06/07: Allow peval to gnaw on string->symbol, symbol->string, Andy Wingo, 2018/01/05
- [Guile-commits] 04/07: Allow peeling loops with bailouts, Andy Wingo, 2018/01/05
- [Guile-commits] 02/07: Disable resolve-primitives pass below -O2, Andy Wingo, 2018/01/05
- [Guile-commits] 05/07: Instruction explosion for vector-{length, ref, set!}, Andy Wingo, 2018/01/05
- [Guile-commits] 01/07: Add (system base optimize) module, Andy Wingo, 2018/01/05
- [Guile-commits] 07/07: Improve compilation of make-vector without init,
Andy Wingo <=