From: David Lichteblau Date: Mon, 12 Nov 2012 17:19:47 +0000 (+0100) Subject: LLP64: change signed long to sword_t X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=1b6d885eaf7872b41947e0ea0da134cceee4cc0f;p=sbcl.git LLP64: change signed long to sword_t Adjust uses of `long' in the C runtime for LLP64 platforms: Replace `long' with `sword_t' where applicable. Thanks to Anton Kovalenko. --- diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp index 892630f..b3cb447 100644 --- a/src/compiler/generic/objdef.lisp +++ b/src/compiler/generic/objdef.lisp @@ -51,7 +51,7 @@ (define-primitive-object (bignum :lowtag other-pointer-lowtag :widetag bignum-widetag :alloc-trans sb!bignum::%allocate-bignum) - (digits :rest-p t :c-type #!-alpha "long" #!+alpha "u32")) + (digits :rest-p t :c-type #!-alpha "sword_t" #!+alpha "u32")) (define-primitive-object (ratio :type ratio :lowtag other-pointer-lowtag diff --git a/src/runtime/alloc.c b/src/runtime/alloc.c index 9e97887..92e237b 100644 --- a/src/runtime/alloc.c +++ b/src/runtime/alloc.c @@ -154,7 +154,7 @@ alloc_cons(lispobj car, lispobj cdr) } lispobj -alloc_number(long n) +alloc_number(sword_t n) { struct bignum *ptr; diff --git a/src/runtime/alloc.h b/src/runtime/alloc.h index ef3df77..c4fd37a 100644 --- a/src/runtime/alloc.h +++ b/src/runtime/alloc.h @@ -17,11 +17,11 @@ #include "gc-internal.h" #ifdef LISP_FEATURE_GENCGC -extern lispobj *general_alloc(long bytes, int page_type_flag); +extern lispobj *general_alloc(sword_t bytes, int page_type_flag); #endif extern lispobj alloc_cons(lispobj car, lispobj cdr); -extern lispobj alloc_number(long n); +extern lispobj alloc_number(sword_t n); extern lispobj alloc_string(char *str); extern lispobj alloc_sap(void *ptr); extern lispobj alloc_base_string(char *str); diff --git a/src/runtime/core.h b/src/runtime/core.h index 3f05cd5..594026f 100644 --- a/src/runtime/core.h +++ b/src/runtime/core.h @@ -17,11 +17,11 @@ struct ndir_entry { #ifndef LISP_FEATURE_ALPHA - long identifier; - long nwords; - long data_page; - long address; - long page_count; + sword_t identifier; + sword_t nwords; + sword_t data_page; + sword_t address; + sword_t page_count; #else u32 identifier; u32 nwords; diff --git a/src/runtime/coreparse.c b/src/runtime/coreparse.c index a1da36e..46ff537 100644 --- a/src/runtime/coreparse.c +++ b/src/runtime/coreparse.c @@ -280,14 +280,15 @@ process_directory(int fd, lispobj *ptr, int count, os_vm_offset_t file_offset) FSHOW((stderr, "/process_directory(..), count=%d\n", count)); for (entry = (struct ndir_entry *) ptr; --count>= 0; ++entry) { + compressed = 0; - long id = entry->identifier; + sword_t id = entry->identifier; if (id <= (MAX_CORE_SPACE_ID | DEFLATED_CORE_SPACE_ID_FLAG)) { if (id & DEFLATED_CORE_SPACE_ID_FLAG) compressed = 1; id &= ~(DEFLATED_CORE_SPACE_ID_FLAG); } - long offset = os_vm_page_size * (1 + entry->data_page); + sword_t offset = os_vm_page_size * (1 + entry->data_page); os_vm_address_t addr = (os_vm_address_t) (os_vm_page_size * entry->address); lispobj *free_pointer = (lispobj *) addr + entry->nwords; diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index 1858839..c0a7119 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -85,9 +85,9 @@ set_forwarding_pointer(lispobj * pointer, lispobj newspace_copy) { return newspace_copy; } -long (*scavtab[256])(lispobj *where, lispobj object); +sword_t (*scavtab[256])(lispobj *where, lispobj object); lispobj (*transother[256])(lispobj object); -long (*sizetab[256])(lispobj *where); +sword_t (*sizetab[256])(lispobj *where); struct weak_pointer *weak_pointers; os_vm_size_t bytes_consed_between_gcs = 12*1024*1024; @@ -100,28 +100,28 @@ os_vm_size_t bytes_consed_between_gcs = 12*1024*1024; /* to copy a boxed object */ lispobj -copy_object(lispobj object, long nwords) +copy_object(lispobj object, sword_t nwords) { return gc_general_copy_object(object, nwords, BOXED_PAGE_FLAG); } lispobj -copy_code_object(lispobj object, long nwords) +copy_code_object(lispobj object, sword_t nwords) { return gc_general_copy_object(object, nwords, CODE_PAGE_FLAG); } -static long scav_lose(lispobj *where, lispobj object); /* forward decl */ +static sword_t scav_lose(lispobj *where, lispobj object); /* forward decl */ /* FIXME: Most calls end up going to some trouble to compute an * 'n_words' value for this function. The system might be a little * simpler if this function used an 'end' parameter instead. */ void -scavenge(lispobj *start, long n_words) +scavenge(lispobj *start, sword_t n_words) { lispobj *end = start + n_words; lispobj *object_ptr; - long n_words_scavenged; + sword_t n_words_scavenged; for (object_ptr = start; object_ptr < end; @@ -194,7 +194,7 @@ If you can reproduce this warning, please send a bug report\n\ static lispobj trans_fun_header(lispobj object); /* forward decls */ static lispobj trans_boxed(lispobj object); -static long +static sword_t scav_fun_pointer(lispobj *where, lispobj object) { lispobj *first_pointer; @@ -317,8 +317,8 @@ trans_code(struct code *code) #ifdef LISP_FEATURE_GENCGC /* Cheneygc doesn't need this os_flush_icache, it flushes the whole spaces once when all copying is done. */ - os_flush_icache((os_vm_address_t) (((long *)new_code) + nheader_words), - ncode_words * sizeof(long)); + os_flush_icache((os_vm_address_t) (((sword_t *)new_code) + nheader_words), + ncode_words * sizeof(sword_t)); #endif @@ -329,11 +329,11 @@ trans_code(struct code *code) return new_code; } -static long +static sword_t scav_code_header(lispobj *where, lispobj object) { struct code *code; - long n_header_words, n_code_words, n_words; + sword_t n_header_words, n_code_words, n_words; lispobj entry_point; /* tagged pointer to entry point */ struct simple_fun *function_ptr; /* untagged pointer to entry point */ @@ -354,7 +354,7 @@ scav_code_header(lispobj *where, lispobj object) gc_assert_verbose(is_lisp_pointer(entry_point), "Entry point %lx\n is not a lisp pointer.", - (long)entry_point); + (sword_t)entry_point); function_ptr = (struct simple_fun *) native_pointer(entry_point); gc_assert(widetag_of(function_ptr->header)==SIMPLE_FUN_HEADER_WIDETAG); @@ -378,11 +378,11 @@ trans_code_header(lispobj object) } -static long +static sword_t size_code_header(lispobj *where) { struct code *code; - long nheader_words, ncode_words, nwords; + sword_t nheader_words, ncode_words, nwords; code = (struct code *) where; @@ -395,7 +395,7 @@ size_code_header(lispobj *where) } #if !defined(LISP_FEATURE_X86) && ! defined(LISP_FEATURE_X86_64) -static long +static sword_t scav_return_pc_header(lispobj *where, lispobj object) { lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x\n", @@ -430,7 +430,7 @@ trans_return_pc_header(lispobj object) * have to figure out that the function is still live. */ #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) -static long +static sword_t scav_closure_header(lispobj *where, lispobj object) { struct closure *closure; @@ -450,7 +450,7 @@ scav_closure_header(lispobj *where, lispobj object) #endif #if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) -static long +static sword_t scav_fun_header(lispobj *where, lispobj object) { lose("attempted to scavenge a function header where=0x%08x object=0x%08x\n", @@ -483,7 +483,7 @@ trans_fun_header(lispobj object) * instances */ -static long +static sword_t scav_instance_pointer(lispobj *where, lispobj object) { lispobj copy, *first_pointer; @@ -509,7 +509,7 @@ scav_instance_pointer(lispobj *where, lispobj object) static lispobj trans_list(lispobj object); -static long +static sword_t scav_list_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; @@ -593,7 +593,7 @@ trans_list(lispobj object) * scavenging and transporting other pointers */ -static long +static sword_t scav_other_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; @@ -623,13 +623,13 @@ scav_other_pointer(lispobj *where, lispobj object) * immediate, boxed, and unboxed objects */ -static long +static sword_t size_pointer(lispobj *where) { return 1; } -static long +static sword_t scav_immediate(lispobj *where, lispobj object) { return 1; @@ -642,24 +642,24 @@ trans_immediate(lispobj object) return NIL; /* bogus return value to satisfy static type checking */ } -static long +static sword_t size_immediate(lispobj *where) { return 1; } -static long +static sword_t scav_boxed(lispobj *where, lispobj object) { return 1; } -static long +static sword_t scav_instance(lispobj *where, lispobj object) { lispobj nuntagged; - long ntotal = HeaderValue(object); + sword_t ntotal = HeaderValue(object); lispobj layout = ((struct instance *)where)->slots[0]; if (!layout) @@ -689,7 +689,7 @@ trans_boxed(lispobj object) } -static long +static sword_t size_boxed(lispobj *where) { lispobj header; @@ -705,7 +705,7 @@ size_boxed(lispobj *where) /* Note: on the sparc we don't have to do anything special for fdefns, */ /* 'cause the raw-addr has a function lowtag. */ #if !defined(LISP_FEATURE_SPARC) -static long +static sword_t scav_fdefn(lispobj *where, lispobj object) { struct fdefn *fdefn; @@ -732,7 +732,7 @@ scav_fdefn(lispobj *where, lispobj object) } #endif -static long +static sword_t scav_unboxed(lispobj *where, lispobj object) { uword_t length; @@ -759,7 +759,7 @@ trans_unboxed(lispobj object) return copy_unboxed_object(object, length); } -static long +static sword_t size_unboxed(lispobj *where) { lispobj header; @@ -774,11 +774,11 @@ size_unboxed(lispobj *where) /* vector-like objects */ -static long +static sword_t scav_base_string(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; /* NOTE: Strings contain one more byte of data than the length */ /* slot indicates. */ @@ -793,7 +793,7 @@ static lispobj trans_base_string(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -808,11 +808,11 @@ trans_base_string(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_base_string(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; /* NOTE: A string contains one more byte of data (a terminating * '\0' to help when interfacing with C functions) than indicated @@ -825,7 +825,7 @@ size_base_string(lispobj *where) return nwords; } -static long +static sword_t scav_character_string(lispobj *where, lispobj object) { struct vector *vector; @@ -859,7 +859,7 @@ trans_character_string(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_character_string(lispobj *where) { struct vector *vector; @@ -880,7 +880,7 @@ static lispobj trans_vector(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -892,11 +892,11 @@ trans_vector(lispobj object) return copy_large_object(object, nwords); } -static long +static sword_t size_vector(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -905,7 +905,7 @@ size_vector(lispobj *where) return nwords; } -static long +static sword_t scav_vector_nil(lispobj *where, lispobj object) { return 2; @@ -918,18 +918,18 @@ trans_vector_nil(lispobj object) return copy_unboxed_object(object, 2); } -static long +static sword_t size_vector_nil(lispobj *where) { /* Just the header word and the length word */ return 2; } -static long +static sword_t scav_vector_bit(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -942,7 +942,7 @@ static lispobj trans_vector_bit(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -953,11 +953,11 @@ trans_vector_bit(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_bit(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -966,11 +966,11 @@ size_vector_bit(lispobj *where) return nwords; } -static long +static sword_t scav_vector_unsigned_byte_2(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -983,7 +983,7 @@ static lispobj trans_vector_unsigned_byte_2(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -994,11 +994,11 @@ trans_vector_unsigned_byte_2(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_2(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1007,11 +1007,11 @@ size_vector_unsigned_byte_2(lispobj *where) return nwords; } -static long +static sword_t scav_vector_unsigned_byte_4(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1024,7 +1024,7 @@ static lispobj trans_vector_unsigned_byte_4(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1034,11 +1034,11 @@ trans_vector_unsigned_byte_4(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_4(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1048,11 +1048,11 @@ size_vector_unsigned_byte_4(lispobj *where) } -static long +static sword_t scav_vector_unsigned_byte_8(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1069,7 +1069,7 @@ static lispobj trans_vector_unsigned_byte_8(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1080,11 +1080,11 @@ trans_vector_unsigned_byte_8(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_8(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1094,11 +1094,11 @@ size_vector_unsigned_byte_8(lispobj *where) } -static long +static sword_t scav_vector_unsigned_byte_16(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1111,7 +1111,7 @@ static lispobj trans_vector_unsigned_byte_16(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1122,11 +1122,11 @@ trans_vector_unsigned_byte_16(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_16(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1135,11 +1135,11 @@ size_vector_unsigned_byte_16(lispobj *where) return nwords; } -static long +static sword_t scav_vector_unsigned_byte_32(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1152,7 +1152,7 @@ static lispobj trans_vector_unsigned_byte_32(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1163,11 +1163,11 @@ trans_vector_unsigned_byte_32(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_32(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1177,11 +1177,11 @@ size_vector_unsigned_byte_32(lispobj *where) } #if N_WORD_BITS == 64 -static long +static sword_t scav_vector_unsigned_byte_64(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1194,7 +1194,7 @@ static lispobj trans_vector_unsigned_byte_64(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1205,11 +1205,11 @@ trans_vector_unsigned_byte_64(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_unsigned_byte_64(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1219,11 +1219,11 @@ size_vector_unsigned_byte_64(lispobj *where) } #endif -static long +static sword_t scav_vector_single_float(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1236,7 +1236,7 @@ static lispobj trans_vector_single_float(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1247,11 +1247,11 @@ trans_vector_single_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_single_float(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1260,11 +1260,11 @@ size_vector_single_float(lispobj *where) return nwords; } -static long +static sword_t scav_vector_double_float(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1277,7 +1277,7 @@ static lispobj trans_vector_double_float(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1288,11 +1288,11 @@ trans_vector_double_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_double_float(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1335,7 +1335,7 @@ static long size_vector_long_float(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1347,11 +1347,11 @@ size_vector_long_float(lispobj *where) #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG -static long +static sword_t scav_vector_complex_single_float(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1364,7 +1364,7 @@ static lispobj trans_vector_complex_single_float(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1375,11 +1375,11 @@ trans_vector_complex_single_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_complex_single_float(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1390,11 +1390,11 @@ size_vector_complex_single_float(lispobj *where) #endif #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG -static long +static sword_t scav_vector_complex_double_float(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1407,7 +1407,7 @@ static lispobj trans_vector_complex_double_float(lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1418,11 +1418,11 @@ trans_vector_complex_double_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static long +static sword_t size_vector_complex_double_float(lispobj *where) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1438,7 +1438,7 @@ static long scav_vector_complex_long_float(lispobj *where, lispobj object) { struct vector *vector; - long length, nwords; + sword_t length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1507,7 +1507,7 @@ trans_weak_pointer(lispobj object) return copy; } -static long +static sword_t size_weak_pointer(lispobj *where) { return WEAK_POINTER_NWORDS; @@ -1691,7 +1691,7 @@ scav_hash_table_entries (struct hash_table *hash_table) } } -long +sword_t scav_vector (lispobj *where, lispobj object) { uword_t kv_length; @@ -1860,7 +1860,7 @@ scan_weak_hash_tables (void) * initialization */ -static long +static sword_t scav_lose(lispobj *where, lispobj object) { lose("no scavenge function for object 0x%08x (widetag 0x%x)\n", @@ -1879,7 +1879,7 @@ trans_lose(lispobj object) return NIL; /* bogus return value to satisfy static type checking */ } -static long +static sword_t size_lose(lispobj *where) { lose("no size function for object at 0x%08x (widetag 0x%x)\n", @@ -2891,7 +2891,7 @@ pair_interior_pointer(os_context_t *context, uword_t pointer, *register_pair = -1; for (i = 0; i < (sizeof(boxed_registers) / sizeof(int)); i++) { uword_t reg; - long offset; + sword_t offset; int index; index = boxed_registers[i]; diff --git a/src/runtime/gc-internal.h b/src/runtime/gc-internal.h index 7eb8598..c23febf 100644 --- a/src/runtime/gc-internal.h +++ b/src/runtime/gc-internal.h @@ -93,10 +93,10 @@ NWORDS(uword_t x, uword_t n_bits) #ifdef LISP_FEATURE_GENCGC #include "gencgc-alloc-region.h" void * -gc_alloc_with_region(long nbytes,int page_type_flag, struct alloc_region *my_region, +gc_alloc_with_region(sword_t nbytes,int page_type_flag, struct alloc_region *my_region, int quick_p); static inline void * -gc_general_alloc(long nbytes, int page_type_flag, int quick_p) +gc_general_alloc(sword_t nbytes, int page_type_flag, int quick_p) { struct alloc_region *my_region; if (UNBOXED_PAGE_FLAG == page_type_flag) { @@ -109,7 +109,7 @@ gc_general_alloc(long nbytes, int page_type_flag, int quick_p) return gc_alloc_with_region(nbytes, page_type_flag, my_region, quick_p); } #else -extern void *gc_general_alloc(long nbytes,int page_type_flag,int quick_p); +extern void *gc_general_alloc(word_t nbytes,int page_type_flag,int quick_p); #endif static inline lispobj @@ -130,24 +130,24 @@ gc_general_copy_object(lispobj object, long nwords, int page_type_flag) return make_lispobj(new, lowtag_of(object)); } -extern long (*scavtab[256])(lispobj *where, lispobj object); +extern sword_t (*scavtab[256])(lispobj *where, lispobj object); extern lispobj (*transother[256])(lispobj object); -extern long (*sizetab[256])(lispobj *where); +extern sword_t (*sizetab[256])(lispobj *where); extern struct weak_pointer *weak_pointers; /* in gc-common.c */ extern struct hash_table *weak_hash_tables; /* in gc-common.c */ -extern void scavenge(lispobj *start, long n_words); +extern void scavenge(lispobj *start, sword_t n_words); extern void scavenge_interrupt_contexts(struct thread *thread); extern void scav_weak_hash_tables(void); extern void scan_weak_hash_tables(void); extern void scan_weak_pointers(void); -lispobj copy_large_unboxed_object(lispobj object, long nwords); -lispobj copy_unboxed_object(lispobj object, long nwords); -lispobj copy_large_object(lispobj object, long nwords); -lispobj copy_object(lispobj object, long nwords); -lispobj copy_code_object(lispobj object, long nwords); +lispobj copy_large_unboxed_object(lispobj object, sword_t nwords); +lispobj copy_unboxed_object(lispobj object, sword_t nwords); +lispobj copy_large_object(lispobj object, sword_t nwords); +lispobj copy_object(lispobj object, sword_t nwords); +lispobj copy_code_object(lispobj object, sword_t nwords); lispobj *search_read_only_space(void *pointer); lispobj *search_static_space(void *pointer); diff --git a/src/runtime/gencgc-internal.h b/src/runtime/gencgc-internal.h index c7d8974..ef4bdaa 100644 --- a/src/runtime/gencgc-internal.h +++ b/src/runtime/gencgc-internal.h @@ -113,7 +113,7 @@ extern struct page *page_table; void sniff_code_object(struct code *code, os_vm_size_t displacement); void gencgc_apply_code_fixups(struct code *old_code, struct code *new_code); -long update_dynamic_space_free_pointer(void); +sword_t update_dynamic_space_free_pointer(void); void gc_alloc_update_page_tables(int page_type_flag, struct alloc_region *alloc_region); void gc_alloc_update_all_page_tables(void); void gc_set_region_empty(struct alloc_region *region); diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 13d4ff2..f4cbcc7 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -61,7 +61,7 @@ #endif /* forward declarations */ -page_index_t gc_find_freeish_pages(page_index_t *restart_page_ptr, long nbytes, +page_index_t gc_find_freeish_pages(page_index_t *restart_page_ptr, sword_t nbytes, int page_type_flag); @@ -801,7 +801,7 @@ set_generation_alloc_start_page(generation_index_t generation, int page_type_fla * are allocated, although they will initially be empty. */ static void -gc_alloc_new_region(long nbytes, int page_type_flag, struct alloc_region *alloc_region) +gc_alloc_new_region(sword_t nbytes, int page_type_flag, struct alloc_region *alloc_region) { page_index_t first_page; page_index_t last_page; @@ -1126,11 +1126,11 @@ gc_alloc_update_page_tables(int page_type_flag, struct alloc_region *alloc_regio gc_set_region_empty(alloc_region); } -static inline void *gc_quick_alloc(long nbytes); +static inline void *gc_quick_alloc(word_t nbytes); /* Allocate a possibly large object. */ void * -gc_alloc_large(long nbytes, int page_type_flag, struct alloc_region *alloc_region) +gc_alloc_large(sword_t nbytes, int page_type_flag, struct alloc_region *alloc_region) { boolean more; page_index_t first_page, next_page, last_page; @@ -1241,7 +1241,7 @@ gc_alloc_large(long nbytes, int page_type_flag, struct alloc_region *alloc_regio static page_index_t gencgc_alloc_start_page = -1; void -gc_heap_exhausted_error_or_lose (long available, long requested) +gc_heap_exhausted_error_or_lose (sword_t available, sword_t requested) { struct thread *thread = arch_os_get_current_thread(); /* Write basic information before doing anything else: if we don't @@ -1280,7 +1280,7 @@ gc_heap_exhausted_error_or_lose (long available, long requested) } page_index_t -gc_find_freeish_pages(page_index_t *restart_page_ptr, long bytes, +gc_find_freeish_pages(page_index_t *restart_page_ptr, sword_t bytes, int page_type_flag) { page_index_t most_bytes_found_from = 0, most_bytes_found_to = 0; @@ -1375,7 +1375,7 @@ gc_find_freeish_pages(page_index_t *restart_page_ptr, long bytes, * functions will eventually call this */ void * -gc_alloc_with_region(long nbytes,int page_type_flag, struct alloc_region *my_region, +gc_alloc_with_region(sword_t nbytes,int page_type_flag, struct alloc_region *my_region, int quick_p) { void *new_free_pointer; @@ -1420,19 +1420,19 @@ gc_alloc_with_region(long nbytes,int page_type_flag, struct alloc_region *my_reg * region */ static inline void * -gc_quick_alloc(long nbytes) +gc_quick_alloc(word_t nbytes) { return gc_general_alloc(nbytes, BOXED_PAGE_FLAG, ALLOC_QUICK); } static inline void * -gc_alloc_unboxed(long nbytes) +gc_alloc_unboxed(word_t nbytes) { return gc_general_alloc(nbytes, UNBOXED_PAGE_FLAG, 0); } static inline void * -gc_quick_alloc_unboxed(long nbytes) +gc_quick_alloc_unboxed(word_t nbytes) { return gc_general_alloc(nbytes, UNBOXED_PAGE_FLAG, ALLOC_QUICK); } @@ -1444,7 +1444,7 @@ gc_quick_alloc_unboxed(long nbytes) * Bignums and vectors may have shrunk. If the object is not copied * the space needs to be reclaimed, and the page_tables corrected. */ static lispobj -general_copy_large_object(lispobj object, long nwords, boolean boxedp) +general_copy_large_object(lispobj object, word_t nwords, boolean boxedp) { int tag; lispobj *new; @@ -1589,20 +1589,20 @@ general_copy_large_object(lispobj object, long nwords, boolean boxedp) } lispobj -copy_large_object(lispobj object, long nwords) +copy_large_object(lispobj object, sword_t nwords) { return general_copy_large_object(object, nwords, 1); } lispobj -copy_large_unboxed_object(lispobj object, long nwords) +copy_large_unboxed_object(lispobj object, sword_t nwords) { return general_copy_large_object(object, nwords, 0); } /* to copy unboxed objects */ lispobj -copy_unboxed_object(lispobj object, long nwords) +copy_unboxed_object(lispobj object, sword_t nwords) { return gc_general_copy_object(object, nwords, UNBOXED_PAGE_FLAG); } @@ -1629,7 +1629,7 @@ void sniff_code_object(struct code *code, os_vm_size_t displacement) { #ifdef LISP_FEATURE_X86 - long nheader_words, ncode_words, nwords; + sword_t nheader_words, ncode_words, nwords; os_vm_address_t constants_start_addr = NULL, constants_end_addr, p; os_vm_address_t code_start_addr, code_end_addr; os_vm_address_t code_addr = (os_vm_address_t)code; @@ -1805,7 +1805,7 @@ gencgc_apply_code_fixups(struct code *old_code, struct code *new_code) { /* x86-64 uses pc-relative addressing instead of this kludge */ #ifndef LISP_FEATURE_X86_64 - long nheader_words, ncode_words, nwords; + sword_t nheader_words, ncode_words, nwords; os_vm_address_t constants_start_addr, constants_end_addr; os_vm_address_t code_start_addr, code_end_addr; os_vm_address_t code_addr = (os_vm_address_t)new_code; @@ -1868,8 +1868,8 @@ gencgc_apply_code_fixups(struct code *old_code, struct code *new_code) if (widetag_of(fixups_vector->header) == SIMPLE_ARRAY_WORD_WIDETAG) { /* Got the fixups for the code block. Now work through the vector, and apply a fixup at each address. */ - long length = fixnum_value(fixups_vector->length); - long i; + sword_t length = fixnum_value(fixups_vector->length); + sword_t i; for (i = 0; i < length; i++) { long offset = fixups_vector->data[i]; /* Now check the current value of offset. */ @@ -1949,7 +1949,7 @@ trans_unboxed_large(lispobj object) #define WEAK_POINTER_NWORDS \ CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2) -static long +static sword_t scav_weak_pointer(lispobj *where, lispobj object) { /* Since we overwrite the 'next' field, we have to make @@ -2050,7 +2050,7 @@ maybe_adjust_large_object(lispobj *where) { page_index_t first_page; page_index_t next_page; - long nwords; + sword_t nwords; uword_t remaining_bytes; uword_t bytes_freed; @@ -2357,10 +2357,10 @@ static int update_page_write_prot(page_index_t page) { generation_index_t gen = page_table[page].gen; - long j; + sword_t j; int wp_it = 1; void **page_addr = (void **)page_address(page); - long num_words = page_table[page].bytes_used / N_WORD_BYTES; + sword_t num_words = page_table[page].bytes_used / N_WORD_BYTES; /* Shouldn't be a free page. */ gc_assert(page_allocated_p(page)); @@ -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 = (((uword_t) + sword_t nwords = (((uword_t) (page_table[last_page].bytes_used + npage_bytes(last_page-i) + page_table[i].region_start_offset)) @@ -2915,10 +2915,10 @@ verify_space(lispobj *start, size_t words) if (is_lisp_pointer(thing)) { page_index_t page_index = find_page_index((void*)thing); - long to_readonly_space = + sword_t to_readonly_space = (READ_ONLY_SPACE_START <= thing && thing < SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0)); - long to_static_space = + sword_t to_static_space = (STATIC_SPACE_START <= thing && thing < SymbolValue(STATIC_SPACE_FREE_POINTER,0)); @@ -2996,7 +2996,7 @@ verify_space(lispobj *start, size_t words) case INSTANCE_HEADER_WIDETAG: { lispobj nuntagged; - long ntotal = HeaderValue(thing); + sword_t ntotal = HeaderValue(thing); lispobj layout = ((struct instance *)start)->slots[0]; if (!layout) { count = 1; @@ -3013,7 +3013,7 @@ verify_space(lispobj *start, size_t words) { lispobj object = *start; struct code *code; - long nheader_words, ncode_words, nwords; + sword_t nheader_words, ncode_words, nwords; lispobj fheaderl; struct simple_fun *fheaderp; @@ -3162,15 +3162,15 @@ verify_gc(void) * Some counts of lispobjs are called foo_count; it might be good * to grep for all foo_size and rename the appropriate ones to * foo_count. */ - long read_only_space_size = + sword_t read_only_space_size = (lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0) - (lispobj*)READ_ONLY_SPACE_START; - long static_space_size = + sword_t static_space_size = (lispobj*)SymbolValue(STATIC_SPACE_FREE_POINTER,0) - (lispobj*)STATIC_SPACE_START; struct thread *th; for_each_thread(th) { - long binding_stack_size = + sword_t binding_stack_size = (lispobj*)get_binding_stack_pointer(th) - (lispobj*)th->binding_stack_start; verify_space(th->binding_stack_start, binding_stack_size); @@ -3229,21 +3229,21 @@ verify_zero_fill(void) for (page = 0; page < last_free_page; page++) { if (page_free_p(page)) { /* The whole page should be zero filled. */ - long *start_addr = (long *)page_address(page); - long size = 1024; - long i; + sword_t *start_addr = (sword_t *)page_address(page); + sword_t size = 1024; + sword_t i; for (i = 0; i < size; i++) { if (start_addr[i] != 0) { lose("free page not zero at %x\n", start_addr + i); } } } else { - long free_bytes = GENCGC_CARD_BYTES - page_table[page].bytes_used; + sword_t free_bytes = GENCGC_CARD_BYTES - page_table[page].bytes_used; if (free_bytes > 0) { - long *start_addr = (long *)((uword_t)page_address(page) + sword_t *start_addr = (sword_t *)((uword_t)page_address(page) + page_table[page].bytes_used); - long size = free_bytes / N_WORD_BYTES; - long i; + sword_t size = free_bytes / N_WORD_BYTES; + sword_t i; for (i = 0; i < size; i++) { if (start_addr[i] != 0) { lose("free region not zero at %x\n", start_addr + i); @@ -3475,7 +3475,7 @@ garbage_collect_generation(generation_index_t generation, int raise) } # endif # elif defined(LISP_FEATURE_SB_THREAD) - long i,free; + sword_t i,free; if(th==arch_os_get_current_thread()) { /* Somebody is going to burn in hell for this, but casting * it in two steps shuts gcc up about strict aliasing. */ @@ -3521,7 +3521,7 @@ garbage_collect_generation(generation_index_t generation, int raise) #if QSHOW if (gencgc_verbose > 1) { - long num_dont_move_pages = count_dont_move_pages(); + sword_t num_dont_move_pages = count_dont_move_pages(); fprintf(stderr, "/non-movable pages due to conservative pointers = %d (%d bytes)\n", num_dont_move_pages, @@ -3571,7 +3571,7 @@ garbage_collect_generation(generation_index_t generation, int raise) { struct thread *th; for_each_thread(th) { - long len= (lispobj *)get_binding_stack_pointer(th) - + sword_t len= (lispobj *)get_binding_stack_pointer(th) - th->binding_stack_start; scavenge((lispobj *) th->binding_stack_start,len); #ifdef LISP_FEATURE_SB_THREAD @@ -3700,7 +3700,7 @@ garbage_collect_generation(generation_index_t generation, int raise) } /* Update last_free_page, then SymbolValue(ALLOCATION_POINTER). */ -long +sword_t update_dynamic_space_free_pointer(void) { page_index_t last_page = -1, i; @@ -3976,12 +3976,12 @@ gc_free_heap(void) #endif } else if (gencgc_zero_check_during_free_heap) { /* Double-check that the page is zero filled. */ - long *page_start; + sword_t *page_start; page_index_t i; gc_assert(page_free_p(page)); gc_assert(page_table[page].bytes_used == 0); - page_start = (long *)page_address(page); - for (i=0; idynamic_space_size = dynamic_space_size; diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 387c686..a8956a9 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -312,12 +312,12 @@ make_lispobj(void *o, int low_tag) #define MAKE_FIXNUM(n) (n << N_FIXNUM_TAG_BITS) static inline lispobj -make_fixnum(long n) +make_fixnum(sword_t n) { return MAKE_FIXNUM(n); } -static inline long +static inline sword_t fixnum_value(lispobj n) { return n >> N_FIXNUM_TAG_BITS; diff --git a/src/runtime/save.c b/src/runtime/save.c index f9b6867..d2f4f07 100644 --- a/src/runtime/save.c +++ b/src/runtime/save.c @@ -79,7 +79,7 @@ write_bytes_to_file(FILE * file, char *addr, long bytes, int compression) { if (compression == COMPRESSION_LEVEL_NONE) { while (bytes > 0) { - long count = fwrite(addr, 1, bytes, file); + sword_t count = fwrite(addr, 1, bytes, file); if (count > 0) { bytes -= count; addr += count; @@ -309,12 +309,12 @@ save_to_filehandle(FILE *file, char *filename, lispobj init_function, #ifdef LISP_FEATURE_GENCGC { - size_t size = (last_free_page*sizeof(long)+os_vm_page_size-1) + size_t size = (last_free_page*sizeof(sword_t)+os_vm_page_size-1) &~(os_vm_page_size-1); uword_t *data = calloc(size, 1); if (data) { uword_t word; - long offset; + sword_t offset; page_index_t i; for (i = 0; i < last_free_page; i++) { /* Thanks to alignment requirements, the two low bits diff --git a/src/runtime/vars.c b/src/runtime/vars.c index 820ec49..21147fe 100644 --- a/src/runtime/vars.c +++ b/src/runtime/vars.c @@ -29,7 +29,7 @@ struct var { lispobj obj; lispobj (*update_fn)(struct var *var); char *name; - long clock; + sword_t clock; boolean map_back, permanent; struct var *nnext; /* Next in name list */ @@ -176,12 +176,12 @@ lispobj var_value(struct var *var) return var->obj; } -long var_clock(struct var *var) +sword_t var_clock(struct var *var) { return var->clock; } -void var_setclock(struct var *var, long val) +void var_setclock(struct var *var, sword_t val) { var->clock = val; } diff --git a/src/runtime/vars.h b/src/runtime/vars.h index e42a4ea..668c2cb 100644 --- a/src/runtime/vars.h +++ b/src/runtime/vars.h @@ -22,5 +22,5 @@ extern struct var *define_dynamic_var(char *name, extern char *var_name(struct var *var); extern lispobj var_value(struct var *var); -extern long var_clock(struct var *var); -extern void var_setclock(struct var *var, long value); +extern sword_t var_clock(struct var *var); +extern void var_setclock(struct var *var, sword_t value);