[Openmcl-cvs-notifications] r15082 - /trunk/source/lisp-kernel/arm-spentry.s

gb at clozure.com gb at clozure.com
Sat Nov 19 16:35:26 CST 2011


Author: gb
Date: Sat Nov 19 16:35:26 2011
New Revision: 15082

Log:
When stack-allocating variable-sized objects, check proposed new
SP value against tcr.cs_limit rather than depending on hitting
guard pages.  Small/fixedsize objects will still run into the
guard page(s) and cause overflow to be signaled.

(This basically means that larger things can be stack-consed
successfully, and that the limit has to do with available stack
space.)

Modified:
    trunk/source/lisp-kernel/arm-spentry.s

Modified: trunk/source/lisp-kernel/arm-spentry.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-spentry.s (original)
+++ trunk/source/lisp-kernel/arm-spentry.s Sat Nov 19 16:35:26 2011
@@ -1054,23 +1054,14 @@
         __(beq 1f)
         __(uuo_error_reg_not_xtype(al,arg_y,xtype_unsigned_byte_24))
 1:              =

-        __(unbox_fixnum(imm0,arg_z))
-        __(extract_fulltag(imm1,imm0))
+        __(unbox_fixnum(imm2,arg_z))
+        __(extract_fulltag(imm1,imm2))
         __(cmp imm1,#fulltag_nodeheader)
         __(bne 1f)
         __(dnode_align(imm1,arg_y,node_size))
-        __(cmp imm1,#stack_alloc_limit)
-        __(bhs stack_misc_alloc_no_room)
         __(mov imm0,#subtag_u32_vector)
         __(orr imm0,imm0,arg_y,lsl #num_subtag_bits-fixnumshift)
-        __(mov temp0,#stack_alloc_marker)
-        __(mov temp1,sp)
-        __(stack_allocate_zeroed_ivector(imm0,imm1))
-        __(unbox_fixnum(imm0,arg_z))
-        __(strb imm0,[sp])
-        __(add arg_z,sp,#fulltag_misc)
-        __(stmdb sp!,{temp0,temp1})
-        __(bx lr)
+        __(b 9f)
 1:      __(mov imm0,arg_y,lsl #num_subtag_bits-fixnumshift)
         __(orr imm0,imm0,arg_z,lsr #fixnumshift)
         __(cmp arg_z,#max_32_bit_ivector_subtag<<fixnumshift)
@@ -1088,12 +1079,16 @@
         __(addne imm1,arg_y,#7<<fixnumshift)
         __(movne imm1,imm1,lsr#3+fixnumshift)
 8:      __(dnode_align(imm1,imm1,node_size))
-        __(cmp imm1,#stack_alloc_limit)
-        __(bhs stack_misc_alloc_no_room)
+9:      =

+        __(ldr temp0,[rcontext,tcr.cs_limit])
+        __(sub temp1,sp,imm1)
+        __(cmp temp1,temp0)
+        __(bls stack_misc_alloc_no_room)
         __(mov temp0,#stack_alloc_marker)
         __(mov temp1,sp)
         __(stack_allocate_zeroed_ivector(imm0,imm1))
         __(add arg_z,sp,#fulltag_misc)
+        __(strb imm2,[sp])
         __(stmdb sp!,{temp0,temp1})
         __(bx lr)
 =

@@ -1327,8 +1322,10 @@
         __(dnode_align(imm0,imm1,node_size))
         __(mov imm1,imm1,lsl #num_subtag_bits-fixnumshift)
         __(orr imm1,imm1,#subtag_u32_vector)
-        __(cmp imm0,#stack_alloc_limit)
-        __(bge 3f)
+        __(sub arg_x,sp,imm0)
+        __(ldr arg_y,[rcontext,#tcr.cs_limit])
+        __(cmp arg_x,arg_y)
+        __(blo 3f)
         __(stack_allocate_zeroed_ivector(imm1,imm0))
         __(mov imm0,#subtag_simple_vector)
         __(strb imm0,[sp])
@@ -1643,9 +1640,11 @@
         __(dnode_align(imm1,imm1,0))
         __(add imm1,imm1,#node_size)
         __(add imm0,imm1,#node_size)
-        __(cmp imm0,#stack_alloc_limit)
+        __(sub imm2,sp,imm0)
+        __(ldr temp0,[rcontext,#tcr.cs_limit])
+        __(cmp imm2,temp0)
         __(mov temp0,sp)
-        __(bhs 1f)
+        __(bls 1f)
         __(mov imm1,imm1,lsl #num_subtag_bits)
         __(orr imm1,imm1,#subtag_u8_vector)
         __(stack_allocate_ivector(imm1,imm0))
@@ -1675,9 +1674,11 @@
         __(dnode_align(imm1,imm1,0))
         __(add imm1,imm1,#node_size)
         __(add imm0,imm1,#node_size)
-        __(cmp imm0,#stack_alloc_limit)
+        __(sub imm2,sp,imm0)
+        __(ldr temp0,[rcontext,#tcr.cs_limit])
+        __(cmp imm2,temp0)
         __(mov temp0,sp)
-        __(bhs 1f)
+        __(bls 1f)
         __(mov imm1,imm1,lsl #num_subtag_bits)
         __(orr imm1,imm1,#subtag_u8_vector)
         __(stack_allocate_zeroed_ivector(imm1,imm0))
@@ -1712,8 +1713,10 @@
         __(add imm1,imm1,#1<<num_subtag_bits)
         __(orr imm1,imm1,#subtag_u32_vector)
         __(add imm0,imm0,#dnode_size)
-        __(cmp imm0,#stack_alloc_limit)
-        __(bge 4f)
+        __(ldr temp0,[rcontext,#tcr.cs_limit])
+        __(sub imm2,sp,imm0)
+        __(cmp imm2,temp0)
+        __(bls 4f)
         __(stack_allocate_zeroed_ivector(imm1,imm0))
         __(mov imm0,#subtag_simple_vector)
         __(strb imm0,[sp,#0])
@@ -1754,8 +1757,12 @@
         __(dnode_align(temp1,imm0,node_size))
         __(mov imm1,imm0,lsl #num_subtag_bits-fixnumshift)
         __(orr imm1,imm1,#subtag_u32_vector)
+        __(sub temp2,sp,imm1)
+        __(ldr arg_x,[rcontext,#tcr.cs_limit])
+        __(cmp temp2,arg_x)       =

         __(mov temp2,sp)
         __(mov arg_x,#stack_alloc_marker)
+        __(bls 3f)
         __(stack_allocate_zeroed_ivector(imm1,temp1))
         __(unbox_fixnum(imm1,temp0))
         __(strb imm1,[sp])
@@ -1770,7 +1777,25 @@
         __(bne 1b)
         __(add vsp,vsp,#fixnumone)
         __(bx lr)
-
+3:      /* Have to heap-cons. */        =

+        __(stmdb sp!,{arg_x,temp2})
+        __(vpush1(nargs))
+        __(mov arg_y,nargs)
+        __(mov arg_z,temp0)
+        __(build_lisp_frame(imm0))
+        __(bl _SPmisc_alloc)
+        __(restore_lisp_frame(imm0))
+        __(vpop1(nargs))
+        __(add imm0,nargs,#misc_data_offset)
+        __(b 5f)
+4:      __(vpop1(temp0))
+        __(subs imm0,imm0,#fixnumone)
+        __(str temp0,[arg_z,imm0])
+5:      __(subs nargs,nargs,#fixnumone)
+        __(bne 4b)
+        __(add vsp,vsp,#fixnumone)
+        __(bx lr)
+        =

 /* Allocate a "fulltag_misc" object.  On entry, arg_y contains the element=
  */
 /* count (boxed) and  arg_z contains the subtag (boxed).  Both of these   =
*/
 /* parameters must be "reasonable" (the  subtag must be valid, the element=
  */
@@ -2064,8 +2089,10 @@
         __(cmp imm1,#fulltag_nodeheader)
         __(bne stack_misc_alloc_init_ivector)
         __(dnode_align(imm1,arg_x,node_size))
-        __(cmp imm1,#stack_alloc_limit)
-        __(bge stack_misc_alloc_init_no_room)
+        __(ldr temp1,[rcontext,#tcr.cs_limit])
+        __(sub temp0,sp,imm1)
+        __(cmp temp0,temp1)
+        __(bls stack_misc_alloc_init_no_room)
         __(mov imm0,#subtag_u32_vector)
         __(orr imm0,imm0,arg_x,lsl #num_subtag_bits-fixnumshift)
         __(mov temp0,#stack_alloc_marker)
@@ -4303,8 +4330,10 @@
         __(addne imm1,arg_x,#7<<fixnumshift)
         __(movne imm1,imm1,lsr#3+fixnumshift)
 8:      __(dnode_align(imm1,imm1,node_size))
-        __(cmp imm1,#stack_alloc_limit)
-        __(bhs stack_misc_alloc_init_no_room)
+        __(ldr temp0,[rcontext,#tcr.cs_limit])
+        __(sub temp1,sp,imm1)
+        __(cmp temp1,temp0)
+        __(bls stack_misc_alloc_init_no_room)
         __(mov temp0,#stack_alloc_marker)
         __(mov temp1,sp)
         __(stack_allocate_zeroed_ivector(imm0,imm1))



More information about the Openmcl-cvs-notifications mailing list