Re: Lisp object code versus that of other languages
- From: Juho Snellman <jsnell@xxxxxx>
- Date: 31 Aug 2005 09:18:31 GMT
<j_mckitrick@xxxxxxxxxxx> wrote:
> I've recently gone from Lisp (back) to assembly language to do some
> 'fun' stuff I haven't done in a long time. I've been looking at a few
> samples of Lisp object code (disassemble in sbcl) and found some pretty
> cryptic code.
Since the SBCL code generator basically works by concatenating
assembly templates, and currently doesn't do much post-processing
(like instruction scheduling or peephole optimizing) on the result, I
usually find it more understandable than what an optimizing C compiler
produces. Your mileage may vary.
If some code seems cryptic, you might find the SBCL-specific
:TRACE-FILE keyword to COMPILE-FILE useful. For example (compile-file
"foo.lisp" :trace-file t) will produce a file "foo.trace" that
contains representations of the code in the two intermediate languages
that the compiler uses internally. There's also an annotated
disassembly that shows which intermediate language instructions are
producing the assembly instructions. Like this:
L23:
VOP ALLOCATE-FULL-CALL-FRAME {5} => t32[RBX]
MOV #<TN t32[RBX]>, #<TN t22[RSP]>
SUB #<TN t22[RSP]>, 40
VOP MOVE-ARG 'MOOSE!33[Const7]>t34[RDX] t32[RBX] => t35[RDX]
MOV #<TN t34[RDX]>, #<TN 'MOOSE!33[Const7]>
VOP MOVE-ARG t36[Const6]>t37[RDI] t32[RBX] => t38[RDI]
MOV #<TN t37[RDI]>, #<TN t36[Const6]>
--
Juho Snellman
"Premature profiling is the root of all evil."
.
- References:
- Lisp object code versus that of other languages
- From: jonathon
- Lisp object code versus that of other languages
- Prev by Date: Re: Lisp object code versus that of other languages
- Next by Date: How to Easily Specify Export Symbol
- Previous by thread: Re: Lisp object code versus that of other languages
- Next by thread: Re: Lisp object code versus that of other languages
- Index(es):
Relevant Pages
|