cb1e9c623738
Add `dis`
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Sun, 07 Aug 2016 13:50:59 +0000 |
parents | c276ee07daac |
children | 5dda89e955a3 |
branches/tags | (none) |
files | losh.lisp package.lisp |
Changes
--- 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,