From: Paul K. <pk...@gm...> - 2007-09-05 14:40:19
|
If I compile this reduced test case: (defun test-case (x) (labels ((inner () (values 1 0))) (if x (inner) (multiple-value-bind (a b) (inner) (values b a))))) (test-case t) => 1, 0 (test-case nil) => 0, 0 A disassembly of the function (at (speed 3) and (safety 0) to make it more readable for me) reveals this: ; 031412BC: 4881FA17001020 CMP RDX, 537919511 ; no-arg-parsing entry point ; 2C3: 752F JNE L0 ; 2C5: 488BC5 MOV RAX, RBP ; 2C8: 488BCC MOV RCX, RSP ; 2CB: 4883EC40 SUB RSP, 64 ; 2CF: 488941F8 MOV [RCX-8], RAX ; 2D3: 488BE9 MOV RBP, RCX ; 2D6: 488D0506000000 LEA RAX, [RIP+6] ; 2DD: 488945F0 MOV [RBP-16], RAX ; 2E1: EB11 JMP L0 ; 2E3: 488BCB MOV RCX, RBX ; 2E6: 488BD9 MOV RBX, RCX ; 2E9: 488D65F0 LEA RSP, [RBP-16] ; 2ED: 488B6DF8 MOV RBP, [RBP-8] ; 2F1: C20800 RET 8 ; 2F4: L0: B908000000 MOV ECX, 8 ; no-arg-parsing entry point ; 2F9: 31DB XOR EBX, EBX ; 2FB: 488D65F0 LEA RSP, [RBP-16] ; 2FF: 488B6DF8 MOV RBP, [RBP-8] ; 303: C20800 RET 8 Note the code at 2E3 and 2E6, which seems like a really bad way to exchange the contents of 2 registers :) Paul Khuong |