]> git.eshelyaron.com Git - emacs.git/commitdiff
fix comp-emit-cond-jump
authorAndrea Corallo <andrea_corallo@yahoo.it>
Sun, 21 Jul 2019 07:48:52 +0000 (09:48 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:55 +0000 (11:33 +0100)
lisp/emacs-lisp/comp.el

index 8b3c3d20629fd17f9d801c7f842f809a2c04f5f2..a3c2db4283fcb7d372c51e6fe743ef43b8195faf 100644 (file)
@@ -338,24 +338,24 @@ If DST-N is specified use it otherwise assume it to be the current slot."
     (comp-emit `(block ,block-name))
     (setf (comp-limplify-block-name comp-pass) block-name)))
 
-(defun comp-emit-cond-jump (discard-n lap-label negated)
+(defun comp-emit-cond-jump (target-offset lap-label negated)
   "Emit a conditional jump to LAP-LABEL.
-Discard DISCARD-N slots afterward.
+TARGET-OFFSET is the positive offset on the SP when branching to the target
+block.
 If NEGATED non nil negate the test condition."
-  (let ((bb (comp-new-block-sym))
-        (blocks (comp-func-blocks comp-func)))
+  (let ((blocks (comp-func-blocks comp-func))
+        (bb (comp-new-block-sym))) ;; Fall through block
     (puthash bb
-            (make-comp-block :sp (- (comp-sp) discard-n))
+            (make-comp-block :sp (comp-sp))
             blocks)
-    (progn
-      (let ((target (comp-lap-to-limple-bb lap-label)))
-        (comp-emit (if negated
-                      (list 'cond-jump (comp-slot-next) target bb)
-                    (list 'cond-jump (comp-slot-next) bb target)))
-        (puthash target
-                (make-comp-block :sp (comp-sp))
-                blocks)
-        (comp-mark-block-closed)))
+    (let ((target (comp-lap-to-limple-bb lap-label)))
+      (comp-emit (if negated
+                    (list 'cond-jump (comp-slot-next) target bb)
+                  (list 'cond-jump (comp-slot-next) bb target)))
+      (puthash target
+              (make-comp-block :sp (+ target-offset (comp-sp)))
+              blocks)
+      (comp-mark-block-closed))
     (comp-emit-block bb)))
 
 (defun comp-stack-adjust (n)