Index: /branches/ia32/lisp-kernel/x86-spentry32.s
===================================================================
--- /branches/ia32/lisp-kernel/x86-spentry32.s	(revision 9689)
+++ /branches/ia32/lisp-kernel/x86-spentry32.s	(revision 9690)
@@ -2776,207 +2776,221 @@
 /* %arg_reg is %temp1, key vector in %arg_y */ 
 _startfn(C(destbind1))
-	__(uuo_error_debug_trap)
-dnl 	/* Save entry %esp in case of error   */
-dnl 	__(movd %esp,%mm0)
-dnl 	/* Save arg count word */
-dnl 	__(movd %imm0,%mm1)
-dnl 	/* Extract required arg count.   */
-dnl         __(testb %imm0_b,%imm0_b)
-dnl 	__(je local_label(opt))		/* skip if no required args   */
-dnl 	__(movzbl %imm0_b,%imm0)
-dnl local_label(req_loop):	
-dnl 	__(compare_reg_to_nil(%arg_reg))
-dnl 	__(je local_label(toofew))
-dnl 	__(movb $fulltagmask,%imm0_bh)
-dnl 	__(andb %arg_reg_b,%imm0_bh)
-dnl 	__(cmpb $fulltag_cons,%imm0_bh)
-dnl 	__(jne local_label(badlist))
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(pushl cons.car(%arg_reg))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(jne local_label(req_loop))
-dnl 	__(movd %mm1,%imm0)
-dnl local_label(opt):
-dnl 	__(movzbl %imm0_bh,%imm0)
-dnl 	__(test %imm0,%imm0)
-dnl 	__(je local_label(rest_keys))
-dnl 	__(btl $initopt_bit,%imm0)
-dnl 	__(jc local_label(opt_supp))
-dnl 	/* 'simple' &optionals:	 no supplied-p, default to nil.   */
-dnl local_label(simple_opt_loop):
-dnl 	__(compare_reg_to_nil(%arg_reg))
-dnl 	__(je local_label(default_simple_opt))
-dnl 	__(movb $fulltagmask,%imm0_bh)
-dnl 	__(andb %arg_reg_b,%imm0_bh)
-dnl 	__(cmpb $fulltag_cons,%imm0_bh)
-dnl 	__(jne local_label(badlist))
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(pushl cons.car(%arg_reg))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(jne local_label(simple_opt_loop))
-dnl 	__(jmp local_label(rest_keys))
-dnl local_label(default_simple_opt):
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(pushl $nil_value)
-dnl 	__(jne local_label(default_simple_opt))
-dnl 	__(jmp local_label(rest_keys))
-dnl local_label(opt_supp):
-dnl 	__(movb $fulltagmask,%imm0_bh)
-dnl 	__(andb %arg_reg_b,%imm0_bh)
-dnl 	__(compare_reg_to_nil(%arg_z))
-dnl 	__(je local_label(default_hard_opt))
-dnl 	__(cmpb $fulltag_cons,%imm0_bh)
-dnl 	__(jne local_label(badlist))
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(pushl cons.car(%arg_reg))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(push $t_value)
-dnl 	__(jne local_label(opt_supp))
-dnl 	__(jmp local_label(rest_keys))
-dnl local_label(default_hard_opt):
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(push $nil_value)
-dnl 	__(push $nil_value)
-dnl 	__(jne local_label(default_hard_opt))
-dnl local_label(rest_keys):	
-dnl 	__(btl $restp_bit,%imm0)
-dnl 	__(jc local_label(have_rest))
-dnl 	__(btl $keyp_bit,%imm0)
-dnl 	__(jc local_label(have_keys))
-dnl 	__(compare_reg_to_nil(%arg_reg))
-dnl 	__(jne local_label(toomany))
-dnl 	__(movss %fpzero,%rcontext:tcr.save0)
-dnl 	__(jmp *%ra0)
-dnl local_label(have_rest):
-dnl 	__(pushl %arg_reg)
-dnl 	__(btl $keyp_bit,%imm0)
-dnl 	__(jc local_label(have_keys))
-dnl 	__(movss %fpzero,%rcontext:tcr.save0)
-dnl 	__(jmp *%ra0)
-dnl 	/* Ensure that arg_reg contains a proper,even-length list.  */
-dnl 	/* Insist that its length is <= 512 (as a cheap circularity check.)   */
-dnl local_label(have_keys):
-dnl 	__(movl $256,%imm0)
-dnl 	__(push %arg_reg)
-dnl 	__(push %arg_z)
-dnl 	__(xorl %arg_z,%arg_z)
-dnl local_label(count_keys_loop):
-dnl 	__(compare_reg_to_nil(%arg_reg))
-dnl 	__(je local_label(counted_keys))
-dnl 	__(subl $1,%imm0)
-dnl 	__(jl local_label(toomany))
-dnl 	__(movb $fulltag_mask,%arg_z_bh)
-dnl 	__(andb %arg_reg_b,%arg_z_bh)
-dnl  	__(cmpb $fulltag_cons,%arg_z_bh)
-dnl 	__(jne local_label(badlist))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(movb $fulltag_mask,%arg_z_bh)
-dnl 	__(andb %arg_reg_b,%arg_z_bh)
-dnl 	__(cmpb $fulltag_cons,%arg_z_bh)
-dnl 	__(jne local_label(badlist))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(jmp local_label(count_keys_loop))
-dnl local_label(counted_keys):		
-dnl 	/* We've got a proper, even-length list of key/value pairs in  */
-dnl 	/* arg_reg. For each keyword var in the lambda-list, push a pair  */
-dnl 	/* of NILs on the vstack.   */
-dnl 	__(pop %arg_z)
-dnl 	__(pop %arg_reg)
-dnl 	__(movd %mm1,%imm0)
-dnl 	__(shrl $16,%imm0)
-dnl 	__(movzbl %imm0_b,%imm0)
-dnl 	__(movl %esp,%rcontext:tcr.unboxed0)	/* 0th value/supplied-p pair */
-dnl 	__(jmp local_label(push_pair_test))
-dnl local_label(push_pair_loop):
-dnl 	__(push $nil_value)
-dnl 	__(push $nil_value)
-dnl local_label(push_pair_test):	
-dnl 	__(subb $1,%imm0_b)
-dnl 	__(jge local_label(push_pair_loop))
-dnl 	__(push %temp0)	/* keyword */
-dnl 	__(push %arg_z) /* value */
-dnl 	__(vector_length(%arg_y,%imm0))
-dnl 	__(push %arg_reg)
-dnl 	__(push %imm0)	/* keyword vector length */
-dnl 	__(movl $0,%rcontext:tcr.unboxed1) /* count of unknown keywords seen */
-dnl local_label(match_keys_loop):
-dnl 	__(movl 4(%esp),%arg_reg)
-dnl 	__(compare_reg_to_nil(%arg_reg))
-dnl 	__(je local_label(matched_keys))
-dnl 	__(_car(%arg_reg,%temp0))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(_car(%arg_reg,%arg_z))
-dnl 	__(_cdr(%arg_reg,%arg_reg))
-dnl 	__(movl %arg_reg,4(%esp))
-dnl 	__(xorl %temp1,%temp1)
-dnl 	__(jmp local_label(match_test))
-dnl local_label(match_loop):
-dnl 	__(cmpl misc_data_offset(%arg_y,%temp1),%arg_z)
-dnl 	__(je local_label(matched))
-dnl 	__(addl $node_size,%temp1)
-dnl local_label(match_test):
-dnl 	__(cmpl %temp1,(%esp))	/* compare index, keyword vector length */
-dnl 	__(jne local_label(match_loop))
-dnl 	/* No match.  Note unknown keyword, check for :allow-other-keys   */
-dnl 	__(addl $1,%rcontext:tcr.unboxed1)
-dnl 	__(cmpl $nrs.kallowotherkeys,%temp0)
-dnl 	__(jne local_label(match_keys_loop))
-dnl 	__(subl $1,%rcontext:tcr.unboxed1)
-dnl 	__(btsl $seen_aok_bit,%imm0)
-dnl 	__(jc local_label(match_keys_loop))
-dnl 	/* First time we've seen :allow-other-keys.  Maybe set aok_bit.   */
-dnl 	__(compare_reg_to_nil(%arg_z))
-dnl 	__(je local_label(match_keys_loop))
-dnl 	__(btsl $aok_bit,%imm0)
-dnl 	__(jmp local_label(match_keys_loop))
-dnl 	/* Got a match.  Worry about :allow-other-keys here, too.   */
-dnl local_label(matched):
-dnl 	__(negl %temp1)
-dnl 	__(shll $1,%temp1)
-dnl 	__(addl %rcontext:tcr.unboxed0,%temp1)
-dnl 	__(cmpl $nil_value,-node_size*2(%temp1))
-dnl 	__(jne local_label(match_keys_loop))
-dnl 	__(movl %arg_z,-node_size(%temp1))
-dnl 	__(movl $t_value,-node_size*2(%temp1))
-dnl 	__(cmpl $nrs.kallowotherkeys,%temp0)
-dnl 	__(jne local_label(match_keys_loop))
-dnl 	__(btsl $seen_aok_bit,%imm0)
-dnl 	__(jnc local_label(match_keys_loop))
-dnl 	__(compare_reg_to_nil(%arg_z))
-dnl 	__(je local_label(match_keys_loop))
-dnl 	__(btsl $aok_bit,%imm0)
-dnl 	__(jmp local_label(match_keys_loop))
-dnl local_label(matched_keys):	
-dnl 	__(cmpl $0,%rcontext:tcr.unboxed1)	/* any unknown keys seen? */
-dnl 	__(je local_label(keys_ok))
-dnl 	__(btl $aok_bit,%imm0)
-dnl 	__(jnc local_label(badkeys))
-dnl local_label(keys_ok):	
-dnl 	__(movss %fpzero,%rcontext:tcr.save0)
-dnl 	__(jmp *%ra0)
-dnl 	/* Some unrecognized keywords.  Complain generically about   */
-dnl 	/* invalid keywords.   */
-dnl local_label(badkeys):
-dnl 	__(movl $XBADKEYS,%arg_y)
-dnl 	__(jmp local_label(destructure_error))
-dnl local_label(toomany):
-dnl 	__(movl $XCALLTOOMANY,%arg_y)
-dnl 	__(jmp local_label(destructure_error))
-dnl local_label(toofew):
-dnl 	__(movl $XCALLTOOFEW,%arg_y)
-dnl 	__(jmp local_label(destructure_error))
-dnl local_label(badlist):
-dnl 	__(movl $XCALLNOMATCH,%arg_y)
-dnl local_label(destructure_error):
-dnl 	__(movd %mm0,%esp)		/* undo everything done to the stack */
-dnl 	__(movl %rcontext:tcr.save0,%arg_z)	/* %whole_reg */
-dnl 	__(movss %fpzero,%rcontext:tcr.save0)
-dnl 	__(set_nargs(2))
-dnl     __(push %ra0)
-dnl 	__(jmp _SPksignalerr)
+	__(movl %ra0,%rcontext:tcr.save1)
+	/* Save entry %esp in case of error   */
+	__(movd %esp,%mm0)
+	/* Save arg count word */
+	__(movd %imm0,%mm1)
+	/* Extract required arg count.   */
+        __(testb %imm0_b,%imm0_b)
+	__(je local_label(opt))		/* skip if no required args   */
+	__(movzbl %imm0_b,%imm0)
+local_label(req_loop):	
+	__(compare_reg_to_nil(%arg_reg))
+	__(je local_label(toofew))
+	__(movb $fulltagmask,%imm0_bh)
+	__(andb %arg_reg_b,%imm0_bh)
+	__(cmpb $fulltag_cons,%imm0_bh)
+	__(jne local_label(badlist))
+	__(subb $1,%imm0_b)
+	__(pushl cons.car(%arg_reg))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(jne local_label(req_loop))
+	__(movd %mm1,%imm0)
+local_label(opt):
+	__(testb %imm0_bh,%imm0_bh)
+	__(je local_label(rest_keys))
+	__(btl $initopt_bit,%imm0)
+	__(jc local_label(opt_supp))
+	/* 'simple' &optionals:	 no supplied-p, default to nil.   */
+local_label(simple_opt_loop):
+	__(compare_reg_to_nil(%arg_reg))
+	__(je local_label(default_simple_opt))
+	__(movb $fulltagmask,%imm0_bh)
+	__(andb %arg_reg_b,%imm0_bh)
+	__(cmpb $fulltag_cons,%imm0_bh)
+	__(jne local_label(badlist))
+	__(subb $1,%imm0_b)
+	__(pushl cons.car(%arg_reg))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(jne local_label(simple_opt_loop))
+	__(jmp local_label(rest_keys))
+local_label(default_simple_opt):
+	__(subb $1,%imm0_b)
+	__(pushl $nil_value)
+	__(jne local_label(default_simple_opt))
+	__(jmp local_label(rest_keys))
+local_label(opt_supp):
+	__(movb $fulltagmask,%imm0_bh)
+	__(andb %arg_reg_b,%imm0_bh)
+	__(compare_reg_to_nil(%arg_z))
+	__(je local_label(default_hard_opt))
+	__(cmpb $fulltag_cons,%imm0_bh)
+	__(jne local_label(badlist))
+	__(subb $1,%imm0_b)
+	__(pushl cons.car(%arg_reg))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(push $t_value)
+	__(jne local_label(opt_supp))
+	__(jmp local_label(rest_keys))
+local_label(default_hard_opt):
+	__(subb $1,%imm0_b)
+	__(push $nil_value)
+	__(push $nil_value)
+	__(jne local_label(default_hard_opt))
+local_label(rest_keys):	
+	__(btl $restp_bit,%imm0)
+	__(jc local_label(have_rest))
+	__(btl $keyp_bit,%imm0)
+	__(jc local_label(have_keys))
+	__(compare_reg_to_nil(%arg_reg))
+	__(jne local_label(toomany))
+	__(movss %fpzero,%rcontext:tcr.save0)
+	__(jmp *%ra0)
+local_label(have_rest):
+	__(pushl %arg_reg)
+	__(btl $keyp_bit,%imm0)
+	__(jc local_label(have_keys))
+	__(movss %fpzero,%rcontext:tcr.save0)
+	__(jmp *%ra0)
+	/* Ensure that arg_reg contains a proper,even-length list.  */
+	/* Insist that its length is <= 512 (as a cheap circularity check.)   */
+local_label(have_keys):
+	__(movb $255,%imm0_b)
+	__(push %arg_reg)
+	__(push %arg_z)
+	__(xorl %arg_z,%arg_z)
+local_label(count_keys_loop):
+	__(compare_reg_to_nil(%arg_reg))
+	__(je local_label(counted_keys))
+	__(subb $1,%imm0_b)
+	__(jb local_label(toomany))
+	__(movb $fulltagmask,%arg_z_bh)
+	__(andb %arg_reg_b,%arg_z_bh)
+ 	__(cmpb $fulltag_cons,%arg_z_bh)
+	__(jne local_label(badlist))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(movb $fulltagmask,%arg_z_bh)
+	__(andb %arg_reg_b,%arg_z_bh)
+	__(cmpb $fulltag_cons,%arg_z_bh)
+	__(jne local_label(badlist))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(jmp local_label(count_keys_loop))
+local_label(counted_keys):		
+	/* We've got a proper, even-length list of key/value pairs in  */
+	/* arg_reg. For each keyword var in the lambda-list, push a pair  */
+	/* of NILs on the vstack.   */
+	__(pop %arg_z)
+	__(pop %arg_reg)
+	__(movd %mm1,%imm0)
+	__(shrl $16,%imm0)
+	__(movzbl %imm0_b,%imm0)
+	__(movl %esp,%rcontext:tcr.unboxed0)	/* 0th value/supplied-p pair */
+	__(jmp local_label(push_pair_test))
+local_label(push_pair_loop):
+	__(push $nil_value)
+	__(push $nil_value)
+local_label(push_pair_test):	
+	__(subb $1,%imm0_b)
+	__(jge local_label(push_pair_loop))
+	__(push %temp0)	/* keyword */
+	__(push %arg_z) /* value */
+	__(vector_length(%arg_y,%imm0))
+	__(push %arg_reg)
+	__(push %imm0)	/* keyword vector length */
+	__(movd %mm1,%imm0)
+	__(movl $0,%rcontext:tcr.unboxed1) /* count of unknown keywords seen */
+local_label(match_keys_loop):
+	__(movl 4(%esp),%arg_reg)
+	__(compare_reg_to_nil(%arg_reg))
+	__(je local_label(matched_keys))
+	__(_car(%arg_reg,%temp0))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(_car(%arg_reg,%arg_z))
+	__(_cdr(%arg_reg,%arg_reg))
+	__(movl %arg_reg,4(%esp))
+	__(xorl %temp1,%temp1)
+	__(jmp local_label(match_test))
+local_label(match_loop):
+	__(cmpl misc_data_offset(%arg_y,%temp1),%arg_z)
+	__(je local_label(matched))
+	__(addl $node_size,%temp1)
+local_label(match_test):
+	__(cmpl %temp1,(%esp))	/* compare index, keyword vector length */
+	__(jne local_label(match_loop))
+	/* No match.  Note unknown keyword, check for :allow-other-keys   */
+	__(addl $1,%rcontext:tcr.unboxed1)
+	__(cmpl $nrs.kallowotherkeys,%temp0)
+	__(jne local_label(match_keys_loop))
+	__(subl $1,%rcontext:tcr.unboxed1)
+	__(btsl $seen_aok_bit,%imm0)
+	__(jc local_label(match_keys_loop))
+	/* First time we've seen :allow-other-keys.  Maybe set aok_bit.   */
+	__(compare_reg_to_nil(%arg_z))
+	__(je local_label(match_keys_loop))
+	__(btsl $aok_bit,%imm0)
+	__(jmp local_label(match_keys_loop))
+	/* Got a match.  Worry about :allow-other-keys here, too.   */
+local_label(matched):
+	__(negl %temp1)
+	__(shll $1,%temp1)
+	__(addl %rcontext:tcr.unboxed0,%temp1)
+	__(cmpl $nil_value,-node_size*2(%temp1))
+	__(jne local_label(match_keys_loop))
+	__(movl %arg_z,-node_size(%temp1))
+	__(movl $t_value,-node_size*2(%temp1))
+	__(cmpl $nrs.kallowotherkeys,%temp0)
+	__(jne local_label(match_keys_loop))
+	__(btsl $seen_aok_bit,%imm0)
+	__(jnc local_label(match_keys_loop))
+	__(compare_reg_to_nil(%arg_z))
+	__(je local_label(match_keys_loop))
+	__(btsl $aok_bit,%imm0)
+	__(jmp local_label(match_keys_loop))
+local_label(matched_keys):	
+	__(cmpl $0,%rcontext:tcr.unboxed1)	/* any unknown keys seen? */
+	__(je local_label(keys_ok))
+	__(btl $aok_bit,%imm0)
+	__(jnc local_label(badkeys))
+local_label(keys_ok):
+	__(addl $(3*node_size),%esp)
+	__(pop %ra0)
+	__(movss %fpzero,%rcontext:tcr.save0)
+	__(jmp *%ra0)
+	/* Some unrecognized keywords.  Complain generically about   */
+	/* invalid keywords.   */
+local_label(badkeys):
+	__(movl $XBADKEYS,%arg_y)
+	__(jmp local_label(destructure_error))
+local_label(toomany):
+	__(movl $XCALLTOOMANY,%arg_y)
+	__(jmp local_label(destructure_error))
+local_label(toofew):
+	__(movl $XCALLTOOFEW,%arg_y)
+	__(jmp local_label(destructure_error))
+local_label(badlist):
+	__(movl $XCALLNOMATCH,%arg_y)
+local_label(destructure_error):
+	__(movd %mm0,%esp)		/* undo everything done to the stack */
+	__(movl %rcontext:tcr.save0,%arg_z)	/* %whole_reg */
+	__(movss %fpzero,%rcontext:tcr.save0)
+	__(set_nargs(2))
+	__(push %ra0)
+	__(jmp _SPksignalerr)
 _endfn(C(destbind1))
 
 _spentry(macro_bind)
-	__(int $3)
+	__(movl %arg_reg,%rcontext:tcr.save0)	/* %whole_reg */
+	__(extract_fulltag(%arg_reg,%imm0))
+	__(cmpb $fulltag_cons,%imm0_b)
+	__(jne 1f)
+	__(_cdr(%arg_reg,%arg_reg))
+	__(jmp C(destbind1))
+1:	__(movl $XCALLNOMATCH,%arg_y)
+	__(movl %rcontext:tcr.save0,%arg_z)
+	__(movss %fpzero,%rcontext:tcr.save0)
+	__(set_nargs(2))
+        __(push %ra0)        
+	__(jmp _SPksignalerr)
+
 _endsubp(macro_bind)
 
