cmp: use correctly with-exit-label

Previusly we've duplicated some code with regard to this macro, most notably
we've bound *exit* separately to label instead of passing it as a first arg.
This commit is contained in:
Daniel Kochmański 2023-11-13 13:12:26 +01:00
parent 7541d813ea
commit 0041e7d8da
5 changed files with 23 additions and 35 deletions

View file

@ -93,6 +93,7 @@
(*max-temp* 0)
(*next-cfun* 0)
(*last-label* 0)
(*unwind-exit* nil)
(*inline-information*
(ext:if-let ((r (machine-inline-information *machine*)))
(si:copy-hash-table r)

View file

@ -101,12 +101,10 @@
(tail-recursion-possible)
(inline-possible (fun-name fun))
(= (length args) (length (rest *tail-recursion-info*))))
(let* ((*destination* 'TRASH)
(*exit* (next-label))
(*unwind-exit* (cons *exit* *unwind-exit*)))
(c2psetq nil ;; We do not provide any C2FORM
(cdr *tail-recursion-info*) args)
(wt-label *exit*))
(with-exit-label (*exit*)
(let ((*destination* 'TRASH))
;; We do not provide any C2FORM.
(c2psetq nil (cdr *tail-recursion-info*) args)))
(unwind-no-exit 'TAIL-RECURSION-MARK)
(wt-nl "goto TTL;")
(cmpdebug "Tail-recursive call of ~s was replaced by iteration."

View file

@ -164,9 +164,8 @@
(wt-nl "if (__ecl_frs_push_result) {")
(wt-comment "BEGIN CATCH ~A" code)
(with-indentation
(with-exit-label (label)
(let ((*exit* label))
(unwind-exit 'VALUES))))
(with-exit-label (*exit*)
(unwind-exit 'VALUES)))
(wt-nl "} else {")
(with-indentation
(c2expr* body)))))

View file

@ -26,12 +26,10 @@
;; other expressions will follow this one. We must thus create
;; a possible label so that the compiled forms exit right at
;; the point where the next form will be compiled.
(with-exit-label (label)
(let* ((*exit* label)
(*unwind-exit* (cons *exit* *unwind-exit*))
;;(*lex* *lex*)
(*lcl* *lcl*)
(*temp* *temp*))
(with-exit-label (*exit*)
(let (;;(*lex* *lex*)
(*lcl* *lcl*)
(*temp* *temp*))
(c2expr form))))
(defun c2progn (c1form forms)

View file

@ -245,35 +245,27 @@
(defun t2ordinary (c1form form)
(declare (ignore c1form))
(let* ((*exit* (next-label))
(*unwind-exit* (list *exit*))
(*destination* 'TRASH))
(c2expr form)
(wt-label *exit*)))
(with-exit-label (*exit*)
(let ((*destination* 'TRASH))
(c2expr form))))
(defun t2load-time-value (c1form vv-loc form)
(declare (ignore c1form))
(let* ((*exit* (next-label))
(*unwind-exit* (list *exit*))
(*destination* vv-loc))
(c2expr form)
(wt-label *exit*)))
(with-exit-label (*exit*)
(let ((*destination* vv-loc))
(c2expr form))))
(defun t2make-form (c1form vv-loc form)
(declare (ignore c1form))
(let* ((*exit* (next-label))
(*unwind-exit* (list *exit*))
(*destination* vv-loc))
(c2expr form)
(wt-label *exit*)))
(with-exit-label (*exit*)
(let ((*destination* vv-loc))
(c2expr form))))
(defun t2init-form (c1form vv-loc form)
(declare (ignore c1form vv-loc))
(let* ((*exit* (next-label))
(*unwind-exit* (list *exit*))
(*destination* 'TRASH))
(c2expr form)
(wt-label *exit*)))
(with-exit-label (*exit*)
(let ((*destination* 'TRASH))
(c2expr form))))
(defun locative-type-from-var-kind (kind)
(cdr (assoc kind