Changeset 635
- Timestamp:
- Mar 7, 2004, 12:03:30 AM (21 years ago)
- Location:
- trunk/ccl/compiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/compiler/nx0.lisp
r292 r635 44 44 (defvar *nx-cur-func-name* nil) 45 45 (defvar *nx-form-type* t) 46 (defvar *nx-nlexit-count* 0)47 (defvar *nx-event-checking-call-count* 0)48 46 ;(defvar *nx-proclaimed-inline* nil) 49 47 ;(defvar *nx-proclaimed-inline* (make-hash-table :size 400 :test #'eq)) … … 1068 1066 (*nx1-fcells* nil) 1069 1067 (*nx1-vcells* nil) 1070 (*nx-nlexit-count* 0)1071 1068 (*nx-inline-expansions* nil) 1072 (*nx-event-checking-call-count* 0)1073 1069 (*nx-parsing-lambda-decls* nil) 1074 1070 (*nx-next-method-var* (if q *nx-next-method-var*)) … … 1668 1664 `(,(if (eql spread-p 0) 'applyv 'apply) ,sym ,args) 1669 1665 `(funcall ,sym ,@args)))) 1670 (let* ((nlexits *nx-nlexit-count*) 1671 (val (nx1-call-form sym afunc args spread-p))) 1666 (let* ((val (nx1-call-form sym afunc args spread-p))) 1672 1667 (when afunc 1673 1668 (let ((callers (afunc-callers afunc)) … … 1675 1670 (unless (or (eq self afunc) (memq self callers)) 1676 1671 (setf (afunc-callers afunc) (cons self callers))))) 1677 (unless (neq nlexits *nx-nlexit-count*)1678 (setq *nx-event-checking-call-count* (%i+ *nx-event-checking-call-count* 1)))1679 1672 (if (and (null afunc) (memq sym *nx-never-tail-call*)) 1680 1673 (make-acode (%nx1-operator values) (list val)) … … 1696 1689 (let* ((stkforms nil) 1697 1690 (regforms nil) 1698 (nstkargs (%i- (length args) nregargs)) 1699 called 1700 exited 1701 calls 1702 exits) 1691 (nstkargs (%i- (length args) nregargs))) 1703 1692 (declare (fixnum nstkargs)) 1704 (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*)1705 (*nx-nlexit-count* *nx-nlexit-count*))1706 1693 (list 1707 (dotimes (i nstkargs stkforms)1694 (dotimes (i nstkargs (nreverse stkforms)) 1708 1695 (declare (fixnum i)) 1709 (setq calls *nx-event-checking-call-count*1710 exits *nx-nlexit-count*)1711 1696 (push (nx1-form (%car args)) stkforms) 1712 (unless called1713 (unless (eq exits (setq exits *nx-nlexit-count*))1714 (setq exited exits)))1715 (unless exited1716 (unless (eq calls (setq calls *nx-event-checking-call-count*))1717 (setq called calls)))1718 1697 (setq args (%cdr args))) 1719 1698 (dolist (arg args regforms) 1720 (push (nx1-form arg) regforms) 1721 (unless called 1722 (unless (eq exits (setq exits *nx-nlexit-count*)) 1723 (setq exited exits))) 1724 (unless exited 1725 (unless (eq calls (setq calls *nx-event-checking-call-count*)) 1726 (setq called calls)))))) 1727 (list (nreverse stkforms) regforms))) 1728 1729 ; Bind "event-checking-call" and "non-local-exit" counts, setq at most 1730 ; one of them to an incremented value (depending on which happened first.) 1731 (defun nx1-formlist (args &aux a exited called) 1732 (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*) 1733 (*nx-nlexit-count* *nx-nlexit-count*)) 1699 (push (nx1-form arg) regforms))))) 1700 1701 (defun nx1-formlist (args) 1702 (let* ((a nil)) 1734 1703 (dolist (arg args) 1735 (let ((calls *nx-event-checking-call-count*) 1736 (exits *nx-nlexit-count*)) 1737 (push (nx1-form arg) a) 1738 (unless called 1739 (unless (eq exits (setq exits *nx-nlexit-count*)) 1740 (setq exited exits))) 1741 (unless exited 1742 (unless (eq calls (setq calls *nx-event-checking-call-count*)) 1743 (setq called calls)))))) 1744 (if called 1745 (setq *nx-event-checking-call-count* called) 1746 (if exited 1747 (setq *nx-nlexit-count* exited))) 1748 (nreverse a)) 1704 (push (nx1-form arg) a)) 1705 (nreverse a))) 1749 1706 1750 1707 (defun nx1-verify-length (forms min max &aux (len (list-length forms))) -
trunk/ccl/compiler/nx1.lisp
r356 r635 401 401 402 402 (defnx1 nx1-throw (throw) (tag valuesform) 403 (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))404 403 (make-acode (%nx1-operator throw) (nx1-form tag) (nx1-form valuesform))) 405 404 … … 850 849 (return-from nx1-if (nx1-form `(progn ,test nil))) 851 850 (psetq test `(not ,test) true false false true))) 852 (let ((testform nil) 853 (trueform nil) 854 (falseform nil) 855 (called-in-test nil) 856 (called-in-true) 857 (called-in-false) 858 (exited nil)) 859 (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*) 860 (*nx-nlexit-count* *nx-nlexit-count*) 861 (calls *nx-event-checking-call-count*) 862 (exits *nx-nlexit-count*)) 863 (setq testform (nx1-form test)) 864 (if (neq calls (setq calls *nx-event-checking-call-count*)) 865 (setq called-in-test calls) 866 (if (neq exits (setq exits *nx-nlexit-count*)) 867 (setq exited exits))) 868 (setq trueform (nx1-form true)) 869 (unless (or called-in-test exited) 870 (if (neq calls (setq calls *nx-event-checking-call-count*)) 871 (setq called-in-true calls) 872 (if (neq exits (setq exits *nx-nlexit-count*)) 873 (setq exited exits)))) 874 (setq falseform (nx1-form false)) 875 (unless (or called-in-test exited) 876 (if (neq calls (setq calls *nx-event-checking-call-count*)) 877 (setq called-in-false calls) 878 (if (neq exits (setq exits *nx-nlexit-count*)) 879 (setq exited exits))))) 880 (if exited 881 (setq *nx-nlexit-count* exited) 882 (if (setq called-in-test (or called-in-test (and called-in-true called-in-false))) 883 (setq *nx-event-checking-call-count* called-in-test))) 884 (make-acode (%nx1-operator if) testform trueform falseform))) 851 (make-acode (%nx1-operator if) (nx1-form test) (nx1-form true) (nx1-form false))) 885 852 886 853 (defnx1 nx1-%debug-trap dbg (&optional arg) … … 1145 1112 (dolist (tag (setq newtags (nreverse newtags))) 1146 1113 (push tag *nx-tags*)) 1147 (let* ((body nil) 1148 (nlexit-count *nx-nlexit-count*) 1149 (call-count *nx-event-checking-call-count*)) 1114 (let* ((body nil)) 1150 1115 (dolist (form args (setq body (nreverse body))) 1151 1116 (push … … 1154 1119 (%rplaca (%cdr (%cdr (%cdr (%cdr info)))) t) 1155 1120 (cons (%nx1-operator tag-label) info)) 1156 (progn 1157 (setq form (nx1-form form)) 1158 ; These are supposed to just be hints - pass 2 can (theoretically) 1159 ; walk the acode itself ... 1160 (if (neq call-count (setq call-count *nx-event-checking-call-count*)) 1161 (setq form (make-acode (%nx1-operator embedded-call) form))) 1162 (if (neq nlexit-count (setq nlexit-count *nx-nlexit-count*)) 1163 (setq form (make-acode (%nx1-operator embedded-nlexit) form))) 1164 form)) 1121 (nx1-form form)) 1165 1122 body)) 1166 1123 (if (eq 0 (%car counter)) 1167 1124 (make-acode (%nx1-operator local-tagbody) newtags body) 1168 1125 (progn 1126 (nx-set-var-bits catchvar (logior (nx-var-bits catchvar) 1127 (%ilsl $vbitdynamicextent 1))) 1169 1128 (nx-inhibit-register-allocation) ; There are alternatives ... 1170 1129 (dolist (tag (reverse newtags)) … … 1176 1135 (%nx1-operator let*) 1177 1136 (list catchvar indexvar) 1178 (list *nx-nil**nx-nil*)1137 (list (make-acode (%nx1-operator cons) *nx-nil* *nx-nil*) *nx-nil*) 1179 1138 (make-acode 1180 1139 (%nx1-operator local-tagbody) … … 1189 1148 (make-acode 1190 1149 (%nx1-operator catch) 1191 (nx1-form `(setq ,(var-name catchvar) (%newgotag))) ;(make-acode (%nx1-operator newgotag))1150 (nx1-form (var-name catchvar)) 1192 1151 (make-acode 1193 1152 (%nx1-operator local-tagbody) … … 1208 1167 (let ((defnbackref (cdr (cdr (cdr (cdr info)))))) 1209 1168 (if (car defnbackref) 1210 (rplaca (cdr defnbackref) t) 1211 (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))) 1169 (rplaca (cdr defnbackref) t)) 1212 1170 (make-acode (%nx1-operator local-go) info)) 1213 1171 (progn 1214 (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1)) 1172 1215 1173 (make-acode 1216 1174 (%nx1-operator throw) (nx1-symbol (var-name (cadddr info))) (nx1-form closed)))))) … … 1298 1256 body) 1299 1257 (progn 1258 (nx-set-var-bits tagvar (%ilogior (%ilsl $vbitdynamicextent 1) tagbits)) 1300 1259 (nx-inhibit-register-allocation) ; Could also set $vbitnoreg in all setqed vars, or keep track better 1301 1260 (make-acode … … 1305 1264 (%nx1-operator let) 1306 1265 (list tagvar) 1307 (list (make-acode (%nx1-operator newblocktag)))1266 (list (make-acode (%nx1-operator cons) (nx1-form nil) (nx1-form nil))) 1308 1267 (make-acode 1309 1268 (%nx1-operator catch) 1310 ( list(%nx1-operator lexical-reference) tagvar)1269 (make-acode (%nx1-operator lexical-reference) tagvar) 1311 1270 body) 1312 1271 0))))))) … … 1317 1276 (unless info (nx-error "Can't RETURN-FROM block : ~S." blockname)) 1318 1277 (unless closed (nx-adjust-ref-count (cdr info))) 1319 (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))1320 1278 (make-acode 1321 1279 (if closed
Note:
See TracChangeset
for help on using the changeset viewer.
