LLP64: change long to uword_t (thereby flipping signedness)
authorDavid Lichteblau <david@lichteblau.com>
Mon, 12 Nov 2012 16:01:08 +0000 (17:01 +0100)
committerDavid Lichteblau <david@lichteblau.com>
Tue, 20 Nov 2012 14:01:26 +0000 (15:01 +0100)
Replace `long' with `uword_t' in the runtime where applicable.

In these cases, signed long could have been translated literally as
sword_t to support LLP64 platforms, but uword_t seems clearer.

Thanks to Anton Kovalenko.

src/runtime/dynbind.c
src/runtime/gc-common.c
src/runtime/monitor.c
src/runtime/os.h
src/runtime/parse.c
src/runtime/parse.h
src/runtime/save.c

index 9e928a3..8d8da8c 100644 (file)
@@ -40,7 +40,7 @@ void bind_variable(lispobj symbol, lispobj value, void *th)
                 &((struct symbol *)native_pointer(TLS_INDEX_LOCK))->value;
             FSHOW_SIGNAL((stderr, "entering dynbind tls alloc\n"));
             set_pseudo_atomic_atomic(thread);
                 &((struct symbol *)native_pointer(TLS_INDEX_LOCK))->value;
             FSHOW_SIGNAL((stderr, "entering dynbind tls alloc\n"));
             set_pseudo_atomic_atomic(thread);
