fixed a few gcc warnings as reported in bug 288824.

This commit is contained in:
Abdulaziz Ghuloum 2008-10-29 13:54:06 -04:00
parent a4ba327173
commit d2022faf53
6 changed files with 40 additions and 46 deletions

View File

@ -1 +1 @@
1650 1652

View File

@ -1360,12 +1360,12 @@ relocate_new_code(ikptr x, gc_t* gc){
ikptr displaced_object = obj + obj_off; ikptr displaced_object = obj + obj_off;
long int next_word = code + code_off + 4; long int next_word = code + code_off + 4;
ikptr relative_distance = displaced_object - (long int)next_word; ikptr relative_distance = displaced_object - (long int)next_word;
if(relative_distance != (int)relative_distance){ if(((long int)relative_distance) != ((long)((int)relative_distance))){
fprintf(stderr, "relocation error with relative=0x%016lx\n", fprintf(stderr, "relocation error with relative=0x%016lx\n",
relative_distance); relative_distance);
exit(-1); exit(-1);
} }
*((int*)(code+code_off)) = relative_distance; *((int*)(code+code_off)) = (int)relative_distance;
p += (3*wordsize); p += (3*wordsize);
} }
else if(tag == 1){ else if(tag == 1){

View File

@ -190,14 +190,14 @@ void ikarus_usage_short(void);
void* ik_malloc(int); void* ik_malloc(int);
void ik_free(void*, int); void ik_free(void*, int);
ikptr ik_mmap(long int); ikptr ik_mmap(unsigned long int);
ikptr ik_mmap_typed(long int size, unsigned int type, ikpcb*); ikptr ik_mmap_typed(unsigned long int size, unsigned int type, ikpcb*);
ikptr ik_mmap_ptr(long int size, int gen, ikpcb*); ikptr ik_mmap_ptr(unsigned long int size, int gen, ikpcb*);
ikptr ik_mmap_data(long int size, int gen, ikpcb*); ikptr ik_mmap_data(unsigned long int size, int gen, ikpcb*);
ikptr ik_mmap_code(long int size, int gen, ikpcb*); ikptr ik_mmap_code(unsigned long int size, int gen, ikpcb*);
ikptr ik_mmap_mixed(long int size, ikpcb*); ikptr ik_mmap_mixed(unsigned long int size, ikpcb*);
void ik_munmap(ikptr, long int); void ik_munmap(ikptr, unsigned long int);
void ik_munmap_from_segment(ikptr, long int, ikpcb*); void ik_munmap_from_segment(ikptr, unsigned long int, ikpcb*);
ikpcb* ik_make_pcb(); ikpcb* ik_make_pcb();
void ik_delete_pcb(ikpcb*); void ik_delete_pcb(ikpcb*);
void ik_free_symbol_table(ikpcb* pcb); void ik_free_symbol_table(ikpcb* pcb);

View File

@ -167,7 +167,7 @@ ikptr
ikrt_ffi_prep_cif(ikptr rtptr, ikptr argstptr, ikpcb* pcb) { ikrt_ffi_prep_cif(ikptr rtptr, ikptr argstptr, ikpcb* pcb) {
ffi_cif* cif = alloc(sizeof(ffi_cif), 1); ffi_cif* cif = alloc(sizeof(ffi_cif), 1);
ffi_abi abi = FFI_DEFAULT_ABI; ffi_abi abi = FFI_DEFAULT_ABI;
unsigned int nargs = unfix(ref(argstptr, off_vector_length)); int nargs = unfix(ref(argstptr, off_vector_length));
ffi_type** argtypes = alloc(sizeof(ffi_type*), nargs+1); ffi_type** argtypes = alloc(sizeof(ffi_type*), nargs+1);
int i; int i;
for(i=0; i<nargs; i++){ for(i=0; i<nargs; i++){
@ -188,7 +188,7 @@ ikrt_ffi_prep_cif(ikptr rtptr, ikptr argstptr, ikpcb* pcb) {
} }
#ifdef DEBUG_FFI
static void static void
dump_stack(ikpcb* pcb, char* msg) { dump_stack(ikpcb* pcb, char* msg) {
fprintf(stderr, "==================== %s\n", msg); fprintf(stderr, "==================== %s\n", msg);
@ -201,6 +201,7 @@ dump_stack(ikpcb* pcb, char* msg) {
p += wordsize; p += wordsize;
} }
} }
#endif
/* FIXME: handle stack overflow */ /* FIXME: handle stack overflow */
@ -321,8 +322,8 @@ ikrt_ffi_call(ikptr data, ikptr argsvec, ikpcb* pcb) {
ikptr typevec = ref(data, off_vector_data + 2 * wordsize); ikptr typevec = ref(data, off_vector_data + 2 * wordsize);
ikptr rtype = ref(data, off_vector_data + 3 * wordsize); ikptr rtype = ref(data, off_vector_data + 3 * wordsize);
ffi_cif* cif = (ffi_cif*) ref(cifptr, off_pointer_data); ffi_cif* cif = (ffi_cif*) ref(cifptr, off_pointer_data);
void* fn = (void*) ref(funptr, off_pointer_data); void(*fn)() = (void*) ref(funptr, off_pointer_data);
unsigned int n = unfix(ref(argsvec, off_vector_length)); int n = unfix(ref(argsvec, off_vector_length));
void** avalues = alloc(sizeof(void*), n+1); void** avalues = alloc(sizeof(void*), n+1);
int i; int i;
for(i=0; i<n; i++){ for(i=0; i<n; i++){
@ -394,7 +395,7 @@ generic_callback(ffi_cif *cif, void *ret, void **args, void *user_data){
ikptr proc = ref(data, off_vector_data + 1 * wordsize); ikptr proc = ref(data, off_vector_data + 1 * wordsize);
ikptr argtypes_conv = ref(data, off_vector_data + 2 * wordsize); ikptr argtypes_conv = ref(data, off_vector_data + 2 * wordsize);
ikptr rtype_conv = ref(data, off_vector_data + 3 * wordsize); ikptr rtype_conv = ref(data, off_vector_data + 3 * wordsize);
ikptr n = unfix(ref(argtypes_conv, off_vector_length)); int n = unfix(ref(argtypes_conv, off_vector_length));
ikpcb* pcb = the_pcb; ikpcb* pcb = the_pcb;
ikptr code_entry = ref(proc, off_closure_code); ikptr code_entry = ref(proc, off_closure_code);

View File

@ -801,7 +801,7 @@ ikrt_bnbnminus(ikptr x, ikptr y, ikpcb* pcb){
pcb->root0 = &s1; pcb->root0 = &s1;
pcb->root1 = &s2; pcb->root1 = &s2;
ikptr res = ik_safe_alloc(pcb, align(disp_bignum_data + n1 * wordsize)); ikptr res = ik_safe_alloc(pcb, align(disp_bignum_data + n1 * wordsize));
bzero((void*)res+disp_bignum_data, n1*wordsize); bzero((void*)(res+disp_bignum_data), n1*wordsize);
pcb->root0 = 0; pcb->root0 = 0;
pcb->root1 = 0; pcb->root1 = 0;
long int burrow = long int burrow =

View File

@ -50,19 +50,19 @@ extern char **environ;
#define segment_shift (pageshift+pageshift-2) #define segment_shift (pageshift+pageshift-2)
#define segment_index(x) (((unsigned long int)(x)) >> segment_shift) #define segment_index(x) (((unsigned long int)(x)) >> segment_shift)
ikptr ik_mmap(long int size); ikptr ik_mmap(unsigned long int size);
void ik_munmap(ikptr mem, long int size); void ik_munmap(ikptr mem, unsigned long int size);
static void static void
extend_table_maybe(ikptr p, unsigned long int size, ikpcb* pcb){ extend_table_maybe(ikptr p, unsigned long int size, ikpcb* pcb){
assert(size == align_to_next_page(size)); assert(size == align_to_next_page(size));
ikptr q = p + size; ikptr q = p + size;
if(p < pcb->memory_base){ if(p < pcb->memory_base){
long int new_lo = segment_index(p); unsigned long int new_lo = segment_index(p);
long int old_lo = segment_index(pcb->memory_base); unsigned long int old_lo = segment_index(pcb->memory_base);
long int hi = segment_index(pcb->memory_end); unsigned long int hi = segment_index(pcb->memory_end);
long int new_vec_size = (hi - new_lo) * pagesize; unsigned long int new_vec_size = (hi - new_lo) * pagesize;
long int old_vec_size = (hi - old_lo) * pagesize; unsigned long int old_vec_size = (hi - old_lo) * pagesize;
ikptr v = ik_mmap(new_vec_size); ikptr v = ik_mmap(new_vec_size);
bzero((char*)(long)v, new_vec_size - old_vec_size); bzero((char*)(long)v, new_vec_size - old_vec_size);
memcpy((char*)(long)(v+new_vec_size-old_vec_size), memcpy((char*)(long)(v+new_vec_size-old_vec_size),
@ -82,11 +82,11 @@ extend_table_maybe(ikptr p, unsigned long int size, ikpcb* pcb){
pcb->memory_base = (new_lo * segment_size); pcb->memory_base = (new_lo * segment_size);
} }
else if (q > pcb->memory_end){ else if (q > pcb->memory_end){
long int lo = segment_index(pcb->memory_base); unsigned long int lo = segment_index(pcb->memory_base);
long int old_hi = segment_index(pcb->memory_end); unsigned long int old_hi = segment_index(pcb->memory_end);
long int new_hi = segment_index(q+segment_size-1); unsigned long int new_hi = segment_index(q+segment_size-1);
long int new_vec_size = (new_hi - lo) * pagesize; unsigned long int new_vec_size = (new_hi - lo) * pagesize;
long int old_vec_size = (old_hi - lo) * pagesize; unsigned long int old_vec_size = (old_hi - lo) * pagesize;
ikptr v = ik_mmap(new_vec_size); ikptr v = ik_mmap(new_vec_size);
memcpy((char*)(long)v, memcpy((char*)(long)v,
(char*)(long)pcb->dirty_vector_base, (char*)(long)pcb->dirty_vector_base,
@ -120,7 +120,7 @@ set_segment_type(ikptr base, unsigned long int size, unsigned int type, ikpcb* p
} }
void void
ik_munmap_from_segment(ikptr base, long int size, ikpcb* pcb){ ik_munmap_from_segment(ikptr base, unsigned long int size, ikpcb* pcb){
assert(base >= pcb->memory_base); assert(base >= pcb->memory_base);
assert((base+size) <= pcb->memory_end); assert((base+size) <= pcb->memory_end);
assert(size == align_to_next_page(size)); assert(size == align_to_next_page(size));
@ -158,7 +158,7 @@ ik_munmap_from_segment(ikptr base, long int size, ikpcb* pcb){
ikptr ikptr
ik_mmap_typed(long int size, unsigned int type, ikpcb* pcb){ ik_mmap_typed(unsigned long int size, unsigned int type, ikpcb* pcb){
ikptr p; ikptr p;
if(size == pagesize) { if(size == pagesize) {
ikpage* s = pcb->cached_pages; ikpage* s = pcb->cached_pages;
@ -181,34 +181,27 @@ ik_mmap_typed(long int size, unsigned int type, ikpcb* pcb){
} }
ikptr ikptr
ik_mmap_ptr(long int size, int gen, ikpcb* pcb){ ik_mmap_ptr(unsigned long int size, int gen, ikpcb* pcb){
return ik_mmap_typed(size, pointers_mt | gen, pcb); return ik_mmap_typed(size, pointers_mt | gen, pcb);
} }
ikptr ikptr
ik_mmap_data(long int size, int gen, ikpcb* pcb){ ik_mmap_data(unsigned long int size, int gen, ikpcb* pcb){
return ik_mmap_typed(size, data_mt | gen, pcb); return ik_mmap_typed(size, data_mt | gen, pcb);
} }
ikptr ikptr
ik_mmap_code(long int size, int gen, ikpcb* pcb){ ik_mmap_code(unsigned long int size, int gen, ikpcb* pcb){
ikptr p = ik_mmap_typed(size, code_mt | gen, pcb); ikptr p = ik_mmap_typed(size, code_mt | gen, pcb);
if(size > pagesize){ if(size > pagesize){
set_segment_type(p+pagesize, size-pagesize, data_mt|gen, pcb); set_segment_type(p+pagesize, size-pagesize, data_mt|gen, pcb);
} }
#if 0
junk int err = mprotect(p, size, PROT_READ | PROT_WRITE | PROT_EXEC);
if(err){
fprintf(stderr, "cannot mprotect code: %s\n", strerror(errno));
exit(-1);
}
#endif
return p; return p;
} }
ikptr ikptr
ik_mmap_mixed(long int size, ikpcb* pcb){ ik_mmap_mixed(unsigned long int size, ikpcb* pcb){
return ik_mmap_typed(size, mainheap_mt, pcb); return ik_mmap_typed(size, mainheap_mt, pcb);
} }
@ -216,7 +209,7 @@ ik_mmap_mixed(long int size, ikpcb* pcb){
ikptr ikptr
ik_mmap(long int size){ ik_mmap(unsigned long int size){
int pages = (size + pagesize - 1) / pagesize; int pages = (size + pagesize - 1) / pagesize;
total_allocated_pages += pages; total_allocated_pages += pages;
int mapsize = pages * pagesize; int mapsize = pages * pagesize;
@ -246,9 +239,9 @@ ik_mmap(long int size){
} }
void void
ik_munmap(ikptr mem, long int size){ ik_munmap(ikptr mem, unsigned long int size){
int pages = (size + pagesize - 1) / pagesize; unsigned long int pages = (size + pagesize - 1) / pagesize;
int mapsize = pages * pagesize; unsigned long int mapsize = pages * pagesize;
assert(size == mapsize); assert(size == mapsize);
assert(((-pagesize) & (int)mem) == (int)mem); assert(((-pagesize) & (int)mem) == (int)mem);
total_allocated_pages -= pages; total_allocated_pages -= pages;