0.9.17.8:
[sbcl.git] / src / runtime / x86-64-assem.S
index dbabd4d..6ea7d21 100644 (file)
@@ -17,6 +17,7 @@
 #include "validate.h"
 #include "sbcl.h"
 #include "genesis/closure.h"
+#include "genesis/funcallable-instance.h"
 #include "genesis/fdefn.h"
 #include "genesis/static-symbols.h"
 #include "genesis/symbol.h"
        .global GNAME(call_into_c)
        .type   GNAME(call_into_c),@function
 GNAME(call_into_c):
+        /* ABI requires that the direction flag be clear on function
+         * entry and exit. */
+        cld
+        
        push    %rbp            # Save old frame pointer.
        mov     %rsp,%rbp       # Establish new frame.
 
@@ -166,8 +171,9 @@ Lcall:
        
        /* If the function returned multiple values, it will return to
           this point.  Lose them */
+       jnc     LsingleValue    
        mov     %rbx, %rsp
-       /* A singled value function returns here */
+LsingleValue:  
 
 /* Restore the stack, in case there was a stack change. */
        pop     %rsp            # c-sp
@@ -179,6 +185,10 @@ Lcall:
        pop     %r12
        pop     %rbx
 
+        /* ABI requires that the direction flag be clear on function
+         * entry and exit. */
+        cld
+        
 /* FIXME Restore the NPX state. */
 
        /* return value is already in rax where lisp expects it */
@@ -274,6 +284,17 @@ GNAME(closure_tramp):
        jmp     *CLOSURE_FUN_OFFSET(%rax)
        .size   GNAME(closure_tramp), .-GNAME(closure_tramp)
 
+       .text
+       .align  align_8byte,0x90
+       .global GNAME(funcallable_instance_tramp)
+       .type   GNAME(funcallable_instance_tramp),@function
+GNAME(funcallable_instance_tramp):
+       mov     FUNCALLABLE_INSTANCE_FUNCTION_OFFSET(%rax),%rax
+       /* KLUDGE: on this platform, whatever kind of function is in %rax
+        * now, the first word of it contains the address to jump to. */
+       jmp     *CLOSURE_FUN_OFFSET(%rax)
+       .size   GNAME(funcallable_instance_tramp), .-GNAME(funcallable_instance_tramp)
+       
 /*
  * fun-end breakpoint magic
  */
@@ -282,11 +303,7 @@ GNAME(closure_tramp):
        .align  align_8byte
 GNAME(fun_end_breakpoint_guts):
        /* Multiple Value return */
-       jmp     multiple_value_return
-       /* the above jmp is only 2 bytes long, we need to add a nop for 
-        * padding since the single value return convention jumps to original
-        * return address + 3 bytes */
-       nop
+       jc      multiple_value_return
        /* Single value return: The eventual return will now use the
           multiple values return convention but with a return values
           count of one. */
@@ -384,5 +401,4 @@ Lend:
        ret
        .size   GNAME(fast_bzero), .-GNAME(fast_bzero)
 
-\f
         .end