Index: /branches/arm/compiler/ARM/arm-vinsns.lisp
===================================================================
--- /branches/arm/compiler/ARM/arm-vinsns.lisp	(revision 13857)
+++ /branches/arm/compiler/ARM/arm-vinsns.lisp	(revision 13858)
@@ -2836,14 +2836,14 @@
       (other-temp :imm)))
   ((:pred >= min-fixed $numarmargregs)
-   (stm (:! vsp) (arg_z arg_y arg_x)))
+   (stmdb (:! vsp) (arg_z arg_y arg_x)))
   ((:pred = min-fixed 2)                ; at least 2 args
    (cmp nargs (:$ (ash 2 arm::word-shift)))
    (strne arg_x (:@! vsp (:$ -4)))
-   (stm (:! vsp) (arg_z arg_y)))
+   (stmdb (:! vsp) (arg_z arg_y)))
   ((:pred = min-fixed 1)                ; at least one arg
    (cmp nargs (:$ (ash 2 arm::word-shift)))
    (strlo arg_z (:@! vsp (:$ (- arm::node-size))))
-   (stmeq (:! vsp) (arg_z arg_y))
-   (stmhi (:! vsp) (arg_z arg_y arg_x)))
+   (stmdbeq (:! vsp) (arg_z arg_y))
+   (stmdbhi (:! vsp) (arg_z arg_y arg_x)))
   ((:pred = min-fixed 0)
    (cmp nargs (:$ 0))
@@ -2851,6 +2851,6 @@
    (cmp nargs (:$ (ash 2 arm::word-shift)))
    (strlo arg_z (:@! vsp (:$ (- arm::node-size))))
-   (stmeq (:! vsp) (arg_z arg_y))
-   (stmhi (:! vsp) (arg_z arg_y arg_x))
+   (stmdbeq (:! vsp) (arg_z arg_y))
+   (stmdbhi (:! vsp) (arg_z arg_y arg_x))
    :done
    )
@@ -2866,9 +2866,9 @@
   (cmp other-temp lr)
   (mov arg-temp (:$ arm::lisp-frame-marker))
