Re: Is Greenspun enough?

Duane Rettig wrote:
CL-USER(2): (disassemble 'foo)
;; disassembly of #<Function FOO>
;; formals: X Y
;; constant vector:
0: BAR

;; code start: #x1065c124:
   0: 55          pushl	ebp
   1: 8b ec       movl	ebp,esp
   3: 56          pushl	esi
   4: 83 ec 24   subl	esp,$36
   7: 8b 5e 12   movl	ebx,[esi+18]  ; BAR
  10: ff 57 27   call	*[edi+39]     ; SYS::TRAMP-TWO

Ah ok, so that does an indirect function call, ok. I think on most Intels this is slower than a direct inline-address call, but probably still faster than everything Java or ObjC (for instance) do. Similar to C++ calls.

I think it would be cool to use direct call instructions, and patch their target address on relocation, but that's probably much more complicated to do (and wouldn't allow sharing code between processes, or between similar functions as in your example below).

13: c9 leave
14: 8b 75 fc movl esi,[ebp-4]
17: c3 ret
CL-USER(3): (inspect #'foo)
A NEW #<Function FOO>
lambda-list: (X Y)
0 excl-type ----> Bit field: #x08
1 flags --------> Bit field: #x88
2 start --------> Bit field: #x1065c124
3 hash ---------> Bit field: #x000052a8
4 symdef -------> The symbol FOO
5 code ---------> short simple CODE vector (13) = #(35669 22252 60547 ...)
6 formals ------> (X Y), a proper list with 2 elements
7 cframe-size --> fixnum 0 [#x00000000]
8 immed-args ---> fixnum 0 [#x00000000]
9 locals -------> fixnum 0 [#x00000000]
10 <constant> ---> The symbol BAR
[1i] CL-USER(4):

While FOO is executing, a register always holds #'FOO in it so BAR
is always right there, as I said in my previous post, with no need
for indirection.

Ok, I thought that symbols had to be looked up, when they really are interned before everything else happens.

Thanks for the enlightenment.

Majority, n.: That quality that distinguishes a crime from a law.