From: David Lichteblau Date: Mon, 12 Nov 2012 15:35:23 +0000 (+0100) Subject: LLP64: change unsigned long to uword_t X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b727b3bff6f2a989e8e20e199945c2bf768214a9;p=sbcl.git LLP64: change unsigned long to uword_t Adjust uses of `unsigned long' in the C runtime for LLP64 platforms: Replace with `uword_t' where applicable. Thanks to Anton Kovalenko. --- diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp index b4de2df..892630f 100644 --- a/src/compiler/generic/objdef.lisp +++ b/src/compiler/generic/objdef.lisp @@ -143,7 +143,7 @@ ;; VECTOR -- see SHRINK-VECTOR. (length :ref-trans sb!c::vector-length :type index) - (data :rest-p t :c-type #!-alpha "unsigned long" #!+alpha "u32")) + (data :rest-p t :c-type #!-alpha "uword_t" #!+alpha "u32")) (define-primitive-object (code :type code-component :lowtag other-pointer-lowtag diff --git a/src/runtime/backtrace.c b/src/runtime/backtrace.c index e5b02a1..c618ca7 100644 --- a/src/runtime/backtrace.c +++ b/src/runtime/backtrace.c @@ -128,7 +128,7 @@ call_info_from_lisp_state(struct call_info *info) static void call_info_from_context(struct call_info *info, os_context_t *context) { - unsigned long pc; + uword_t pc; info->interrupted = 1; if (lowtag_of(*os_context_register_addr(context, reg_CODE)) @@ -136,15 +136,15 @@ call_info_from_context(struct call_info *info, os_context_t *context) /* We tried to call a function, but crapped out before $CODE could * be fixed up. Probably an undefined function. */ info->frame = - (struct call_frame *)(unsigned long) + (struct call_frame *)(uword_t) (*os_context_register_addr(context, reg_OCFP)); info->lra = (lispobj)(*os_context_register_addr(context, reg_LRA)); info->code = code_pointer(info->lra); - pc = (unsigned long)native_pointer(info->lra); + pc = (uword_t)native_pointer(info->lra); } else { info->frame = - (struct call_frame *)(unsigned long) + (struct call_frame *)(uword_t) (*os_context_register_addr(context, reg_CFP)); info->code = code_pointer(*os_context_register_addr(context, reg_CODE)); @@ -152,7 +152,7 @@ call_info_from_context(struct call_info *info, os_context_t *context) pc = *os_context_pc_addr(context); } if (info->code != NULL) - info->pc = pc - (unsigned long) info->code - + info->pc = pc - (uword_t) info->code - #ifndef LISP_FEATURE_ALPHA (HEADER_LENGTH(info->code->header) * sizeof(lispobj)); #else @@ -170,7 +170,7 @@ previous_info(struct call_info *info) int free_ici; if (!cs_valid_pointer_p(info->frame)) { - printf("Bogus callee value (0x%08lx).\n", (unsigned long)info->frame); + printf("Bogus callee value (0x%08lx).\n", (uword_t)info->frame); return 0; } @@ -188,7 +188,7 @@ previous_info(struct call_info *info) while (free_ici-- > 0) { os_context_t *context = thread->interrupt_contexts[free_ici]; - if ((struct call_frame *)(unsigned long) + if ((struct call_frame *)(uword_t) (*os_context_register_addr(context, reg_CFP)) == info->frame) { call_info_from_context(info, context); @@ -199,8 +199,8 @@ previous_info(struct call_info *info) else { info->code = code_pointer(info->lra); if (info->code != NULL) - info->pc = (unsigned long)native_pointer(info->lra) - - (unsigned long)info->code - + info->pc = (uword_t)native_pointer(info->lra) - + (uword_t)info->code - #ifndef LISP_FEATURE_ALPHA (HEADER_LENGTH(info->code->header) * sizeof(lispobj)); #else @@ -221,13 +221,13 @@ lisp_backtrace(int nframes) call_info_from_lisp_state(&info); do { - printf("entry_points; @@ -271,7 +271,7 @@ lisp_backtrace(int nframes) printf("CODE: ???, "); if (info.lra != NIL) - printf("LRA: 0x%08lx, ", (unsigned long)info.lra); + printf("LRA: 0x%08lx, ", (uword_t)info.lra); else printf(", "); @@ -304,12 +304,12 @@ stack_pointer_p (void *p) /* we are using sizeof(long) here, because that is the right value on both * x86 and x86-64. (But note that false positives would not cause much harm * given the heuristical nature of x86_call_context.) */ - unsigned long stack_alignment = sizeof(void*); + uword_t stack_alignment = sizeof(void*); return (altstack_pointer_p(p) || (p < (void *) arch_os_get_current_thread()->control_stack_end && (p > (void *) &p || altstack_pointer_p(&p)) - && (((unsigned long) p) & (stack_alignment-1)) == 0)); + && (((uword_t) p) & (stack_alignment-1)) == 0)); } static int @@ -318,7 +318,7 @@ ra_pointer_p (void *ra) /* the check against 4096 is still a mystery to everyone interviewed about * it, but recent changes to sb-sprof seem to suggest that such values * do occur sometimes. */ - return ((unsigned long) ra) > 4096 && !stack_pointer_p (ra); + return ((uword_t) ra) > 4096 && !stack_pointer_p (ra); } static int @@ -349,9 +349,9 @@ x86_call_context (void *fp, void **ra, void **ocfp) struct compiled_debug_fun * debug_function_from_pc (struct code* code, void *pc) { - unsigned long code_header_len = sizeof(lispobj) * HeaderValue(code->header); - unsigned long offset - = (unsigned long) pc - (unsigned long) code - code_header_len; + uword_t code_header_len = sizeof(lispobj) * HeaderValue(code->header); + uword_t offset + = (uword_t) pc - (uword_t) code - code_header_len; struct compiled_debug_fun *df; struct compiled_debug_info *di; struct vector *v; @@ -374,7 +374,7 @@ debug_function_from_pc (struct code* code, void *pc) if (i == len) return ((struct compiled_debug_fun *) native_pointer(v->data[i - 1])); - if (offset >= (unsigned long)fixnum_value(df->elsewhere_pc)) { + if (offset >= (uword_t)fixnum_value(df->elsewhere_pc)) { struct compiled_debug_fun *p = ((struct compiled_debug_fun *) native_pointer(v->data[i + 1])); next_pc = fixnum_value(p->elsewhere_pc); @@ -556,8 +556,8 @@ backtrace_from_fp(void *fp, int nframes) if (dladdr(ra, &info)) { printf("Foreign function %s, fp = 0x%lx, ra = 0x%lx", info.dli_sname, - (unsigned long) next_fp, - (unsigned long) ra); + (uword_t) next_fp, + (uword_t) ra); } else #endif printf("Foreign fp = 0x%p, ra = 0x%p", diff --git a/src/runtime/breakpoint.c b/src/runtime/breakpoint.c index 638b2e8..3c99cc4 100644 --- a/src/runtime/breakpoint.c +++ b/src/runtime/breakpoint.c @@ -102,20 +102,20 @@ static long compute_offset(os_context_t *context, lispobj code) if (code == NIL) return 0; else { - unsigned long code_start; + uword_t code_start; struct code *codeptr = (struct code *)native_pointer(code); #ifdef LISP_FEATURE_HPPA - unsigned long pc = *os_context_pc_addr(context) & ~3; + uword_t pc = *os_context_pc_addr(context) & ~3; #else - unsigned long pc = *os_context_pc_addr(context); + uword_t pc = *os_context_pc_addr(context); #endif - code_start = (unsigned long)codeptr + code_start = (uword_t)codeptr + HeaderValue(codeptr->header)*sizeof(lispobj); if (pc < code_start) return 0; else { - unsigned long offset = pc - code_start; + uword_t offset = pc - code_start; if (offset >= (N_WORD_BYTES * fixnum_value(codeptr->code_size))) return 0; else diff --git a/src/runtime/coreparse.c b/src/runtime/coreparse.c index c3006c5..a1da36e 100644 --- a/src/runtime/coreparse.c +++ b/src/runtime/coreparse.c @@ -291,11 +291,11 @@ process_directory(int fd, lispobj *ptr, int count, os_vm_offset_t file_offset) os_vm_address_t addr = (os_vm_address_t) (os_vm_page_size * entry->address); lispobj *free_pointer = (lispobj *) addr + entry->nwords; - unsigned long len = os_vm_page_size * entry->page_count; + uword_t len = os_vm_page_size * entry->page_count; if (len != 0) { os_vm_address_t real_addr; FSHOW((stderr, "/mapping %ld(0x%lx) bytes at 0x%lx\n", - len, len, (unsigned long)addr)); + len, len, (uword_t)addr)); if (compressed) { #ifdef LISP_FEATURE_SB_CORE_COMPRESSION real_addr = inflate_core_bytes(fd, offset + file_offset, addr, len); @@ -323,9 +323,8 @@ process_directory(int fd, lispobj *ptr, int count, os_vm_offset_t file_offset) madvise(addr, len, MADV_MERGEABLE); } #endif - - FSHOW((stderr, "/space id = %ld, free pointer = 0x%lx\n", - id, (unsigned long)free_pointer)); + FSHOW((stderr, "/space id = %ld, free pointer = 0x%p\n", + id, (uword_t)free_pointer)); switch (id) { case DYNAMIC_CORE_SPACE_ID: diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index c5ff999..1858839 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -237,7 +237,7 @@ trans_code(struct code *code) struct code *new_code; lispobj first, l_code, l_new_code; uword_t nheader_words, ncode_words, nwords; - unsigned long displacement; + uword_t displacement; lispobj fheaderl, *prev_pointer; /* if object has already been transported, just return pointer */ @@ -265,7 +265,7 @@ trans_code(struct code *code) #if defined(DEBUG_CODE_GC) printf("Old code object at 0x%08x, new code object at 0x%08x.\n", - (unsigned long) code, (unsigned long) new_code); + (uword_t) code, (uword_t) new_code); printf("Code object is %d words long.\n", nwords); #endif @@ -399,8 +399,8 @@ static long scav_return_pc_header(lispobj *where, lispobj object) { lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x\n", - (unsigned long) where, - (unsigned long) object); + (uword_t) where, + (uword_t) object); return 0; /* bogus return value to satisfy static type checking */ } #endif /* LISP_FEATURE_X86 */ @@ -409,7 +409,7 @@ static lispobj trans_return_pc_header(lispobj object) { struct simple_fun *return_pc; - unsigned long offset; + uword_t offset; struct code *code, *ncode; return_pc = (struct simple_fun *) native_pointer(object); @@ -417,7 +417,7 @@ trans_return_pc_header(lispobj object) offset = HeaderValue(return_pc->header) * N_WORD_BYTES; /* Transport the whole code object */ - code = (struct code *) ((unsigned long) return_pc - offset); + code = (struct code *) ((uword_t) return_pc - offset); ncode = trans_code(code); return ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG; @@ -454,8 +454,8 @@ static long scav_fun_header(lispobj *where, lispobj object) { lose("attempted to scavenge a function header where=0x%08x object=0x%08x\n", - (unsigned long) where, - (unsigned long) object); + (uword_t) where, + (uword_t) object); return 0; /* bogus return value to satisfy static type checking */ } #endif /* LISP_FEATURE_X86 */ @@ -464,7 +464,7 @@ static lispobj trans_fun_header(lispobj object) { struct simple_fun *fheader; - unsigned long offset; + uword_t offset; struct code *code, *ncode; fheader = (struct simple_fun *) native_pointer(object); @@ -472,7 +472,7 @@ trans_fun_header(lispobj object) offset = HeaderValue(fheader->header) * N_WORD_BYTES; /* Transport the whole code object */ - code = (struct code *) ((unsigned long) fheader - offset); + code = (struct code *) ((uword_t) fheader - offset); ncode = trans_code(code); return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG; @@ -677,7 +677,7 @@ static lispobj trans_boxed(lispobj object) { lispobj header; - unsigned long length; + uword_t length; gc_assert(is_lisp_pointer(object)); @@ -693,7 +693,7 @@ static long size_boxed(lispobj *where) { lispobj header; - unsigned long length; + uword_t length; header = *where; length = HeaderValue(header) + 1; @@ -735,7 +735,7 @@ scav_fdefn(lispobj *where, lispobj object) static long scav_unboxed(lispobj *where, lispobj object) { - unsigned long length; + uword_t length; length = HeaderValue(object) + 1; length = CEILING(length, 2); @@ -747,7 +747,7 @@ static lispobj trans_unboxed(lispobj object) { lispobj header; - unsigned long length; + uword_t length; gc_assert(is_lisp_pointer(object)); @@ -763,7 +763,7 @@ static long size_unboxed(lispobj *where) { lispobj header; - unsigned long length; + uword_t length; header = *where; length = HeaderValue(header) + 1; @@ -1601,7 +1601,7 @@ weak_hash_entry_alivep (lispobj weakness, lispobj key, lispobj value) * length) or NULL if it isn't an array of the specified widetag after * all. */ static inline lispobj * -get_array_data (lispobj array, int widetag, unsigned long *length) +get_array_data (lispobj array, int widetag, uword_t *length) { if (is_lisp_pointer(array) && (widetag_of(*(lispobj *)native_pointer(array)) == widetag)) { @@ -1622,16 +1622,16 @@ static void scav_hash_table_entries (struct hash_table *hash_table) { lispobj *kv_vector; - unsigned long kv_length; + uword_t kv_length; lispobj *index_vector; - unsigned long length; + uword_t length; lispobj *next_vector; - unsigned long next_vector_length; + uword_t next_vector_length; lispobj *hash_vector; - unsigned long hash_vector_length; + uword_t hash_vector_length; lispobj empty_symbol; lispobj weakness = hash_table->weakness; - unsigned long i; + uword_t i; kv_vector = get_array_data(hash_table->table, SIMPLE_VECTOR_WIDETAG, &kv_length); @@ -1694,7 +1694,7 @@ scav_hash_table_entries (struct hash_table *hash_table) long scav_vector (lispobj *where, lispobj object) { - unsigned long kv_length; + uword_t kv_length; lispobj *kv_vector; struct hash_table *hash_table; @@ -1720,7 +1720,7 @@ scav_vector (lispobj *where, lispobj object) "non-fatal corruption caused by concurrent access to a " "hash-table from multiple threads. Any accesses to " "hash-tables shared between threads should be protected " - "by locks.\n", (unsigned long)&where[2]); + "by locks.\n", (uword_t)&where[2]); // We've scavenged three words. return 3; } @@ -1814,13 +1814,13 @@ scan_weak_hash_table (struct hash_table *hash_table) { lispobj *kv_vector; lispobj *index_vector; - unsigned long length = 0; /* prevent warning */ + uword_t length = 0; /* prevent warning */ lispobj *next_vector; - unsigned long next_vector_length = 0; /* prevent warning */ + uword_t next_vector_length = 0; /* prevent warning */ lispobj *hash_vector; lispobj empty_symbol; lispobj weakness = hash_table->weakness; - unsigned long i; + uword_t i; kv_vector = get_array_data(hash_table->table, SIMPLE_VECTOR_WIDETAG, NULL); @@ -1864,7 +1864,7 @@ static long scav_lose(lispobj *where, lispobj object) { lose("no scavenge function for object 0x%08x (widetag 0x%x)\n", - (unsigned long)object, + (uword_t)object, widetag_of(*where)); return 0; /* bogus return value to satisfy static type checking */ @@ -1874,7 +1874,7 @@ static lispobj trans_lose(lispobj object) { lose("no transport function for object 0x%08x (widetag 0x%x)\n", - (unsigned long)object, + (uword_t)object, widetag_of(*(lispobj*)native_pointer(object))); return NIL; /* bogus return value to satisfy static type checking */ } @@ -1883,7 +1883,7 @@ static long size_lose(lispobj *where) { lose("no size function for object at 0x%08x (widetag 0x%x)\n", - (unsigned long)where, + (uword_t)where, widetag_of(*where)); return 1; /* bogus return value to satisfy static type checking */ } @@ -1896,7 +1896,7 @@ size_lose(lispobj *where) void gc_init_tables(void) { - unsigned long i, j; + uword_t i, j; /* Set default value in all slots of scavenge table. FIXME * replace this gnarly sizeof with something based on @@ -2745,23 +2745,23 @@ scrub_thread_control_stack(struct thread *th) #ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD do { *sp = 0; - } while (((unsigned long)sp--) & (BYTES_ZERO_BEFORE_END - 1)); + } while (((uword_t)sp--) & (BYTES_ZERO_BEFORE_END - 1)); if ((os_vm_address_t)sp < (hard_guard_page_address + os_vm_page_size)) return; do { if (*sp) goto scrub; - } while (((unsigned long)sp--) & (BYTES_ZERO_BEFORE_END - 1)); + } while (((uword_t)sp--) & (BYTES_ZERO_BEFORE_END - 1)); #else do { *sp = 0; - } while (((unsigned long)++sp) & (BYTES_ZERO_BEFORE_END - 1)); + } while (((uword_t)++sp) & (BYTES_ZERO_BEFORE_END - 1)); if ((os_vm_address_t)sp >= hard_guard_page_address) return; do { if (*sp) goto scrub; - } while (((unsigned long)++sp) & (BYTES_ZERO_BEFORE_END - 1)); + } while (((uword_t)++sp) & (BYTES_ZERO_BEFORE_END - 1)); #endif #endif /* LISP_FEATURE_C_STACK_IS_CONTROL_STACK */ } @@ -2846,7 +2846,7 @@ static int boxed_registers[] = BOXED_REGISTERS; *os_context_ctr_addr(context) #define INTERIOR_POINTER_VARS(name) \ - unsigned long name##_offset; \ + uword_t name##_offset; \ int name##_register_pair #define PAIR_INTERIOR_POINTER(name) \ @@ -2875,8 +2875,8 @@ static int boxed_registers[] = BOXED_REGISTERS; static void -pair_interior_pointer(os_context_t *context, unsigned long pointer, - unsigned long *saved_offset, int *register_pair) +pair_interior_pointer(os_context_t *context, uword_t pointer, + uword_t *saved_offset, int *register_pair) { int i; @@ -2887,10 +2887,10 @@ pair_interior_pointer(os_context_t *context, unsigned long pointer, */ /* 0x7FFFFFFF on 32-bit platforms; 0x7FFFFFFFFFFFFFFF on 64-bit platforms */ - *saved_offset = (((unsigned long)1) << (N_WORD_BITS - 1)) - 1; + *saved_offset = (((uword_t)1) << (N_WORD_BITS - 1)) - 1; *register_pair = -1; for (i = 0; i < (sizeof(boxed_registers) / sizeof(int)); i++) { - unsigned long reg; + uword_t reg; long offset; int index; diff --git a/src/runtime/gc-internal.h b/src/runtime/gc-internal.h index d7123a4..7eb8598 100644 --- a/src/runtime/gc-internal.h +++ b/src/runtime/gc-internal.h @@ -54,13 +54,13 @@ do { \ #define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1))) -static inline unsigned long -NWORDS(unsigned long x, unsigned long n_bits) +static inline uword_t +NWORDS(uword_t x, uword_t n_bits) { /* A good compiler should be able to constant-fold this whole thing, even with the conditional. */ if(n_bits <= N_WORD_BITS) { - unsigned long elements_per_word = N_WORD_BITS/n_bits; + uword_t elements_per_word = N_WORD_BITS/n_bits; return CEILING(x, elements_per_word)/elements_per_word; } diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index c8defa3..13d4ff2 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -1908,7 +1908,7 @@ static lispobj trans_boxed_large(lispobj object) { lispobj header; - unsigned long length; + uword_t length; gc_assert(is_lisp_pointer(object)); @@ -1925,7 +1925,7 @@ static lispobj trans_unboxed_large(lispobj object) { lispobj header; - unsigned long length; + uword_t length; gc_assert(is_lisp_pointer(object)); @@ -2052,9 +2052,9 @@ maybe_adjust_large_object(lispobj *where) page_index_t next_page; long nwords; - unsigned long remaining_bytes; - unsigned long bytes_freed; - unsigned long old_bytes_used; + uword_t remaining_bytes; + uword_t bytes_freed; + uword_t old_bytes_used; int boxed; @@ -2241,7 +2241,7 @@ preserve_pointer(void *addr) /* quick check 2: Check the offset within the page. * */ - if (((unsigned long)addr & (GENCGC_CARD_BYTES - 1)) > + if (((uword_t)addr & (GENCGC_CARD_BYTES - 1)) > page_table[addr_page_index].bytes_used) return; @@ -2293,7 +2293,7 @@ preserve_pointer(void *addr) if (page_free_p(addr_page_index) || (page_table[addr_page_index].bytes_used == 0) /* Check the offset within the page. */ - || (((unsigned long)addr & (GENCGC_CARD_BYTES - 1)) + || (((uword_t)addr & (GENCGC_CARD_BYTES - 1)) > page_table[addr_page_index].bytes_used)) { FSHOW((stderr, "weird? ignore ptr 0x%x to freed area of large object\n", @@ -2482,7 +2482,7 @@ scavenge_generations(generation_index_t from, generation_index_t to) } if (!write_protected) { scavenge(page_address(i), - ((unsigned long)(page_table[last_page].bytes_used + ((uword_t)(page_table[last_page].bytes_used + npage_bytes(last_page-i))) /N_WORD_BYTES); @@ -2599,7 +2599,7 @@ scavenge_newspace_generation_one_scan(generation_index_t generation) /* Do a limited check for write-protected pages. */ if (!all_wp) { - long nwords = (((unsigned long) + long nwords = (((uword_t) (page_table[last_page].bytes_used + npage_bytes(last_page-i) + page_table[i].region_start_offset)) @@ -2765,7 +2765,7 @@ unprotect_oldspace(void) page_index_t i; void *region_addr = 0; void *page_addr = 0; - unsigned long region_bytes = 0; + uword_t region_bytes = 0; for (i = 0; i < last_free_page; i++) { if (page_allocated_p(i) @@ -2804,10 +2804,10 @@ unprotect_oldspace(void) * assumes that all objects have been copied or promoted to an older * generation. Bytes_allocated and the generation bytes_allocated * counter are updated. The number of bytes freed is returned. */ -static unsigned long +static uword_t free_oldspace(void) { - unsigned long bytes_freed = 0; + uword_t bytes_freed = 0; page_index_t first_page, last_page; first_page = 0; @@ -2906,8 +2906,8 @@ verify_space(lispobj *start, size_t words) { int is_in_dynamic_space = (find_page_index((void*)start) != -1); int is_in_readonly_space = - (READ_ONLY_SPACE_START <= (unsigned long)start && - (unsigned long)start < SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0)); + (READ_ONLY_SPACE_START <= (uword_t)start && + (uword_t)start < SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0)); while (words > 0) { size_t count = 1; @@ -3211,7 +3211,7 @@ verify_generation(generation_index_t generation) break; verify_space(page_address(i), - ((unsigned long) + ((uword_t) (page_table[last_page].bytes_used + npage_bytes(last_page-i))) / N_WORD_BYTES); @@ -3240,7 +3240,7 @@ verify_zero_fill(void) } else { long free_bytes = GENCGC_CARD_BYTES - page_table[page].bytes_used; if (free_bytes > 0) { - long *start_addr = (long *)((unsigned long)page_address(page) + long *start_addr = (long *)((uword_t)page_address(page) + page_table[page].bytes_used); long size = free_bytes / N_WORD_BYTES; long i; @@ -3367,9 +3367,9 @@ preserve_context_registers (os_context_t *c) static void garbage_collect_generation(generation_index_t generation, int raise) { - unsigned long bytes_freed; + uword_t bytes_freed; page_index_t i; - unsigned long static_space_size; + uword_t static_space_size; struct thread *th; gc_assert(generation <= HIGHEST_NORMAL_GENERATION); @@ -3592,7 +3592,7 @@ garbage_collect_generation(generation_index_t generation, int raise) * please submit a patch. */ #if 0 if (SymbolValue(SCAVENGE_READ_ONLY_SPACE) != NIL) { - unsigned long read_only_space_size = + uword_t read_only_space_size = (lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER) - (lispobj*)READ_ONLY_SPACE_START; FSHOW((stderr, @@ -4198,7 +4198,7 @@ general_alloc_internal(long nbytes, int page_type_flag, struct alloc_region *reg gc_assert(nbytes>0); /* Check for alignment allocation problems. */ - gc_assert((((unsigned long)region->free_pointer & LOWTAG_MASK) == 0) + gc_assert((((uword_t)region->free_pointer & LOWTAG_MASK) == 0) && ((nbytes & LOWTAG_MASK) == 0)); #if !(defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD)) diff --git a/src/runtime/interr.c b/src/runtime/interr.c index 22cbc2a..889d644 100644 --- a/src/runtime/interr.c +++ b/src/runtime/interr.c @@ -88,7 +88,7 @@ void print_message(char *fmt, va_list ap) { fprintf(stderr, " in SBCL pid %d",getpid()); #if defined(LISP_FEATURE_SB_THREAD) - fprintf(stderr, "(tid %lu)", (unsigned long) thread_self()); + fprintf(stderr, "(tid %lu)", (uword_t) thread_self()); #endif if (fmt) { fprintf(stderr, ":\n"); diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 27ab564..181e2a4 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -642,9 +642,9 @@ build_fake_control_stack_frames(struct thread *th,os_context_t *context) /* Build a fake stack frame or frames */ access_control_frame_pointer(th) = - (lispobj *)(unsigned long) + (lispobj *)(uword_t) (*os_context_register_addr(context, reg_CSP)); - if ((lispobj *)(unsigned long) + if ((lispobj *)(uword_t) (*os_context_register_addr(context, reg_CFP)) == access_control_frame_pointer(th)) { /* There is a small window during call where the callee's @@ -702,7 +702,7 @@ fake_foreign_function_call(os_context_t *context) thread->pseudo_atomic_bits = #else dynamic_space_free_pointer = - (lispobj *)(unsigned long) + (lispobj *)(uword_t) #endif (*os_context_register_addr(context, reg_ALLOC)); /* fprintf(stderr,"dynamic_space_free_pointer: %p\n", */ @@ -766,13 +766,13 @@ undo_fake_foreign_function_call(os_context_t *context) #if defined(reg_ALLOC) && !defined(LISP_FEATURE_SB_THREAD) /* Put the dynamic space free pointer back into the context. */ *os_context_register_addr(context, reg_ALLOC) = - (unsigned long) dynamic_space_free_pointer + (uword_t) dynamic_space_free_pointer | (*os_context_register_addr(context, reg_ALLOC) & LOWTAG_MASK); /* - ((unsigned long)(*os_context_register_addr(context, reg_ALLOC)) + ((uword_t)(*os_context_register_addr(context, reg_ALLOC)) & ~LOWTAG_MASK) - | ((unsigned long) dynamic_space_free_pointer & LOWTAG_MASK); + | ((uword_t) dynamic_space_free_pointer & LOWTAG_MASK); */ #endif #if defined(reg_ALLOC) && defined(LISP_FEATURE_SB_THREAD) @@ -780,7 +780,7 @@ undo_fake_foreign_function_call(os_context_t *context) * into the context (p-a-bits for p-a, and dynamic space free * pointer for ROOM). */ *os_context_register_addr(context, reg_ALLOC) = - (unsigned long) dynamic_space_free_pointer + (uword_t) dynamic_space_free_pointer | (thread->pseudo_atomic_bits & LOWTAG_MASK); /* And clear them so we don't get bit later by call-in/call-out * not updating them. */ @@ -1862,7 +1862,7 @@ undoably_install_low_level_interrupt_handler (int signal, #endif /* This is called from Lisp. */ -unsigned long +uword_t install_handler(int signal, void handler(int, siginfo_t*, os_context_t*)) { #ifndef LISP_FEATURE_WIN32 @@ -1901,7 +1901,7 @@ install_handler(int signal, void handler(int, siginfo_t*, os_context_t*)) FSHOW((stderr, "/leaving POSIX install_handler(%d, ..)\n", signal)); - return (unsigned long)oldhandler.lisp; + return (uword_t)oldhandler.lisp; #else /* Probably-wrong Win32 hack */ return 0; diff --git a/src/runtime/interrupt.h b/src/runtime/interrupt.h index 83514d7..a27eb08 100644 --- a/src/runtime/interrupt.h +++ b/src/runtime/interrupt.h @@ -157,7 +157,7 @@ typedef void (*interrupt_handler_t)(int, siginfo_t *, os_context_t *); extern void undoably_install_low_level_interrupt_handler ( int signal, interrupt_handler_t handler); -extern unsigned long install_handler(int signal, +extern uword_t install_handler(int signal, interrupt_handler_t handler); extern union interrupt_handler interrupt_handlers[NSIG]; diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c index e663074..30f9fc7 100644 --- a/src/runtime/monitor.c +++ b/src/runtime/monitor.c @@ -266,10 +266,10 @@ search_cmd(char **ptr) start = end = addr; lastcount = count; - printf("searching for 0x%x at 0x%p\n", val, (void*)(unsigned long)end); + printf("searching for 0x%x at 0x%p\n", val, (void*)(uword_t)end); while (search_for_type(val, &end, &count)) { - printf("found 0x%x at 0x%p:\n", val, (void*)(unsigned long)end); + printf("found 0x%x at 0x%p:\n", val, (void*)(uword_t)end); obj = *end; addr = end; end += 2; @@ -419,16 +419,16 @@ catchers_cmd(char **ptr) while (catch != NULL) { printf("0x%08lX:\n\tuwp: 0x%08lX\n\tfp: 0x%08lX\n\t" "code: 0x%08lX\n\tentry: 0x%08lX\n\ttag: ", - (unsigned long)catch, - (unsigned long)(catch->current_uwp), - (unsigned long)(catch->current_cont), + (uword_t)catch, + (uword_t)(catch->current_uwp), + (uword_t)(catch->current_cont), #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) - (unsigned long)component_ptr_from_pc((void*)catch->entry_pc) + (uword_t)component_ptr_from_pc((void*)catch->entry_pc) + OTHER_POINTER_LOWTAG, #else - (unsigned long)(catch->current_code), + (uword_t)(catch->current_code), #endif - (unsigned long)(catch->entry_pc)); + (uword_t)(catch->entry_pc)); brief_print((lispobj)catch->tag); catch = catch->previous_catch; } diff --git a/src/runtime/pseudo-atomic.h b/src/runtime/pseudo-atomic.h index 230e3e8..0c2ea7f 100644 --- a/src/runtime/pseudo-atomic.h +++ b/src/runtime/pseudo-atomic.h @@ -100,10 +100,10 @@ clear_pseudo_atomic_interrupted(struct thread *thread) #define set_alloc_pointer(value) \ (dynamic_space_free_pointer = \ ((lispobj *) \ - ((value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK)))) + ((value) | (((uword_t)dynamic_space_free_pointer) & LOWTAG_MASK)))) #define get_alloc_pointer() \ - ((unsigned long) dynamic_space_free_pointer & ~LOWTAG_MASK) + ((uword_t) dynamic_space_free_pointer & ~LOWTAG_MASK) #ifdef LISP_FEATURE_SB_THREAD #define get_pseudo_atomic_atomic(thread) \ @@ -120,21 +120,21 @@ clear_pseudo_atomic_interrupted(struct thread *thread) ((thread)->pseudo_atomic_bits &= ~flag_PseudoAtomicInterrupted) #else #define get_pseudo_atomic_atomic(thread) \ - ((unsigned long)dynamic_space_free_pointer & flag_PseudoAtomic) + ((uword_t)dynamic_space_free_pointer & flag_PseudoAtomic) #define set_pseudo_atomic_atomic(thread) \ (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long)dynamic_space_free_pointer | flag_PseudoAtomic)) + = (lispobj*) ((uword_t)dynamic_space_free_pointer | flag_PseudoAtomic)) #define clear_pseudo_atomic_atomic(thread) \ (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomic)) + = (lispobj*) ((uword_t) dynamic_space_free_pointer & ~flag_PseudoAtomic)) #define get_pseudo_atomic_interrupted(thread) \ - ((unsigned long) dynamic_space_free_pointer & flag_PseudoAtomicInterrupted) + ((uword_t) dynamic_space_free_pointer & flag_PseudoAtomicInterrupted) #define clear_pseudo_atomic_interrupted(thread) \ (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomicInterrupted)) + = (lispobj*) ((uword_t) dynamic_space_free_pointer & ~flag_PseudoAtomicInterrupted)) #define set_pseudo_atomic_interrupted(thread) \ (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer | flag_PseudoAtomicInterrupted)) + = (lispobj*) ((uword_t) dynamic_space_free_pointer | flag_PseudoAtomicInterrupted)) #endif #endif diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 4d7ab2e..387c686 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -243,7 +243,7 @@ widetag_of(lispobj obj) return obj & WIDETAG_MASK; } -static inline unsigned long +static inline uword_t HeaderValue(lispobj obj) { return obj >> N_WIDETAG_BITS; diff --git a/src/runtime/save.c b/src/runtime/save.c index 8478e1d..f9b6867 100644 --- a/src/runtime/save.c +++ b/src/runtime/save.c @@ -311,9 +311,9 @@ save_to_filehandle(FILE *file, char *filename, lispobj init_function, { size_t size = (last_free_page*sizeof(long)+os_vm_page_size-1) &~(os_vm_page_size-1); - unsigned long *data = calloc(size, 1); + uword_t *data = calloc(size, 1); if (data) { - unsigned long word; + uword_t word; long offset; page_index_t i; for (i = 0; i < last_free_page; i++) { diff --git a/src/runtime/thread.c b/src/runtime/thread.c index a30ff4f..799b78e 100644 --- a/src/runtime/thread.c +++ b/src/runtime/thread.c @@ -509,9 +509,9 @@ create_thread_struct(lispobj initial_function) { return NULL; /* Aligning up is safe as THREAD_STRUCT_SIZE has * THREAD_ALIGNMENT_BYTES padding. */ - aligned_spaces = (void *)((((unsigned long)(char *)spaces) + aligned_spaces = (void *)((((uword_t)(char *)spaces) + THREAD_ALIGNMENT_BYTES-1) - &~(unsigned long)(THREAD_ALIGNMENT_BYTES-1)); + &~(uword_t)(THREAD_ALIGNMENT_BYTES-1)); void* csp_page= (aligned_spaces+ thread_control_stack_size+ diff --git a/src/runtime/validate.c b/src/runtime/validate.c index d00c391..2b9fc69 100644 --- a/src/runtime/validate.c +++ b/src/runtime/validate.c @@ -26,13 +26,13 @@ static void -ensure_space(lispobj *start, unsigned long size) +ensure_space(lispobj *start, uword_t size) { if (os_validate((os_vm_address_t)start,(os_vm_size_t)size)==NULL) { fprintf(stderr, "ensure_space: failed to validate %ld bytes at 0x%08lx\n", size, - (unsigned long)start); + (uword_t)start); fprintf(stderr, "(hint: Try \"ulimit -a\"; maybe you should increase memory limits.)\n"); exit(1); diff --git a/src/runtime/vars.c b/src/runtime/vars.c index 03b8ec2..820ec49 100644 --- a/src/runtime/vars.c +++ b/src/runtime/vars.c @@ -38,7 +38,7 @@ struct var { static int hash_name(char *name) { - unsigned long value = 0; + uword_t value = 0; while (*name != '\0') { value = (value << 1) ^ *(unsigned char *)(name++); @@ -50,7 +50,7 @@ static int hash_name(char *name) static int hash_obj(lispobj obj) { - return (unsigned long)obj % OBJ_BUCKETS; + return (uword_t)obj % OBJ_BUCKETS; } void flush_vars() diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index 62333e2..53a219f 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -237,7 +237,7 @@ arch_handle_fun_end_breakpoint(os_context_t *context) { *os_context_pc_addr(context) -= BREAKPOINT_WIDTH; *os_context_pc_addr(context) = - (unsigned long)handle_fun_end_breakpoint(context); + (uword_t)handle_fun_end_breakpoint(context); } void @@ -392,7 +392,7 @@ arch_install_interrupt_handlers() void arch_write_linkage_table_jmp(char * reloc, void * fun) { - unsigned long addr = (unsigned long) fun; + uword_t addr = (uword_t) fun; int i; *reloc++ = 0xFF; /* Opcode for near jump to absolute reg/mem64. */ @@ -414,7 +414,7 @@ arch_write_linkage_table_jmp(char * reloc, void * fun) void arch_write_linkage_table_ref(void * reloc, void * data) { - *(unsigned long *)reloc = (unsigned long)data; + *(uword_t *)reloc = (uword_t)data; } #endif