-  (stmdb (:! vsp) (arg-temp entry-vsp fn lr))
+  (stmdb (:! sp) (arg-temp entry-vsp fn lr))
   (mov fn (:$ 0))
   (moveq lr (:$ (- arm::nil-value arm::fulltag-nil)))
   (ldreq lr (:@ lr (:$ (arm::%kernel-global 'arm::lexpr-return))))
-  (stmdbeq (:! vsp) (arg-temp entry-vsp fn lr))
+  (stmdbeq (:! sp) (arg-temp entry-vsp fn lr))
   (moveq lr other-temp)
   (movne lr (:$ (- arm::nil-value arm::fulltag-nil)))
Index: /branches/arm/compiler/ARM/arm2.lisp
===================================================================
--- /branches/arm/compiler/ARM/arm2.lisp	(revision 13857)
+++ /branches/arm/compiler/ARM/arm2.lisp	(revision 13858)
@@ -1343,15 +1343,15 @@
                         (if is-signed
                           (! misc-ref-c-s32 temp src index-known-fixnum)
-                          (! misc-ref-c-u32 temp src index-known-fixnum)))))
-               (with-imm-target () idx-reg
-                 (if index-known-fixnum
-                   (arm2-absolute-natural seg idx-reg nil (+ (arch::target-misc-data-offset arch) (ash index-known-fixnum 2)))
-                   (! scale-32bit-misc-index idx-reg unscaled-idx))
-                 (cond ((eq type-keyword :single-float-vector)
-                        (! misc-ref-single-float fp-val src idx-reg))
-                       (t
-                        (if is-signed
-                          (! misc-ref-s32 temp src idx-reg)
-                          (! misc-ref-u32 temp src idx-reg)))))
+                          (! misc-ref-c-u32 temp src index-known-fixnum))))
+                 (with-imm-target () idx-reg
+                   (if index-known-fixnum
+                     (arm2-absolute-natural seg idx-reg nil (+ (arch::target-misc-data-offset arch) (ash index-known-fixnum 2)))
+                     (! scale-32bit-misc-index idx-reg unscaled-idx))
+                   (cond ((eq type-keyword :single-float-vector)
+                          (! misc-ref-single-float fp-val src idx-reg))
+                         (t
+                          (if is-signed
+                            (! misc-ref-s32 temp src idx-reg)
+                            (! misc-ref-u32 temp src idx-reg))))))
                (case type-keyword
                  (:single-float-vector
Index: /branches/arm/level-0/ARM/arm-pred.lisp
===================================================================
--- /branches/arm/level-0/ARM/arm-pred.lisp	(revision 13857)
+++ /branches/arm/level-0/ARM/arm-pred.lisp	(revision 13858)
@@ -154,5 +154,5 @@
   (mov y temp1)
   (bl @top)
-  (cmp arg_z 'nul)  
+  (cmp arg_z 'nil)  
   (mov nfn fn)
   (restore-lisp-frame imm0)           ; gets old fn to fn  
Index: /branches/arm/level-1/l1-clos-boot.lisp
===================================================================
--- /branches/arm/level-1/l1-clos-boot.lisp	(revision 13857)
+++ /branches/arm/level-1/l1-clos-boot.lisp	(revision 13858)
@@ -2113,4 +2113,20 @@
               (find-class 'double-float-vector))))
 
+  #+arm-target
+  (defparameter *ivector-vector-classes*
+    (vector (find-class 'short-float-vector)
+            (find-class 'unsigned-long-vector)
+            (find-class 'long-vector)
+            (find-class 'fixnum-vector)
+            (find-class 'base-string)
+            (find-class 'unsigned-byte-vector)
+            (find-class 'byte-vector)
+            *t-class*                   ; old base-string
+            (find-class 'unsigned-word-vector)
+            (find-class 'word-vector)
+            (find-class 'double-float-vector)
+            (find-class 'bit-vector)))
+
+
 
 
@@ -2325,4 +2341,14 @@
                 (%svref v (+ slice x8664::fulltag-tra-1)) *tagged-return-address-class*
                 (%svref v (+ slice x8664::fulltag-nil)) *null-class*))
+        #+arm-target
+        (do* ((slice 0 (+ 8 slice)))
+             ((= slice 256))
+          (declare (type (unsigned-byte 8) slice))
+          (setf (%svref v (+ slice arm::fulltag-even-fixnum)) *fixnum-class*
+                (%svref v (+ slice arm::fulltag-odd-fixnum))  *fixnum-class*
+                (%svref v (+ slice arm::fulltag-cons)) *cons-class*
+                (%svref v (+ slice arm::fulltag-nil)) *null-class*
+                (%svref v (+ slice arm::fulltag-imm)) *immediate-class*))
+
         (macrolet ((map-subtag (subtag class-name)
                      `(setf (%svref v ,subtag) (find-class ',class-name))))
Index: /branches/arm/lisp-kernel/arm-spentry.s
===================================================================
--- /branches/arm/lisp-kernel/arm-spentry.s	(revision 13857)
+++ /branches/arm/lisp-kernel/arm-spentry.s	(revision 13858)
@@ -379,5 +379,5 @@
 	__(ldr imm2,[rcontext,#tcr.tlb_pointer])
 	__(ldr imm0,[rcontext,#tcr.db_link])
-	__(ldr temp1,[imm2,imm0])
+	__(ldr temp1,[imm2,imm1])
 	__(beq 9f)
 	__(vpush1(temp1))
@@ -597,118 +597,8 @@
 /* This takes N multiple values atop the vstack.  */
 _spentry(nthrowvalues)
-dnl         __(mov imm1,#1)
-dnl  __(mov imm4,imm0)
-dnl         __(str(imm1,tcr.unwinding(rcontext)))
-dnl local_label(_nthrowv_nextframe):
-dnl  __(subi imm4,imm4,fixnum_one)
-dnl  __(cmpri(cr1,imm4,0))
-dnl  __(ldr temp0,[rcontext,#tcr.catch_top])
-dnl  __(ldr imm1,[rcontext,#tcr.db_link])
-dnl  __(blt cr1,local_label(_nthrowv_done))
-dnl  __(ldr imm0,[temp0,#catch_frame.db_link])
-dnl  __(ldr imm3,[temp0,#catch_frame.link])
-dnl  __(cmpr(imm0,imm1))
-dnl  __(str(imm3,tcr.catch_top(rcontext)))
-dnl  __(ldr temp1,[temp0,#catch_frame.catch_tag])
-dnl  __(cmpri(cr7,temp1,unbound_marker))  /* unwind-protect ?  */
-dnl  __(ldr first_nvr,[temp0,#catch_frame.xframe])
-dnl  __(str(first_nvr,tcr.xframe(rcontext)))
-dnl  __(ldr sp,[temp0,#catch_frame.csp])
-dnl  __(beq local_label(_nthrowv_dont_unbind))
-dnl  __(mflr loc_pc)
-dnl         __(bl _SPunbind_to)
-dnl  __(mtlr loc_pc)
-dnl local_label(_nthrowv_dont_unbind):
-dnl  __(beq cr7,local_label(_nthrowv_do_unwind))
-dnl /* A catch frame.  If the last one, restore context from there.  */
-dnl  __(bne cr1,local_label(_nthrowv_skip))
-dnl  __(ldr imm0,[sp,#lisp_frame.savevsp])
-dnl  __(str(rzero,lisp_frame.savevsp(sp))) /* marker for stack overflow code  */
-dnl  __(add imm1,vsp,nargs)
-dnl  __(mov imm2,nargs)
-dnl  __(b local_label(_nthrowv_push_test))
-dnl local_label(_nthrowv_push_loop):
-dnl  __(ldru(temp1,-node_size(imm1)))
-dnl  __(push(temp1,imm0))
-dnl local_label(_nthrowv_push_test):
-dnl  __(cmp imm2,#0))
-dnl  __(subi imm2,imm2,fixnum_one)
-dnl  __(bne local_label(_nthrowv_push_loop))
-dnl  __(mov vsp,imm0)
-dnl         __(restore_catch_nvrs(temp0))
-dnl 
-dnl local_label(_nthrowv_skip):
-dnl  __(la tsp,-(tsp_frame.fixed_overhead+fulltag_misc)(temp0))
-dnl  __(unlink(tsp))
-dnl  __(discard_lisp_frame())
-dnl  __(b local_label(_nthrowv_nextframe))
-dnl local_label(_nthrowv_do_unwind):
-dnl         /* This is harder.  Call the cleanup code with the multiple */
-dnl  /* values (and nargs, which is a fixnum.)  Remember the throw count  */
-dnl         /* (also a fixnum) as well.  */
-dnl         /* Save our caller's LR and FN in the csp frame created by the unwind-  */
-dnl         /* protect.  (Clever, eh ?)  */
-dnl  __(ldr first_nvr,[temp0,#catch_frame.xframe])
-dnl  __(str(first_nvr,tcr.xframe(rcontext)))
-dnl         __(restore_catch_nvrs(temp0))
-dnl  __(la tsp,-(tsp_frame.fixed_overhead+fulltag_misc)(temp0))
-dnl  __(unlink(tsp))
-dnl  __(ldr loc_pc,[sp,#lisp_frame.savelr])
-dnl  __(ldr nfn,[sp,#lisp_frame.savefn])
-dnl  __(mtctr loc_pc) /* cleanup code address.  */
-dnl  __(str(fn,lisp_frame.savefn(sp)))
-dnl  __(mflr loc_pc)
-dnl  __(mov fn,nfn)
-dnl  __(str(loc_pc,lisp_frame.savelr(sp)))
-dnl  __(dnode_align(imm0,nargs,tsp_frame.fixed_overhead+(2*node_size))) /* tsp overhead, nargs, throw count  */
-dnl  __(TSP_Alloc_Var_Boxed_nz(imm0,imm1))
-dnl  __(mov imm2,nargs)
-dnl  __(add imm1,nargs,vsp)
-dnl  __(la imm0,tsp_frame.data_offset(tsp))
-dnl  __(str(nargs,0(imm0)))
-dnl  __(b local_label(_nthrowv_tpushtest))
-dnl local_label(_nthrowv_tpushloop):
-dnl  __(ldru(temp0,-node_size(imm1)))
-dnl  __(stru(temp0,node_size(imm0)))
-dnl  __(subi imm2,imm2,fixnum_one)
-dnl local_label(_nthrowv_tpushtest):
-dnl  __(cmp imm2,#0)
-dnl  __(bne local_label(_nthrowv_tpushloop))
-dnl  __(stru(imm4,node_size(imm0)))
-dnl  __(ldr vsp,[sp,#lisp_frame.savevsp])
-dnl         /* Interrupts should be disabled here (we're calling and returning */
-dnl         /* from the cleanup form.  Clear the tcr.unwinding flag, so that */
-dnl         /* interrupts can be taken if they're enabled in the cleanup form.  */
-dnl         __(str(rzero,tcr.unwinding(rcontext)))        
-dnl  __(bctrl)
-dnl         __(mov imm1,#1)
-dnl  __(la imm0,tsp_frame.data_offset(tsp))
-dnl         __(str(imm1,tcr.unwinding(rcontext)))
-dnl  __(ldr fn,[sp,#lisp_frame.savefn])
-dnl  __(ldr loc_pc,[sp,#lisp_frame.savelr])
-dnl  __(discard_lisp_frame())
-dnl  __(mtlr loc_pc)
-dnl  __(ldr nargs,[imm0,#0])
-dnl  __(mov imm2,nargs)
-dnl  __(b local_label(_nthrowv_tpoptest))
-dnl local_label(_nthrowv_tpoploop):
-dnl  __(ldru(temp0,node_size(imm0)))
-dnl  __(vpush1(temp0))
-dnl  __(subi imm2,imm2,fixnum_one)
-dnl local_label(_nthrowv_tpoptest):
-dnl  __(cmp imm2,#0)
-dnl  __(bne local_label(_nthrowv_tpoploop))
-dnl  __(ldr imm4,[imm0,#node_size])
-dnl  __(unlink(tsp))
-dnl  __(b local_label(_nthrowv_nextframe))
-dnl local_label(_nthrowv_done):
-dnl         __(str(rzero,tcr.unwinding(rcontext)))
-dnl         /* Poll for a deferred interrupt.  That clobbers nargs (which we've */
-dnl         /* just expended a lot of effort to preserve), so expend a little *
-dnl         /* more effort. */
-dnl         __(mov imm4,nargs)
-dnl         __(check_pending_interrupt())
-dnl         __(mov nargs,imm4)
-dnl         __(bx lr)
+        __(mov imm1,#1)
+        __(mov temp2,imm0)
+        __(str imm1,[rcontext,#tcr.unwinding])
+        __(b C(nthrownv))
 
 /* This is a (slight) optimization.  When running an unwind-protect, */
@@ -1109,4 +999,5 @@
 
 _spentry(progvsave)
+        __(uuo_debug_trap(al))
 dnl  /* Error if arg_z isn't a proper list.  That's unlikely, */
 dnl  /* but it's better to check now than to crash later. */
@@ -1943,4 +1834,5 @@
 dnl 
 _spentry(recover_values)
+        __(uuo_debug_trap(al))
 dnl 
 dnl /* First, walk the segments reversing the pointer to previous segment pointers  */
@@ -2126,4 +2018,5 @@
 dnl 
 _spentry(save_values)
+        __(uuo_debug_trap(al))
 dnl  __(mov imm1,tsp)
 dnl 
@@ -2161,4 +2054,5 @@
 dnl 
 _spentry(add_values)
+        __(uuo_debug_trap(al))
 dnl  __(cmpri(nargs,0))
 dnl  __(ldr imm1,[tsp,#0])
@@ -2821,5 +2715,5 @@
         __(mov temp1,imm1)      /* from comparison above */
 local_label(current_key_allow_other_keys_handled):
-        __(getvheader(imm0,temp1))
+        __(getvheader(imm0,temp2))
         __(header_length(arg_x,imm0))
         __(add imm0,arg_x,#misc_data_offset)
@@ -2864,11 +2758,11 @@
 0:      __(tst keyword_flags,#keyword_flag_rest)
         __(beq local_label(discard_stack_vector))
-        __(mov nargs,#0)
+        __(mov imm0,#0)
         __(add temp2,sp,#node_size)
         __(b 2f)
 1:      __(ldr arg_x,[temp2],#node_size)
         __(vpush1(arg_x))
-        __(add nargs,nargs,#fixnumone)
-2:      __(cmp nargs,key_value_count)
+        __(add imm0,imm0,#fixnumone)
+2:      __(cmp imm0,key_value_count)
         __(bne 1b)
 local_label(discard_stack_vector):      
@@ -4050,5 +3944,6 @@
 popdef(`__')
 
-C(nthrow1v):    
+_exportfn(C(nthrow1v))
+        new_local_labels()
 local_label(_nthrow1v_nextframe):
         __(subs temp2,temp2,#fixnum_one)
@@ -4068,4 +3963,5 @@
         __(ldr temp1,[temp0,#catch_frame.catch_tag])
         __(cmp temp1,#unbound_marker)  /* unwind-protect ?  */
+        __(sub sp,temp0,#fulltag_misc)
         __(beq local_label(_nthrow1v_do_unwind))
         /* A catch frame.  If the last one, restore context from there.  */
@@ -4109,12 +4005,115 @@
         __(check_pending_interrupt(nargs))
         __(bx lr)
-        
+_endfn        
+
+_exportfn(nthrownv)
+        new_local_labels()
+local_label(nthrownv_nextframe):
+        __(subs temp2,temp2,#fixnum_one)
+        __(ldr temp0,[rcontext,#tcr.catch_top])
+        __(ldr imm1,[rcontext,#tcr.db_link])
+        __(blt local_label(nthrownv_done))
+        __(ldr arg_y,[temp0,#catch_frame.link])
+        __(ldr imm0,[temp0,#catch_frame.db_link])
+        __(cmp imm0,imm1)
+        __(str arg_y,[rcontext,#tcr.catch_top])
+        __(ldr arg_y,[temp0,#catch_frame.xframe])
+        __(str arg_y,[rcontext,#tcr.xframe])
+        __(beq local_label(nthrownv_dont_unbind))
+        __(do_unbind_to(imm1,temp1,arg_x,arg_y))
+local_label(nthrownv_dont_unbind):
+        __(ldr temp1,[temp0,#catch_frame.catch_tag])
+        __(cmp temp1,#unbound_marker)  /* unwind-protect ?  */
+        __(sub sp,temp0,#fulltag_misc)
+        __(beq local_label(nthrownv_do_unwind))
+        __(cmp temp2,#0)
+/* A catch frame.  If the last one, restore context from there.  */
+	__(bne local_label(nthrownv_skip))
+        __(ldr imm0,[sp,#catch_frame.size+lisp_frame.savevsp])
+        __(add imm1,vsp,nargs)
+        __(movs arg_z,nargs)
+        __(b local_label(nthrownv_push_test))
+local_label(nthrownv_push_loop):        
+        __(subs arg_z,arg_z,#fixnumone)
+        __(ldr temp1,[imm1,#-node_size]!)
+        __(push1(temp1,imm0))
+local_label(nthrownv_push_test):        
+        __(bne local_label(nthrownv_push_loop))
+        __(mov vsp,imm0)
+local_label(nthrownv_skip):     
+        __(add sp,sp,#catch_frame.size+lisp_frame.size)
+        __(b local_label(nthrownv_nextframe))                
+local_label(nthrownv_do_unwind):
+        __(ldr arg_x,[temp0,#catch_frame.xframe])
+        __(ldr arg_z,[temp0,#catch_frame.last_lisp_frame])
+        __(sub sp,temp0,#fulltag_misc)
+        __(str arg_x,[rcontext,#tcr.xframe])
+        __(str arg_z,[rcontext,#tcr.last_lisp_frame])
+        __(add sp,sp,#catch_frame.size)
+        __(add imm1,nargs,#node_size)
+        __(mov arg_z,sp)
+        __(dnode_align(imm0,imm1,node_size))
+        __(mov imm1,imm1,lsl #num_subtag_bits-fixnumshift)
+        __(orr imm1,imm1,#subtag_u32_vector)
+        __(stack_allocate_zeroed_ivector(imm1,imm0))
+        __(mov imm0,#subtag_simple_vector)
+        __(strb imm0,[sp])
+        __(str temp2,[sp,#node_size])
+        __(add temp2,sp,#dnode_size)
+        __(add temp2,temp2,nargs)
+        __(add temp1,vsp,nargs)
+        __(b local_label(nthrownv_tpushtest))
+local_label(nthrownv_tpushloop):        
+        __(ldr temp0,[temp1,#-node_size]!)
+        __(push1(temp0,temp2))
+local_label(nthrownv_tpushtest):        
+        __(subs nargs,nargs,#fixnumone)
+        __(bge local_label(nthrownv_tpushloop))
+        __(mov imm1,#0)
+        __(add imm0,arg_z,#lisp_frame.savelr)
+        __(swp lr,lr,[imm0])
+        __(ldr nfn,[arg_z,#lisp_frame.savefn])
+        __(str fn,[arg_z,#lisp_frame.savefn])
+        __(ldr vsp,[arg_z,#lisp_frame.savevsp])
+        __(str imm1,[rcontext,#tcr.unwinding])
+        __(mov fn,nfn)
+        __(blx lr)
+        __(mov imm1,#1)
+        __(str imm1,[rcontext,#tcr.unwinding])
+        __(ldr imm0,[sp])
+        __(header_length(imm0,imm0))
+        __(subs nargs,imm0,#node_size)
+        __(add imm0,imm0,#node_size)
+        __(add temp0,sp,imm0)
+        __(mov imm0,nargs)
+        __(add arg_z,temp0,#node_size)
+        __(bic arg_z,arg_z,#fulltagmask)
+        __(b local_label(nthrownv_tpoptest))
+local_label(nthrownv_tpoploop):  
+        __(subs imm0,imm0,#node_size)        
+        __(vpush1(temp2))
+local_label(nthrownv_tpoptest):  
+        __(ldr temp2,[temp0,#-node_size]!)
+        __(bne local_label(nthrownv_tpoploop))
+        __(mov sp,arg_z)
+        __(ldr fn,[sp,#lisp_frame.savefn])
+        __(ldr lr,[sp,#lisp_frame.savelr])
+        __(discard_lisp_frame())
+        __(b local_label(nthrownv_nextframe))
+local_label(nthrownv_done):     
+        __(mov imm0,#0)
+        __(str imm0,[rcontext,#tcr.unwinding])
+        __(check_pending_interrupt(imm1))
+        __(bx lr)
+_endfn                
+                        
+               
 /* Too large to safely fit on tstack.  Heap-cons the vector, but make  */
 /* sure that there's an empty tsp frame to keep the compiler happy.  */
-stack_misc_alloc_no_room:       
+_exportfn(stack_misc_alloc_no_room)
         __(mov imm0,#stack_alloc_marker)
         __(mov imm1,sp)
         __(stmdb sp!,{imm0,imm1})
         __(b _SPmisc_alloc)
-        
+_endfn        
 	_endfile
