New types uword_t, sword_t
authorDavid Lichteblau <david@lichteblau.com>
Thu, 8 Nov 2012 16:04:03 +0000 (17:04 +0100)
committerDavid Lichteblau <david@lichteblau.com>
Tue, 20 Nov 2012 14:01:26 +0000 (15:01 +0100)
First commit in a series of changes for LLP64 platform support.

We have been using `(un)signed long' assuming that it is an integer
of the same size as a pointer.  On Windows x64 this assumption does
not hold, and `(un)signed long long' is required for the same
purpose.

Code will be updated to use our own types uword_t, sword_t instead,
which are defined to be synonyms of uintptr_t and intptr_t, respectively.

Note that uword_t is also synonymous with our older type
pointer_sized_uint_t, and technically (albeit not conceptually) the
same as lispobj.

Thanks to Anton Kovalenko.

src/runtime/gc.h
src/runtime/runtime.h
src/runtime/win32-os.h

index ff6797d..3b0aea0 100644 (file)
 #define _GC_H_
 
 #include "sbcl.h"
+#include <stdint.h>
 
 #define PAGE_BYTES BACKEND_PAGE_BYTES
 
-typedef signed long page_index_t;
+typedef intptr_t page_index_t;
 #define PAGE_INDEX_FMT "ld"
 
 typedef signed char generation_index_t;
index 072f5e4..4d7ab2e 100644 (file)
@@ -205,7 +205,7 @@ typedef unsigned int u32;
 typedef signed int s32;
 
 /* this is an integral type the same length as a machine pointer */
-typedef unsigned long pointer_sized_uint_t ;
+typedef uintptr_t pointer_sized_uint_t;
 
 #include <sys/types.h>
 
@@ -215,12 +215,15 @@ typedef pthread_t os_thread_t;
 typedef pid_t os_thread_t;
 #endif
 
+typedef uintptr_t uword_t;
+typedef intptr_t  sword_t;
+
 /* FIXME: we do things this way because of the alpha32 port.  once
    alpha64 has arrived, all this nastiness can go away */
 #if 64 == N_WORD_BITS
 #define LOW_WORD(c) ((pointer_sized_uint_t)c)
 #define OBJ_FMTX "lx"
-typedef unsigned long lispobj;
+typedef uintptr_t lispobj;
 #else
 #define OBJ_FMTX "x"
 #define LOW_WORD(c) ((long)(c) & 0xFFFFFFFFL)
index acc8b10..7f50155 100644 (file)
@@ -37,10 +37,6 @@ typedef sem_t os_sem_t;
 typedef void *siginfo_t;
 #endif
 
-/* Note: This typedef will moved to runtime.h when AMD64 changes are being
- * merged. */
-typedef unsigned long uword_t;
-
 typedef LPVOID os_vm_address_t;
 typedef uword_t os_vm_size_t;
 typedef intptr_t os_vm_offset_t;