1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

Remove @prompt memoizer

* libguile/memoize.h:
* libguile/memoize.c (MAKMEMO_CALL_WITH_PROMPT, memoize, unmemoize):
  Remove the @prompt memoizer in favor of recognizing call-with-prompt
  primcalls.  Rename SCM_M_PROMPT to SCM_M_CALL_WITH_PROMPT, and pass a
  thunk instead of an expression so that it has normal applicative
  order.

* libguile/expand.c (PRIMITIVE_REF, PRIMCALL, expand): Produce primcalls
  from forms whose car is a primitive.
  (expand_atat): Recognize (@@ primitive FOO) as being a primitive-ref.

* module/ice-9/boot-9.scm (call-with-prompt): Instead of dispatching to
  the wonky @prompt memoizer, residualize a primcall to
  call-with-prompt.  The memoizer will DTRT to allow call-with-prompt to
  be interpreted correctly without needing an additional binding.

* module/ice-9/eval.scm (primitive-eval): Change the 'prompt clause to a
  call to call-with-prompt.

* module/language/tree-il/primitives.scm: No more need to recognize
  @prompt.

* libguile/eval.c (eval): Adapt to SCM_M_PROMPT renaming to
  SCM_M_CALL_WITH_PROMPT, and apply the thunk.

* libguile/throw.c (pre_init_throw): Adapt to scm_abort_to_prompt_star
  rename.
This commit is contained in:
Andy Wingo 2013-06-25 22:36:08 +02:00
parent 385049949a
commit 1773bc7dd5
8 changed files with 56 additions and 65 deletions

View file

@ -77,7 +77,7 @@
fluid-ref fluid-set!
@prompt call-with-prompt
call-with-prompt
abort-to-prompt* abort-to-prompt
make-prompt-tag
@ -187,7 +187,7 @@
dynamic-wind
@dynamic-wind
values
@prompt call-with-prompt
call-with-prompt
@abort abort-to-prompt))
;; Procedures that cause a nonlocal, non-resumable abort.
@ -586,23 +586,6 @@
((src fluid exp) (make-dynset src fluid exp))
(else #f)))
(hashq-set! *primitive-expand-table*
'@prompt
(case-lambda
((src tag exp handler)
(let ((args-sym (gensym)))
(make-prompt
src tag exp
;; If handler itself is a lambda, the inliner can do some
;; trickery here.
(make-lambda-case
(tree-il-src handler) '() #f 'args #f '() (list args-sym)
(make-primcall #f 'apply
(list handler
(make-lexical-ref #f 'args args-sym)))
#f))))
(else #f)))
(hashq-set! *primitive-expand-table*
'call-with-prompt
(case-lambda