diff --git a/lisp/alloc.c b/lisp/alloc.c
index f21835e92582daf0596be8626208bf78a90fcabc..07b31f03b2e50c6db7afc109f3ff9ddeab950541 100644
--- a/lisp/alloc.c
+++ b/lisp/alloc.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alloc.c,v 1.5 2003/09/13 14:21:30 gerd Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alloc.c,v 1.6 2004/05/18 22:37:34 cwang Exp $ */
 
 #include "lisp.h"
 #include "internals.h"
@@ -56,7 +56,7 @@ static lispobj *alloc_unboxed(int type, int words)
 {
     lispobj *result;
 
-    result = alloc(ALIGNED_SIZE((1 + words) * sizeof(lispobj)));
+    result = (lispobj *)alloc(ALIGNED_SIZE((1 + words) * sizeof(lispobj)));
 
     *result = (lispobj) (words << type_Bits) | type;
 
@@ -90,7 +90,11 @@ lispobj alloc_number(long n)
 {
     struct bignum *ptr;
 
+#ifdef __x86_64
+    if (-0x2000000000000000 < n && n < 0x2000000000000000)  /* -2^61 to 2^61 */
+#else
     if (-0x20000000 < n && n < 0x20000000)
+#endif
         return make_fixnum(n);
     else {
         ptr = (struct bignum *)alloc_unboxed(type_Bignum, 1);
diff --git a/lisp/backtrace.c b/lisp/backtrace.c
index 5d140119a973a49b5fc46b62ed06df982d6746bc..ff2ef82dd08a2ba11762bed9f56157bb10366fe1 100644
--- a/lisp/backtrace.c
+++ b/lisp/backtrace.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.8 2003/07/28 17:43:11 gerd Exp $
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.9 2004/05/18 22:41:23 cwang Exp $
  *
  * Simple backtrace facility.  More or less from Rob's lisp version.
  */
@@ -12,7 +12,7 @@
 #include "interrupt.h"
 #include "lispregs.h"
 
-#ifndef i386
+#if !(defined(i386) || defined(__x86_64))
 
 /* Sigh ... I know what the call frame looks like and it had
    better not change. */
@@ -252,7 +252,7 @@ backtrace(int nframes)
 #define VM_RETURN_PC_SAVE_OFFSET	1
 
 static int
-stack_pointer_p (unsigned p)
+stack_pointer_p (unsigned long p)
 {
   return (p < CONTROL_STACK_START + CONTROL_STACK_SIZE
 	  && p > (unsigned) &p
@@ -266,7 +266,7 @@ ra_pointer_p (unsigned ra)
 }
 
 static unsigned
-deref (unsigned p, int offset)
+deref (unsigned long p, int offset)
 {
   return *((unsigned *) p + offset);
 }
@@ -429,7 +429,7 @@ array_of_type_p (lispobj obj, int type)
 }
 
 struct compiled_debug_function *
-debug_function_from_pc (struct code* code, unsigned pc)
+debug_function_from_pc (struct code* code, unsigned long pc)
 {
   unsigned code_header_len = sizeof (lispobj) * HeaderValue (code->header);
   unsigned offset = pc - (unsigned) code - code_header_len;
@@ -497,7 +497,8 @@ backtrace (int nframes)
   for (i = 0; i < nframes; ++i)
     {
       lispobj *p;
-      unsigned ra, next_fp;
+      unsigned long ra;
+      unsigned next_fp;
       
       if (!x86_call_context (fp, &ra, &next_fp))
 	break;