# HG changeset patch # User Steve Losh # Date 1470577859 0 # Node ID cb1e9c6237384ed7a889df049f388598c539a61e # Parent c276ee07daacedac99237bd142b006d7f7f63734 Add `dis` diff -r c276ee07daac -r cb1e9c623738 losh.lisp --- a/losh.lisp Sat Aug 06 00:01:39 2016 +0000 +++ b/losh.lisp Sun Aug 07 13:50:59 2016 +0000 @@ -387,6 +387,7 @@ (elt ,source ,i) (terminate)))))))) + ;;;; Hash Sets (defclass hash-set () ((data :initarg :data))) @@ -461,6 +462,21 @@ (values)) +(defmacro dis (arglist &body body) + "Disassemble the code generated for a `lambda` with `arglist` and `body`. + + It will also spew compiler notes so you can see why the garbage box isn't + doing what you think it should be doing. + + " + `(->> '(lambda ,arglist + (declare (optimize speed)) + ,@body) + (compile nil) + #+sbcl sb-disassem:disassemble-code-component + #-sbcl disassemble)) + + ;;;; File IO (defun slurp (path) "Sucks up an entire file from PATH into a freshly-allocated string, diff -r c276ee07daac -r cb1e9c623738 package.lisp --- a/package.lisp Sat Aug 06 00:01:39 2016 +0000 +++ b/package.lisp Sun Aug 07 13:50:59 2016 +0000 @@ -69,6 +69,7 @@ #:pr #:bits + #:dis #:slurp #:spit