Index: /branches/ia32/lisp-kernel/x86-spentry32.s
===================================================================
--- /branches/ia32/lisp-kernel/x86-spentry32.s	(revision 9615)
+++ /branches/ia32/lisp-kernel/x86-spentry32.s	(revision 9616)
@@ -1680,8 +1680,5 @@
 	__(cmpl lisp_global(oldspace_dnode_count),%imm0)
 	__(jae 0b)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
+	__(ref_global(refbits,%temp0))
 	__(xorb $31,%imm0_b)
 	__(lock)
@@ -1702,8 +1699,5 @@
 	__(cmpl lisp_global(oldspace_dnode_count),%imm0)
 	__(jae 0b)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
+	__(ref_global(refbits,%temp0))
 	__(xorb $31,%imm0_b)
 	__(lock)
@@ -1726,8 +1720,5 @@
 	__(cmpl lisp_global(oldspace_dnode_count),%imm0)
 	__(jae 0b)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
+	__(ref_global(refbits,%temp0))
 	__(xorb $31,%imm0_b)
 	__(lock)
@@ -1752,23 +1743,15 @@
 	__(cmpl lisp_global(oldspace_dnode_count),%imm0)
 	__(jae 0b)
-	__(push %temp0)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
+	__(ref_global(refbits,%temp1))
 	__(xorb $31,%imm0_b)
 	__(lock)
-	__(btsl %imm0,(%temp0))
+	__(btsl %imm0,(%temp1))
 	/* Now memoize the address of the hash vector */
-	__(pop %imm0)
+	__(movl %temp0,%imm0)
 	__(subl lisp_global(heap_start),%imm0)
 	__(shrl $dnode_shift,%imm0)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
 	__(xorb $31,%imm0_b)
 	__(lock)
-	__(btsl %imm0,(%temp0))
+	__(btsl %imm0,(%temp1))
 	__(ret)
 _endsubp(set_hash_key)
@@ -1799,11 +1782,8 @@
 	__(cmpl lisp_global(oldspace_dnode_count),%imm0)
 	__(jae 2f)
-	__(andl $~(1<<bitmap_shift-1),%temp0)
-	__(shrl $bitmap_shift-fixnumshift,%temp0)
-	__(andl $31,%imm0)
-	__(addl lisp_global(refbits),%temp0)
+	__(ref_global(refbits,%temp1))
 	__(xorb $31,%imm0_b)
 	__(lock)
-	__(btsl %imm0,(%temp0))
+	__(btsl %imm0,(%temp1))
         .globl C(egc_write_barrier_end)
 C(egc_write_barrier_end):
@@ -3077,6 +3057,37 @@
 _endsubp(getu64)
 
+/* Make unsigned integer from value in mm0 */
 _spentry(makeu64)
-	__(int $3)
+	__(movq %mm0,%mm1)
+	__(psrlq $32,%mm0)
+	__(movd %mm0,%imm0)
+	__(test %imm0,%imm0)
+	__(js 3f)
+	__(jnz 2f)
+	__(movd %mm1,%imm0)
+	__(cmpl $target_most_positive_fixnum,%imm0)
+	__(ja 1f)
+	__(box_fixnum(%imm0,%arg_z))
+	__(ret)
+1:	/* maybe make a 1 digit bignum */
+	__(test %imm0,%imm0)
+	__(js 2f)
+	__(movl $one_digit_bignum_header,%imm0)
+	__(movd %imm0,%mm0)
+	__(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(1)))
+	__(movd %mm1,misc_data_offset(%arg_z))
+	__(ret)
+	/* make a 2 digit bignum */
+2:	__(movl $two_digit_bignum_header,%imm0)
+	__(movd %imm0,%mm0)
+	__(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(2)))
+	__(movq %mm1,misc_data_offset(%arg_z))
+	__(ret)
+	/* make a 3 digit bignum */
+3:	__(movl $three_digit_bignum_header,%imm0)
+	__(movd %imm0,%mm0)
+	__(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(3)))
+	__(movq %mm1,misc_data_offset(%arg_z))
+	__(ret)
 _endsubp(makeu64)
 
@@ -3134,6 +3145,6 @@
 /* Make a lisp integer from the unsigned value in imm0 */
 _spentry(makeu32)
-	__(cmpl $(1<<29),%imm0)
-	__(jae 0f)	/* need to make a bignum */
+	__(cmpl $target_most_positive_fixnum,%imm0)
+	__(ja 0f)	/* need to make a bignum */
 	__(box_fixnum(%imm0,%arg_z))
 	__(ret)
