Commit 39605a34 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for

λ-lift candidates that end up not λ-lifted.
parent a9de04fa
2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
λ-lift candidates that end up not λ-lifted.
* emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
(cconv-mutated, cconv-captured): Remove.
(cconv-captured+mutated, cconv-lambda-candidates): Don't give them
......
;;; cconv.el --- Closure conversion for statically scoped Emacs lisp. -*- lexical-binding: t -*-
;;; cconv.el --- Closure conversion for statically scoped Emacs lisp. -*- lexical-binding: t; coding: utf-8 -*-
;; Copyright (C) 2011 Free Software Foundation, Inc.
......@@ -261,7 +261,8 @@ Returns a form where all lambdas don't have any free variables."
(eq (car (cadr value)) 'lambda)))
(assert (equal (cddr (cadr value))
(caar cconv-freevars-alist)))
(let* ((fv (cdr (pop cconv-freevars-alist)))
;; Peek at the freevars to decide whether to λ-lift.
(let* ((fv (cdr (car cconv-freevars-alist)))
(funargs (cadr (cadr value)))
(funcvars (append fv funargs))
(funcbodies (cddadr value)) ; function bodies
......@@ -269,10 +270,14 @@ Returns a form where all lambdas don't have any free variables."
; lambda lifting condition
(if (or (not fv) (< cconv-liftwhen (length funcvars)))
; do not lift
(cconv-closure-convert-rec
value emvrs fvrs envs lmenvs)
(cconv-closure-convert-rec
value emvrs fvrs envs lmenvs)
; lift
(progn
(setq cconv-freevars-alist
;; Now that we know we'll λ-lift, consume the
;; freevar data.
(cdr cconv-freevars-alist))
(dolist (elm2 funcbodies)
(push ; convert function bodies
(cconv-closure-convert-rec
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment