mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 01:30:27 +02:00
remove @apply memoizer
* libguile/memoize.c (memoize): Recognize a primcall to 'apply as SCM_M_APPLY. (@apply): Remove @apply memoizer. (unmemoize): Unmemoize using "apply", not "@apply". * libguile/memoize.h: * libguile/expand.c (scm_sym_atapply): Remove. * module/ice-9/boot-9.scm (apply): Re-implement using apply primcall. Use case-lambda, so as to give an appropriate minimum arity. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Compile a primcall of "apply" specially, not "@apply". * module/language/tree-il/peval.scm (peval): Match primcalls to "apply", not "@apply". Residualize "apply" primcalls. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @apply, and apply primitive expander. * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Update tests to expect residualized "apply". * test-suite/tests/procprop.test ("procedure-arity"): Update test for better apply arity. * test-suite/tests/strings.test ("string"): Update expected error.
This commit is contained in:
parent
1773bc7dd5
commit
39caffe79b
11 changed files with 46 additions and 79 deletions
|
@ -874,7 +874,7 @@
|
|||
(let (args) (_) ((primcall list (const 2) (const 3)))
|
||||
(seq
|
||||
(call (toplevel foo!) (lexical args _))
|
||||
(primcall @apply
|
||||
(primcall apply
|
||||
(lambda ()
|
||||
(lambda-case
|
||||
(((x y z w) #f #f #f () (_ _ _ _))
|
||||
|
@ -898,7 +898,7 @@
|
|||
bv
|
||||
(+ offset 4))))
|
||||
(let ((args (list x y)))
|
||||
(@apply
|
||||
(apply
|
||||
(lambda (bv offset x y)
|
||||
(bytevector-ieee-single-native-set!
|
||||
bv
|
||||
|
@ -938,7 +938,7 @@
|
|||
;; Here we ensure that non-constant expressions are not copied.
|
||||
(lambda ()
|
||||
(let ((args (list (foo!))))
|
||||
(@apply
|
||||
(apply
|
||||
(lambda (z x)
|
||||
(list z x))
|
||||
;; This toplevel ref might raise an unbound variable exception.
|
||||
|
@ -959,7 +959,7 @@
|
|||
(lambda ()
|
||||
(let ((args (list 'foo)))
|
||||
(set-car! args 'bar)
|
||||
(@apply
|
||||
(apply
|
||||
(lambda (z x)
|
||||
(list z x))
|
||||
z
|
||||
|
@ -971,7 +971,7 @@
|
|||
((primcall list (const foo)))
|
||||
(seq
|
||||
(primcall set-car! (lexical args _) (const bar))
|
||||
(primcall @apply
|
||||
(primcall apply
|
||||
(lambda . _)
|
||||
(toplevel z)
|
||||
(lexical args _))))))))
|
||||
|
@ -1106,7 +1106,7 @@
|
|||
(lambda-case
|
||||
((() #f vals #f () (_))
|
||||
(seq (toplevel baz)
|
||||
(primcall @apply (primitive values) (lexical vals _))))))))
|
||||
(primcall apply (primitive values) (lexical vals _))))))))
|
||||
|
||||
(pass-if-peval
|
||||
;; Prompt is removed if tag is unreferenced
|
||||
|
@ -1145,7 +1145,7 @@
|
|||
(const 1)
|
||||
(lambda-case
|
||||
((() #f args #f () (_))
|
||||
(primcall @apply
|
||||
(primcall apply
|
||||
(lexical handler _)
|
||||
(lexical args _)))))))
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;;; procprop.test --- Procedure properties -*- mode: scheme; coding: utf-8; -*-
|
||||
;;;; Ludovic Courtès <ludo@gnu.org>
|
||||
;;;;
|
||||
;;;; Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013 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
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
(pass-if "apply"
|
||||
(equal? (procedure-minimum-arity apply)
|
||||
'(1 0 #t)))
|
||||
'(2 0 #t)))
|
||||
|
||||
(pass-if "cons*"
|
||||
(equal? (procedure-minimum-arity cons*)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;;; Jim Blandy <jimb@red-bean.com> --- August 1999
|
||||
;;;;
|
||||
;;;; Copyright (C) 1999, 2001, 2004, 2005, 2006, 2008, 2009, 2010,
|
||||
;;;; 2011 Free Software Foundation, Inc.
|
||||
;;;; 2011, 2013 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
|
||||
|
@ -546,10 +546,10 @@
|
|||
(with-test-prefix "string"
|
||||
|
||||
(pass-if-exception "convert circular list to string"
|
||||
exception:wrong-type-arg
|
||||
(let ((foo (list #\a #\b #\c)))
|
||||
(set-cdr! (cddr foo) (cdr foo))
|
||||
(apply string foo))))
|
||||
'(wrong-type-arg . "Apply to non-list")
|
||||
(let ((foo (list #\a #\b #\c)))
|
||||
(set-cdr! (cddr foo) (cdr foo))
|
||||
(apply string foo))))
|
||||
|
||||
(with-test-prefix "string-split"
|
||||
|
||||
|
|
|
@ -653,10 +653,10 @@
|
|||
|
||||
(with-test-prefix "apply"
|
||||
(assert-tree-il->glil
|
||||
(primcall @apply (toplevel foo) (toplevel bar))
|
||||
(primcall apply (toplevel foo) (toplevel bar))
|
||||
(program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (toplevel ref bar) (call tail-apply 2)))
|
||||
(assert-tree-il->glil
|
||||
(begin (primcall @apply (toplevel foo) (toplevel bar)) (void))
|
||||
(begin (primcall apply (toplevel foo) (toplevel bar)) (void))
|
||||
(program () (std-prelude 0 0 #f) (label _)
|
||||
(call new-frame 0) (toplevel ref apply) (toplevel ref foo) (toplevel ref bar) (mv-call 2 ,l1)
|
||||
(call drop 1) (branch br ,l2) (label ,l3) (mv-bind 0 #f)
|
||||
|
@ -664,7 +664,7 @@
|
|||
(void) (call return 1))
|
||||
(and (eq? l1 l3) (eq? l2 l4)))
|
||||
(assert-tree-il->glil
|
||||
(call (toplevel foo) (call (toplevel @apply) (toplevel bar) (toplevel baz)))
|
||||
(call (toplevel foo) (call (toplevel apply) (toplevel bar) (toplevel baz)))
|
||||
(program () (std-prelude 0 0 #f) (label _)
|
||||
(toplevel ref foo)
|
||||
(call new-frame 0) (toplevel ref bar) (toplevel ref baz) (call apply 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue