Adjust uses of `unsigned long' in the C runtime for LLP64 platforms:
Replace with `uword_t' where applicable.
Thanks to Anton Kovalenko.
18 files changed:
;; VECTOR -- see SHRINK-VECTOR.
(length :ref-trans sb!c::vector-length
:type index)
;; 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
(define-primitive-object (code :type code-component
:lowtag other-pointer-lowtag
static void
call_info_from_context(struct call_info *info, os_context_t *context)
{
static void
call_info_from_context(struct call_info *info, os_context_t *context)
{
info->interrupted = 1;
if (lowtag_of(*os_context_register_addr(context, reg_CODE))
info->interrupted = 1;
if (lowtag_of(*os_context_register_addr(context, reg_CODE))
/* We tried to call a function, but crapped out before $CODE could
* be fixed up. Probably an undefined function. */
info->frame =
/* 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);
(*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);
- (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));
(*os_context_register_addr(context, reg_CFP));
info->code =
code_pointer(*os_context_register_addr(context, reg_CODE));
pc = *os_context_pc_addr(context);
}
if (info->code != NULL)
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
#ifndef LISP_FEATURE_ALPHA
(HEADER_LENGTH(info->code->header) * sizeof(lispobj));
#else
int free_ici;
if (!cs_valid_pointer_p(info->frame)) {
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);
while (free_ici-- > 0) {
os_context_t *context =
thread->interrupt_contexts[free_ici];
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);
(*os_context_register_addr(context, reg_CFP))
== info->frame) {
call_info_from_context(info, context);
else {
info->code = code_pointer(info->lra);
if (info->code != NULL)
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
#ifndef LISP_FEATURE_ALPHA
(HEADER_LENGTH(info->code->header) * sizeof(lispobj));
#else
call_info_from_lisp_state(&info);
do {
call_info_from_lisp_state(&info);
do {
- printf("<Frame 0x%08lx%s, ", (unsigned long) info.frame,
+ printf("<Frame 0x%08lx%s, ", (uword_t) info.frame,
info.interrupted ? " [interrupted]" : "");
if (info.code != (struct code *) 0) {
lispobj function;
info.interrupted ? " [interrupted]" : "");
if (info.code != (struct code *) 0) {
lispobj function;
- printf("CODE: 0x%08lX, ", (unsigned long) info.code | OTHER_POINTER_LOWTAG);
+ printf("CODE: 0x%08lX, ", (uword_t) info.code | OTHER_POINTER_LOWTAG);
#ifndef LISP_FEATURE_ALPHA
function = info.code->entry_points;
#ifndef LISP_FEATURE_ALPHA
function = info.code->entry_points;
printf("CODE: ???, ");
if (info.lra != NIL)
printf("CODE: ???, ");
if (info.lra != NIL)
- printf("LRA: 0x%08lx, ", (unsigned long)info.lra);
+ printf("LRA: 0x%08lx, ", (uword_t)info.lra);
else
printf("<no LRA>, ");
else
printf("<no LRA>, ");
/* 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.) */
/* 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))
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));
/* 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. */
/* 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);
struct compiled_debug_fun *
debug_function_from_pc (struct code* code, void *pc)
{
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;
struct compiled_debug_fun *df;
struct compiled_debug_info *di;
struct vector *v;
if (i == len)
return ((struct compiled_debug_fun *) native_pointer(v->data[i - 1]));
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);
struct compiled_debug_fun *p
= ((struct compiled_debug_fun *) native_pointer(v->data[i + 1]));
next_pc = fixnum_value(p->elsewhere_pc);
if (dladdr(ra, &info)) {
printf("Foreign function %s, fp = 0x%lx, ra = 0x%lx",
info.dli_sname,
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",
} else
#endif
printf("Foreign fp = 0x%p, ra = 0x%p",
if (code == NIL)
return 0;
else {
if (code == NIL)
return 0;
else {
- unsigned long code_start;
struct code *codeptr = (struct code *)native_pointer(code);
#ifdef LISP_FEATURE_HPPA
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;
- unsigned long pc = *os_context_pc_addr(context);
+ uword_t pc = *os_context_pc_addr(context);
- code_start = (unsigned long)codeptr
+ code_start = (uword_t)codeptr
+ HeaderValue(codeptr->header)*sizeof(lispobj);
if (pc < code_start)
return 0;
else {
+ 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
if (offset >= (N_WORD_BYTES * fixnum_value(codeptr->code_size)))
return 0;
else
os_vm_address_t addr =
(os_vm_address_t) (os_vm_page_size * entry->address);
lispobj *free_pointer = (lispobj *) addr + entry->nwords;
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",
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);
if (compressed) {
#ifdef LISP_FEATURE_SB_CORE_COMPRESSION
real_addr = inflate_core_bytes(fd, offset + file_offset, addr, len);
madvise(addr, len, MADV_MERGEABLE);
}
#endif
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:
switch (id) {
case DYNAMIC_CORE_SPACE_ID:
struct code *new_code;
lispobj first, l_code, l_new_code;
uword_t nheader_words, ncode_words, nwords;
struct code *new_code;
lispobj first, l_code, l_new_code;
uword_t nheader_words, ncode_words, nwords;
- unsigned long displacement;
lispobj fheaderl, *prev_pointer;
/* if object has already been transported, just return pointer */
lispobj fheaderl, *prev_pointer;
/* if object has already been transported, just return pointer */
#if defined(DEBUG_CODE_GC)
printf("Old code object at 0x%08x, new code object at 0x%08x.\n",
#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
printf("Code object is %d words long.\n", nwords);
#endif
scav_return_pc_header(lispobj *where, lispobj object)
{
lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x\n",
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 */
return 0; /* bogus return value to satisfy static type checking */
}
#endif /* LISP_FEATURE_X86 */
trans_return_pc_header(lispobj object)
{
struct simple_fun *return_pc;
trans_return_pc_header(lispobj object)
{
struct simple_fun *return_pc;
struct code *code, *ncode;
return_pc = (struct simple_fun *) native_pointer(object);
struct code *code, *ncode;
return_pc = (struct simple_fun *) native_pointer(object);
offset = HeaderValue(return_pc->header) * N_WORD_BYTES;
/* Transport the whole code 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;
ncode = trans_code(code);
return ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG;
scav_fun_header(lispobj *where, lispobj object)
{
lose("attempted to scavenge a function header where=0x%08x object=0x%08x\n",
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 */
return 0; /* bogus return value to satisfy static type checking */
}
#endif /* LISP_FEATURE_X86 */
trans_fun_header(lispobj object)
{
struct simple_fun *fheader;
trans_fun_header(lispobj object)
{
struct simple_fun *fheader;
struct code *code, *ncode;
fheader = (struct simple_fun *) native_pointer(object);
struct code *code, *ncode;
fheader = (struct simple_fun *) native_pointer(object);
offset = HeaderValue(fheader->header) * N_WORD_BYTES;
/* Transport the whole code 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;
ncode = trans_code(code);
return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG;
trans_boxed(lispobj object)
{
lispobj header;
trans_boxed(lispobj object)
{
lispobj header;
gc_assert(is_lisp_pointer(object));
gc_assert(is_lisp_pointer(object));
size_boxed(lispobj *where)
{
lispobj header;
size_boxed(lispobj *where)
{
lispobj header;
header = *where;
length = HeaderValue(header) + 1;
header = *where;
length = HeaderValue(header) + 1;
static long
scav_unboxed(lispobj *where, lispobj object)
{
static long
scav_unboxed(lispobj *where, lispobj object)
{
length = HeaderValue(object) + 1;
length = CEILING(length, 2);
length = HeaderValue(object) + 1;
length = CEILING(length, 2);
trans_unboxed(lispobj object)
{
lispobj header;
trans_unboxed(lispobj object)
{
lispobj header;
gc_assert(is_lisp_pointer(object));
gc_assert(is_lisp_pointer(object));
size_unboxed(lispobj *where)
{
lispobj header;
size_unboxed(lispobj *where)
{
lispobj header;
header = *where;
length = HeaderValue(header) + 1;
header = *where;
length = HeaderValue(header) + 1;
* length) or NULL if it isn't an array of the specified widetag after
* all. */
static inline lispobj *
* 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)) {
{
if (is_lisp_pointer(array) &&
(widetag_of(*(lispobj *)native_pointer(array)) == widetag)) {
scav_hash_table_entries (struct hash_table *hash_table)
{
lispobj *kv_vector;
scav_hash_table_entries (struct hash_table *hash_table)
{
lispobj *kv_vector;
- unsigned long kv_length;
- unsigned long next_vector_length;
+ uword_t next_vector_length;
- unsigned long hash_vector_length;
+ uword_t hash_vector_length;
lispobj empty_symbol;
lispobj weakness = hash_table->weakness;
lispobj empty_symbol;
lispobj weakness = hash_table->weakness;
kv_vector = get_array_data(hash_table->table,
SIMPLE_VECTOR_WIDETAG, &kv_length);
kv_vector = get_array_data(hash_table->table,
SIMPLE_VECTOR_WIDETAG, &kv_length);
long
scav_vector (lispobj *where, lispobj object)
{
long
scav_vector (lispobj *where, lispobj object)
{
- unsigned long kv_length;
lispobj *kv_vector;
struct hash_table *hash_table;
lispobj *kv_vector;
struct hash_table *hash_table;
"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 "
"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;
}
// We've scavenged three words.
return 3;
}
{
lispobj *kv_vector;
lispobj *index_vector;
{
lispobj *kv_vector;
lispobj *index_vector;
- unsigned long length = 0; /* prevent warning */
+ uword_t length = 0; /* prevent warning */
- 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;
lispobj *hash_vector;
lispobj empty_symbol;
lispobj weakness = hash_table->weakness;
kv_vector = get_array_data(hash_table->table,
SIMPLE_VECTOR_WIDETAG, NULL);
kv_vector = get_array_data(hash_table->table,
SIMPLE_VECTOR_WIDETAG, NULL);
scav_lose(lispobj *where, lispobj object)
{
lose("no scavenge function for object 0x%08x (widetag 0x%x)\n",
scav_lose(lispobj *where, lispobj object)
{
lose("no scavenge function for object 0x%08x (widetag 0x%x)\n",
widetag_of(*where));
return 0; /* bogus return value to satisfy static type checking */
widetag_of(*where));
return 0; /* bogus return value to satisfy static type checking */
trans_lose(lispobj object)
{
lose("no transport function for object 0x%08x (widetag 0x%x)\n",
trans_lose(lispobj object)
{
lose("no transport function for object 0x%08x (widetag 0x%x)\n",
widetag_of(*(lispobj*)native_pointer(object)));
return NIL; /* bogus return value to satisfy static type checking */
}
widetag_of(*(lispobj*)native_pointer(object)));
return NIL; /* bogus return value to satisfy static type checking */
}
size_lose(lispobj *where)
{
lose("no size function for object at 0x%08x (widetag 0x%x)\n",
size_lose(lispobj *where)
{
lose("no size function for object at 0x%08x (widetag 0x%x)\n",
widetag_of(*where));
return 1; /* bogus return value to satisfy static type checking */
}
widetag_of(*where));
return 1; /* bogus return value to satisfy static type checking */
}
void
gc_init_tables(void)
{
void
gc_init_tables(void)
{
/* Set default value in all slots of scavenge table. FIXME
* replace this gnarly sizeof with something based on
/* Set default value in all slots of scavenge table. FIXME
* replace this gnarly sizeof with something based on
#ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD
do {
*sp = 0;
#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;
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));
- } 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;
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 */
}
#endif
#endif /* LISP_FEATURE_C_STACK_IS_CONTROL_STACK */
}
*os_context_ctr_addr(context)
#define INTERIOR_POINTER_VARS(name) \
*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) \
int name##_register_pair
#define PAIR_INTERIOR_POINTER(name) \
-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)
*/
/* 0x7FFFFFFF on 32-bit platforms;
0x7FFFFFFFFFFFFFFF on 64-bit platforms */
*/
/* 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++) {
*register_pair = -1;
for (i = 0; i < (sizeof(boxed_registers) / sizeof(int)); i++) {
#define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1)))
#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) {
{
/* 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;
}
return CEILING(x, elements_per_word)/elements_per_word;
}
trans_boxed_large(lispobj object)
{
lispobj header;
trans_boxed_large(lispobj object)
{
lispobj header;
gc_assert(is_lisp_pointer(object));
gc_assert(is_lisp_pointer(object));
trans_unboxed_large(lispobj object)
{
lispobj header;
trans_unboxed_large(lispobj object)
{
lispobj header;
gc_assert(is_lisp_pointer(object));
gc_assert(is_lisp_pointer(object));
page_index_t next_page;
long nwords;
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;
/* quick check 2: Check the offset within the page.
*
*/
/* 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;
page_table[addr_page_index].bytes_used)
return;
if (page_free_p(addr_page_index)
|| (page_table[addr_page_index].bytes_used == 0)
/* Check the offset within the page. */
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",
> page_table[addr_page_index].bytes_used)) {
FSHOW((stderr,
"weird? ignore ptr 0x%x to freed area of large object\n",
}
if (!write_protected) {
scavenge(page_address(i),
}
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);
+ npage_bytes(last_page-i)))
/N_WORD_BYTES);
/* Do a limited check for write-protected pages. */
if (!all_wp) {
/* 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))
(page_table[last_page].bytes_used
+ npage_bytes(last_page-i)
+ page_table[i].region_start_offset))
page_index_t i;
void *region_addr = 0;
void *page_addr = 0;
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)
for (i = 0; i < last_free_page; i++) {
if (page_allocated_p(i)
* 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. */
* 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. */
- unsigned long bytes_freed = 0;
+ uword_t bytes_freed = 0;
page_index_t first_page, last_page;
first_page = 0;
page_index_t first_page, last_page;
first_page = 0;
{
int is_in_dynamic_space = (find_page_index((void*)start) != -1);
int is_in_readonly_space =
{
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;
while (words > 0) {
size_t count = 1;
break;
verify_space(page_address(i),
break;
verify_space(page_address(i),
(page_table[last_page].bytes_used
+ npage_bytes(last_page-i)))
/ N_WORD_BYTES);
(page_table[last_page].bytes_used
+ npage_bytes(last_page-i)))
/ N_WORD_BYTES);
} else {
long free_bytes = GENCGC_CARD_BYTES - page_table[page].bytes_used;
if (free_bytes > 0) {
} 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;
+ page_table[page].bytes_used);
long size = free_bytes / N_WORD_BYTES;
long i;
static void
garbage_collect_generation(generation_index_t generation, int raise)
{
static void
garbage_collect_generation(generation_index_t generation, int raise)
{
- unsigned long bytes_freed;
- unsigned long static_space_size;
+ uword_t static_space_size;
struct thread *th;
gc_assert(generation <= HIGHEST_NORMAL_GENERATION);
struct thread *th;
gc_assert(generation <= HIGHEST_NORMAL_GENERATION);
* please submit a patch. */
#if 0
if (SymbolValue(SCAVENGE_READ_ONLY_SPACE) != NIL) {
* 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,
(lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER) -
(lispobj*)READ_ONLY_SPACE_START;
FSHOW((stderr,
gc_assert(nbytes>0);
/* Check for alignment allocation problems. */
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))
&& ((nbytes & LOWTAG_MASK) == 0));
#if !(defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD))
{
fprintf(stderr, " in SBCL pid %d",getpid());
#if defined(LISP_FEATURE_SB_THREAD)
{
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");
#endif
if (fmt) {
fprintf(stderr, ":\n");
/* Build a fake stack frame or frames */
access_control_frame_pointer(th) =
/* Build a fake stack frame or frames */
access_control_frame_pointer(th) =
- (lispobj *)(unsigned long)
(*os_context_register_addr(context, reg_CSP));
(*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
(*os_context_register_addr(context, reg_CFP))
== access_control_frame_pointer(th)) {
/* There is a small window during call where the callee's
thread->pseudo_atomic_bits =
#else
dynamic_space_free_pointer =
thread->pseudo_atomic_bits =
#else
dynamic_space_free_pointer =
- (lispobj *)(unsigned long)
#endif
(*os_context_register_addr(context, reg_ALLOC));
/* fprintf(stderr,"dynamic_space_free_pointer: %p\n", */
#endif
(*os_context_register_addr(context, reg_ALLOC));
/* fprintf(stderr,"dynamic_space_free_pointer: %p\n", */
#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) =
#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);
/*
| (*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))
- | ((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)
*/
#endif
#if defined(reg_ALLOC) && defined(LISP_FEATURE_SB_THREAD)
* into the context (p-a-bits for p-a, and dynamic space free
* pointer for ROOM). */
*os_context_register_addr(context, reg_ALLOC) =
* 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. */
| (thread->pseudo_atomic_bits & LOWTAG_MASK);
/* And clear them so we don't get bit later by call-in/call-out
* not updating them. */
#endif
/* This is called from Lisp. */
#endif
/* This is called from Lisp. */
install_handler(int signal, void handler(int, siginfo_t*, os_context_t*))
{
#ifndef LISP_FEATURE_WIN32
install_handler(int signal, void handler(int, siginfo_t*, os_context_t*))
{
#ifndef LISP_FEATURE_WIN32
FSHOW((stderr, "/leaving POSIX install_handler(%d, ..)\n", signal));
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;
#else
/* Probably-wrong Win32 hack */
return 0;
extern void undoably_install_low_level_interrupt_handler (
int signal,
interrupt_handler_t handler);
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];
interrupt_handler_t handler);
extern union interrupt_handler interrupt_handlers[NSIG];
start = end = addr;
lastcount = count;
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)) {
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;
obj = *end;
addr = end;
end += 2;
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: ",
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)
#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
+ OTHER_POINTER_LOWTAG,
#else
- (unsigned long)(catch->current_code),
+ (uword_t)(catch->current_code),
- (unsigned long)(catch->entry_pc));
+ (uword_t)(catch->entry_pc));
brief_print((lispobj)catch->tag);
catch = catch->previous_catch;
}
brief_print((lispobj)catch->tag);
catch = catch->previous_catch;
}
#define set_alloc_pointer(value) \
(dynamic_space_free_pointer = \
((lispobj *) \
#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() \
#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) \
#ifdef LISP_FEATURE_SB_THREAD
#define get_pseudo_atomic_atomic(thread) \
((thread)->pseudo_atomic_bits &= ~flag_PseudoAtomicInterrupted)
#else
#define get_pseudo_atomic_atomic(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 \
#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 \
#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) \
#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 \
#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 \
#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))
return obj & WIDETAG_MASK;
}
return obj & WIDETAG_MASK;
}
-static inline unsigned long
HeaderValue(lispobj obj)
{
return obj >> N_WIDETAG_BITS;
HeaderValue(lispobj obj)
{
return obj >> N_WIDETAG_BITS;
{
size_t size = (last_free_page*sizeof(long)+os_vm_page_size-1)
&~(os_vm_page_size-1);
{
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);
long offset;
page_index_t i;
for (i = 0; i < last_free_page; i++) {
long offset;
page_index_t i;
for (i = 0; i < last_free_page; i++) {
return NULL;
/* Aligning up is safe as THREAD_STRUCT_SIZE has
* THREAD_ALIGNMENT_BYTES padding. */
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)
+ 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+
void* csp_page=
(aligned_spaces+
thread_control_stack_size+
-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,
{
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,
fprintf(stderr,
"(hint: Try \"ulimit -a\"; maybe you should increase memory limits.)\n");
exit(1);
fprintf(stderr,
"(hint: Try \"ulimit -a\"; maybe you should increase memory limits.)\n");
exit(1);
static int hash_name(char *name)
{
static int hash_name(char *name)
{
- unsigned long value = 0;
while (*name != '\0') {
value = (value << 1) ^ *(unsigned char *)(name++);
while (*name != '\0') {
value = (value << 1) ^ *(unsigned char *)(name++);
static int hash_obj(lispobj obj)
{
static int hash_obj(lispobj obj)
{
- return (unsigned long)obj % OBJ_BUCKETS;
+ return (uword_t)obj % OBJ_BUCKETS;
{
*os_context_pc_addr(context) -= BREAKPOINT_WIDTH;
*os_context_pc_addr(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
arch_write_linkage_table_jmp(char * reloc, void * fun)
{
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. */
int i;
*reloc++ = 0xFF; /* Opcode for near jump to absolute reg/mem64. */
void
arch_write_linkage_table_ref(void * reloc, void * data)
{
void
arch_write_linkage_table_ref(void * reloc, void * data)
{
- *(unsigned long *)reloc = (unsigned long)data;
+ *(uword_t *)reloc = (uword_t)data;