mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 03:54:12 +02:00
dynamic-wind in terms of wind and unwind; remove <dynwind>, @dynamic-wind
* doc/ref/compiler.texi: Remove mention of <dynwind>. * libguile/eval.c (eval): Remove SCM_M_DYNWIND case. * libguile/expand.c: Remove scm_sym_at_dynamic_wind. * libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If we see a wind or unwind primcall, we expand to a call of a quoted subr value. It works and removes a kind of memoized value from the interpreter. For the compiler,primcalls to wind and unwind are handled specially. (MAKMEMO_DYNWIND): Remove. (scm_tc16_memoizer): Remove. Yay! (memoize): Remove speculative lookup for toplevels to see if they are memoizers: there are no more memoizers. Memoize calls to the wind and unwind primitives. (m_dynamic_wind): Remove. (unmemoize): Remove dynwind case. (scm_init_memoize): Add wind and unwind local definitions. * module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind" and "unwind" primitives. These primitives are not exposed to other modules. * module/ice-9/eval.scm (primitive-eval): Remove dynwind case. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynwind cases. * module/language/tree-il.scm: Remove <dynwind>. Yaaay! * module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind cases. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind and unwind. (flatten-lambda-case): Remove dynwind case. Yay! * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (singly-valued-expression?, peval): Remove <dywind> cases. Inline primcalls to dynamic-wind. Add constant folding for thunk?. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Remove @dynamic-wind, and add procedure? and thunk?. (*effect+exception-free-primitives*): Add procedure? and thunk?. (*multiply-valued-primitives*): Remove @dynamic-wind. Remove @dynamic-wind expander. * test-suite/tests/peval.test ("partial evaluation"): Update tests for dynwind desugaring.
This commit is contained in:
parent
0fcc39a0a9
commit
bb97e4abd4
17 changed files with 108 additions and 280 deletions
|
@ -41,7 +41,6 @@
|
|||
call-with-current-continuation
|
||||
call/cc
|
||||
dynamic-wind
|
||||
@dynamic-wind
|
||||
values
|
||||
eq? eqv? equal?
|
||||
memq memv
|
||||
|
@ -51,6 +50,8 @@
|
|||
not
|
||||
pair? null? list? symbol? vector? string? struct? number? char? nil?
|
||||
|
||||
procedure? thunk?
|
||||
|
||||
complex? real? rational? inf? nan? integer? exact? inexact? even? odd?
|
||||
|
||||
char<? char<=? char>=? char>?
|
||||
|
@ -176,6 +177,7 @@
|
|||
eq? eqv? equal?
|
||||
not
|
||||
pair? null? list? symbol? vector? struct? string? number? char?
|
||||
procedure? thunk?
|
||||
acons cons cons* list vector))
|
||||
|
||||
;; Primitives that don't always return one value.
|
||||
|
@ -185,7 +187,6 @@
|
|||
call-with-current-continuation
|
||||
call/cc
|
||||
dynamic-wind
|
||||
@dynamic-wind
|
||||
values
|
||||
call-with-prompt
|
||||
@abort abort-to-prompt))
|
||||
|
@ -533,38 +534,6 @@
|
|||
(hashq-set! *primitive-expand-table* 'eqv? maybe-simplify-to-eq)
|
||||
(hashq-set! *primitive-expand-table* 'equal? maybe-simplify-to-eq)
|
||||
|
||||
(hashq-set! *primitive-expand-table*
|
||||
'@dynamic-wind
|
||||
(case-lambda
|
||||
((src pre expr post)
|
||||
(let* ((PRE (gensym "pre-"))
|
||||
(POST (gensym "post-"))
|
||||
(winder (make-lexical-ref #f 'winder PRE))
|
||||
(unwinder (make-lexical-ref #f 'unwinder POST)))
|
||||
(define (make-begin0 src first second)
|
||||
(make-let-values
|
||||
src
|
||||
first
|
||||
(let ((vals (gensym "vals ")))
|
||||
(make-lambda-case
|
||||
#f
|
||||
'() #f 'vals #f '() (list vals)
|
||||
(make-seq
|
||||
src
|
||||
second
|
||||
(make-primcall #f 'apply
|
||||
(list
|
||||
(make-primitive-ref #f 'values)
|
||||
(make-lexical-ref #f 'vals vals))))
|
||||
#f))))
|
||||
(make-let src '(pre post) (list PRE POST) (list pre post)
|
||||
(make-seq src
|
||||
(make-call src winder '())
|
||||
(make-begin0
|
||||
src
|
||||
(make-dynwind src winder expr unwinder)
|
||||
(make-call src unwinder '()))))))))
|
||||
|
||||
(hashq-set! *primitive-expand-table*
|
||||
'fluid-ref
|
||||
(case-lambda
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue