Skip to content

Commit

Permalink
Merge pull request #29 from s-expressionists/fdefn-fixes
Browse files Browse the repository at this point in the history
Fdefn fixes
  • Loading branch information
Bike authored Sep 21, 2023
2 parents 833d66d + bf080c3 commit 18ffb79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
6 changes: 5 additions & 1 deletion BIR/disassemble.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@

(defgeneric disassemble-datum (datum))
(defmethod disassemble-datum ((value constant)) `',(constant-value value))
(defmethod disassemble-datum ((value function-cell))
`(function-cell ,(function-name value)))
(defmethod disassemble-datum ((value variable-cell))
`(variable-cell ,(variable-name value)))
(defmethod disassemble-datum ((value datum))
(or (gethash value *ids*)
(setf (gethash value *ids*)
Expand Down Expand Up @@ -157,7 +161,7 @@
(defmethod cleavir-bir-disassembler:disassemble ((module module))
(check-type module module)
(cleavir-bir-disassembler:with-disassembly ()
(list* (set:mapset 'list #'constant-value (constants module))
(list* (set:mapset 'list #'disassemble-datum (constants module))
(set:mapset 'list #'cleavir-bir-disassembler:disassemble
(functions module)))))

Expand Down
15 changes: 1 addition & 14 deletions BIR/verify.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,6 @@ If there are problems, a VERIFICATION-FAILED is signaled. If the verification pr
"has mismatch between inputs ~a and outputs ~a"
inst inputs outputs))

(defun collect-duplicates (list)
;; quadratic, but next lists are really short anyway
(loop with duplicates = nil
for (e . rest) on list
when (member e rest)
do (pushnew e duplicates)
finally (return duplicates)))

(defmethod verify progn ((instruction terminator))
;; No successor (verify type decl)
(test (null (successor instruction))
Expand All @@ -313,12 +305,7 @@ If there are problems, a VERIFICATION-FAILED is signaled. If the verification pr
(test (not (set:presentp (next instruction) *seen-next*))
"shares its next-list ~a"
instruction (next instruction))
(set:nadjoinf *seen-next* (next instruction)))
;; NEXT doesn't have any repeats other than maybe the normal
(let ((dupes (collect-duplicates (rest (next instruction)))))
(test (null dupes)
"has repeated elements in next-list ~a"
instruction dupes)))
(set:nadjoinf *seen-next* (next instruction))))

(defmethod verify progn ((instruction terminator0))
;; No NEXT (verify type decl)
Expand Down

0 comments on commit 18ffb79

Please sign in to comment.