-            get_spinlock(tls_index_lock,(long)th);
+            get_spinlock(tls_index_lock,(uword_t)th);
             if(!sym->tls_index) {
                 sym->tls_index=SymbolValue(FREE_TLS_INDEX,0);
                 SetSymbolValue(FREE_TLS_INDEX, sym->tls_index+N_WORD_BYTES, 0);
             if(!sym->tls_index) {
                 sym->tls_index=SymbolValue(FREE_TLS_INDEX,0);
                 SetSymbolValue(FREE_TLS_INDEX, sym->tls_index+N_WORD_BYTES, 0);
index 887337e..1fe6400 100644 (file)
@@ -236,7 +236,7 @@ trans_code(struct code *code)
 {
     struct code *new_code;
     lispobj first, l_code, l_new_code;
 {
     struct code *new_code;
     lispobj first, l_code, l_new_code;
-    long nheader_words, ncode_words, nwords;
+    uword_t nheader_words, ncode_words, nwords;
     unsigned long displacement;
     lispobj fheaderl, *prev_pointer;
 
     unsigned long displacement;
     lispobj fheaderl, *prev_pointer;
 
index 45a9b00..9ae58cd 100644 (file)
@@ -240,7 +240,7 @@ search_cmd(char **ptr)
             return;
         }
         if (more_p(ptr)) {
             return;
         }
         if (more_p(ptr)) {
-            addr = (lispobj *)native_pointer((long)parse_addr(ptr));
+            addr = (lispobj *)native_pointer((uword_t)parse_addr(ptr));
             if (more_p(ptr)) {
                 count = parse_number(ptr);
             }
             if (more_p(ptr)) {
                 count = parse_number(ptr);
             }
@@ -274,7 +274,7 @@ search_cmd(char **ptr)
         addr = end;
         end += 2;
         if (widetag_of(obj) == SIMPLE_FUN_HEADER_WIDETAG) {
         addr = end;
         end += 2;
         if (widetag_of(obj) == SIMPLE_FUN_HEADER_WIDETAG) {
-            print((long)addr | FUN_POINTER_LOWTAG);
+            print((uword_t)addr | FUN_POINTER_LOWTAG);
         } else if (other_immediate_lowtag_p(obj)) {
             print((lispobj)addr | OTHER_POINTER_LOWTAG);
         } else {
         } else if (other_immediate_lowtag_p(obj)) {
             print((lispobj)addr | OTHER_POINTER_LOWTAG);
         } else {
index 7efc80d..d6d34bc 100644 (file)
@@ -156,12 +156,12 @@ extern void os_deallocate(os_vm_address_t addr, os_vm_size_t len);
  * be functions. */
 
 #define os_trunc_to_page(addr) \
  * be functions. */
 
 #define os_trunc_to_page(addr) \
-    (os_vm_address_t)(((long)(addr))&~(os_vm_page_size-1))
+    (os_vm_address_t)(((uword_t)(addr))&~(os_vm_page_size-1))
 #define os_round_up_to_page(addr) \
     os_trunc_to_page((addr)+(os_vm_page_size-1))
 
 #define os_trunc_size_to_page(size) \
 #define os_round_up_to_page(addr) \
     os_trunc_to_page((addr)+(os_vm_page_size-1))
 
 #define os_trunc_size_to_page(size) \
-    (os_vm_size_t)(((long)(size))&~(os_vm_page_size-1))
+    (os_vm_size_t)(((uword_t)(size))&~(os_vm_page_size-1))
 #define os_round_up_size_to_page(size) \
     os_trunc_size_to_page((size)+(os_vm_page_size-1))
 
 #define os_round_up_size_to_page(size) \
     os_trunc_size_to_page((size)+(os_vm_page_size-1))
 
index 66292af..1edfe18 100644 (file)
@@ -49,10 +49,10 @@ static void skip_ws(char **ptr)
         (*ptr)++;
 }
 
         (*ptr)++;
 }
 
-static boolean string_to_long(char *token, long *value)
+static boolean string_to_long(char *token, uword_t *value)
 {
     int base, digit;
 {
     int base, digit;
-    long num;
+    uword_t num;
     char *ptr;
 
     if (token == 0)
     char *ptr;
 
     if (token == 0)
@@ -196,11 +196,11 @@ char *token;
 }
 #endif
 
 }
 #endif
 
-long parse_number(ptr)
+uword_t parse_number(ptr)
 char **ptr;
 {
     char *token = parse_token(ptr);
 char **ptr;
 {
     char *token = parse_token(ptr);
-    long result;
+    uword_t result;
 
     if (token == NULL) {
         printf("expected a number\n");
 
     if (token == NULL) {
         printf("expected a number\n");
@@ -233,7 +233,7 @@ char **ptr;
         result &= ~7;
     }
     else {
         result &= ~7;
     }
     else {
-        long value;
+        uword_t value;
         if (!string_to_long(token, &value)) {
             printf("invalid number: ``%s''\n", token);
             throw_to_monitor();
         if (!string_to_long(token, &value)) {
             printf("invalid number: ``%s''\n", token);
             throw_to_monitor();
@@ -316,9 +316,9 @@ char **ptr;
 {
     struct thread *thread=arch_os_get_current_thread();
     char *token = parse_token(ptr);
 {
     struct thread *thread=arch_os_get_current_thread();
     char *token = parse_token(ptr);
-    long pointer;
+    uword_t pointer;
     lispobj result;
     lispobj result;
-    long value;
+    uword_t value;
 
     if (token == NULL) {
         printf("expected an object\n");
 
     if (token == NULL) {
         printf("expected an object\n");
index 510f91f..96adef5 100644 (file)
@@ -14,4 +14,4 @@ extern boolean more_p(char **ptr);
 extern char *parse_token(char **ptr);
 extern lispobj parse_lispobj(char **ptr);
 extern char *parse_addr(char **ptr);
 extern char *parse_token(char **ptr);
 extern lispobj parse_lispobj(char **ptr);
 extern char *parse_addr(char **ptr);
-extern long parse_number(char **ptr);
+extern uword_t parse_number(char **ptr);
index 8520eb9..1dc6918 100644 (file)
@@ -197,7 +197,7 @@ output_space(FILE *file, int id, lispobj *addr, lispobj *end,
                                     core_compression_level);
 
     write_lispobj(data, file);
                                     core_compression_level);
 
     write_lispobj(data, file);
-    write_lispobj((long)addr / os_vm_page_size, file);
+    write_lispobj((uword_t)addr / os_vm_page_size, file);
     write_lispobj((bytes + os_vm_page_size - 1) / os_vm_page_size, file);
 }
 
     write_lispobj((bytes + os_vm_page_size - 1) / os_vm_page_size, file);
 }