Commit 6c075cd7 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

Rewrite the cconv conversion algorithm, for clarity.

* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
new byte-code representation.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Rename from
cconv-closure-convert-function.
(cconv-convert): Rename from cconv-closure-convert-rec.
(cconv--analyse-use): Rename from cconv-analyse-use.
(cconv--analyse-function): Rename from cconv-analyse-function.
(cconv--analyse-use): Change some patterns to silence compiler.
(cconv-convert, cconv--convert-function): Rewrite.
* test/automated/lexbind-tests.el: New file.
parent 0d6459df
2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
* variables.texi (Scope): Mention the availability of lexical scoping.
(Lexical Binding): New node.
* eval.texi (Eval): Add `eval's new `lexical' arg.
2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
* vol2.texi (Top):
* vol1.texi (Top):
* objects.texi (Programming Types, Funvec Type, Type Predicates):
* functions.texi (Functions, What Is a Function, Function Currying):
* elisp.texi (Top): Remove mentions of funvec and curry.
;; Local Variables:
;; coding: utf-8
;; End:
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
* variables.texi (Scope): Mention the availability of lexical scoping.
(Lexical Binding): New node.
* eval.texi (Eval): Add `eval's new `lexical' arg.
2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
* vol2.texi (Top):
* vol1.texi (Top):
* objects.texi (Programming Types, Funvec Type, Type Predicates):
* functions.texi (Functions, What Is a Function, Function Currying):
* elisp.texi (Top): Remove mentions of funvec and curry.
;; Local Variables:
;; coding: utf-8
;; End:
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/cconv.el (cconv--convert-function): Rename from
cconv-closure-convert-function.
(cconv-convert): Rename from cconv-closure-convert-rec.
(cconv--analyse-use): Rename from cconv-analyse-use.
(cconv--analyse-function): Rename from cconv-analyse-function.
(cconv--analyse-use): Change some patterns to silence compiler.
(cconv-convert, cconv--convert-function): Rewrite.
* emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
new byte-code representation.
2011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
......
......@@ -287,8 +287,7 @@
;; old-style-byte-codes, but not mixed cases (not sure
;; about new-style into new-style).
(not lexical-binding)
(not (and (>= (length fn) 7)
(aref fn 6)))) ;6 = COMPILED_PUSH_ARGS
(not (integerp (aref fn 0)))) ;New lexical byte-code.
;; (message "Inlining %S byte-code" name)
(fetch-bytecode fn)
(let ((string (aref fn 1)))
......
This diff is collapsed.
2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
* automated/lexbind-tests.el: New file.
2011-03-05 Glenn Morris <rgm@gnu.org>
* eshell.el: Move here from lisp/eshell/esh-test.el.
......
;;; lexbind-tests.el --- Testing the lexbind byte-compiler
;; Copyright (C) 2011 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'ert)
(defconst lexbind-tests
`(
(let ((f #'car))
(let ((f (lambda (x) (cons (funcall f x) (cdr x)))))
(funcall f '(1 . 2))))
)
"List of expression for test.
Each element will be executed by interpreter and with
bytecompiled code, and their results compared.")
(defun lexbind-check-1 (pat)
"Return non-nil if PAT is the same whether directly evalled or compiled."
(let ((warning-minimum-log-level :emergency)
(byte-compile-warnings nil)
(v0 (condition-case nil
(eval pat t)
(error nil)))
(v1 (condition-case nil
(funcall (let ((lexical-binding t))
(byte-compile `(lambda nil ,pat))))
(error nil))))
(equal v0 v1)))
(put 'lexbind-check-1 'ert-explainer 'lexbind-explain-1)
(defun lexbind-explain-1 (pat)
(let ((v0 (condition-case nil
(eval pat t)
(error nil)))
(v1 (condition-case nil
(funcall (let ((lexical-binding t))
(byte-compile (list 'lambda nil pat))))
(error nil))))
(format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
pat v0 v1)))
(ert-deftest lexbind-tests ()
"Test the Emacs byte compiler lexbind handling."
(dolist (pat lexbind-tests)
(should (lexbind-check-1 pat))))
(provide 'lexbind-tests)
;;; lexbind-tests.el ends here
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