Index: /branches/working-0711/ccl/lisp-kernel/x86-spentry64.s
===================================================================
--- /branches/working-0711/ccl/lisp-kernel/x86-spentry64.s	(revision 7894)
+++ /branches/working-0711/ccl/lisp-kernel/x86-spentry64.s	(revision 7895)
@@ -2244,5 +2244,20 @@
 	/* (in %imm1), copy all pairs to the temp stack   */
 local_label(even):
-	__(lea tsp_frame.fixed_overhead(%imm1),%arg_z)
+	/* Get the keyword vector into arg_x, and its length into arg_y.  */
+	__(movl function_data_offset(%fn),%imm0_l)
+	__(movq function_data_offset(%fn,%imm0,node_size),%arg_x)
+	__(vector_length(%arg_x,%arg_y))
+        __(testq %arg_y,%arg_y)
+        __(jne 1f)
+        __(btq $keyword_flags_aok_bit,%temp1)
+        __(jnc 1f)
+
+        __(btq $keyword_flags_rest_bit,%temp1)
+        __(jc 0f)
+        __(addq %imm1,%rsp)
+0:      
+        __(jmp *%ra0)
+1:      
+       	__(lea tsp_frame.fixed_overhead(%imm1),%arg_z)
 	__(TSP_Alloc_Var(%arg_z,%imm0))
 2:	__(subq $node_size,%arg_z)
@@ -2250,9 +2265,5 @@
 	__(cmpq %arg_z,%imm0)
 	__(jne 2b)
-	/* Get the keyword vector into arg_x, and its length into arg_y.  */
 	/* Push arg_y pairs of NILs.   */
-	__(movl function_data_offset(%fn),%imm0_l)
-	__(movq function_data_offset(%fn,%imm0,node_size),%arg_x)
-	__(vector_length(%arg_x,%arg_y))
 	__(movq %arg_y,%imm0)
 	__(jmp 4f)
