From c3872caeeb1f468d17177f78347ca49c3ed215d6 Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Sun, 28 Oct 2018 12:46:37 +0530 Subject: [PATCH] Fix issues with byte-depth while compiling while forms. --- lisp/emacs-lisp/bytecomp.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 60b82d590a52..00d78870cd2a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4147,6 +4147,9 @@ that suppresses all warnings during execution of BODY." (byte-compile-maybe-guarded (list 'not clause) (byte-compile-body (cdr (cdr (cdr form))) byte-compile--for-effect)) (byte-compile-out-tag donetag)))) + ;; The JIT-IR version of if leaves a value on the stack, which is why we + ;; dont set byte-compile--for-effect to nil whenever IR compilation is + ;; enabled. (setq byte-compile--for-effect nil))) (defun byte-compile-cond-vars (obj1 obj2) @@ -4405,22 +4408,19 @@ Return a list of the form ((TEST . VAR) ((VALUE BODY) ...))" (byte-compile-out 'byte-br-if depth)) (defun byte-compile-ir-while (form) - (let ((byte-compile-depth byte-compile-depth)) - (byte-compile-form `(null ,(car (cdr form)))) - (byte-compile-ir-block - 'byte-block - 'byte-end - (byte-compile-ir-br-if 0) - (byte-compile-ir-block - 'byte-loop - 'byte-end - (let ((old-depth byte-compile-depth)) - (byte-compile-body (cdr (cdr form)) t) - (byte-compile-form (car (cdr form))) - (byte-compile-ir-br-if 0) - (cl-assert (>= byte-compile-depth old-depth)) - (when (> byte-compile-depth 0) - (byte-compile-discard (- byte-compile-depth old-depth) nil))))))) + (byte-compile-form `(null ,(car (cdr form)))) + (byte-compile-ir-block + 'byte-block + 'byte-end + (byte-compile-ir-br-if 0) + (byte-compile-ir-block + 'byte-loop + 'byte-end + (let ((old-depth byte-compile-depth)) + (byte-compile-body (cdr (cdr form)) t) + (cl-assert (= byte-compile-depth old-depth)) + (byte-compile-form (car (cdr form))) + (byte-compile-ir-br-if 0))))) (defun byte-compile-while (form) (if byte-compile-emit-ir