- changed argument type passed to ik_mmap* to be long int.

- mmap errors report request size (for debugging 64-bit errors)
- added a config definition for FLAT_TABLES which is not yet used
  (32-bit ikarus will use flat segment and dirty tables while 64-bit
  ikarus will use two-level tables)
This commit is contained in:
Abdulaziz Ghuloum 2008-10-21 00:43:27 -04:00
parent c0978044a5
commit b63055aed0
5 changed files with 35 additions and 19 deletions

View File

@ -3,6 +3,9 @@
/* adds support for libffi */ /* adds support for libffi */
#undef ENABLE_LIBFFI #undef ENABLE_LIBFFI
/* use flat segment and dirty vectors (not used yet) */
#undef FLAT_TABLES
/* Define to 1 if you have the <assert.h> header file. */ /* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H #undef HAVE_ASSERT_H

8
configure vendored
View File

@ -5606,6 +5606,14 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
if test "$ac_cv_sizeof_void_p" = 4; then
cat >>confdefs.h <<\_ACEOF
#define FLAT_TABLES 1
_ACEOF
fi
# Checks for libraries. # Checks for libraries.
{ $as_echo "$as_me:$LINENO: checking for library containing dlsym" >&5 { $as_echo "$as_me:$LINENO: checking for library containing dlsym" >&5

View File

@ -29,6 +29,11 @@ case "$target_os" in
esac esac
AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(void *)
if test "$ac_cv_sizeof_void_p" = 4; then
AC_DEFINE(FLAT_TABLES, 1,
[use flat segment and dirty vectors (not used yet)])
fi
# Checks for libraries. # Checks for libraries.
AC_SEARCH_LIBS(dlsym, dl,, [AC_MSG_ERROR([Cannot find libdl])]) AC_SEARCH_LIBS(dlsym, dl,, [AC_MSG_ERROR([Cannot find libdl])])

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(int); ikptr ik_mmap(long int);
ikptr ik_mmap_typed(int size, unsigned int type, ikpcb*); ikptr ik_mmap_typed(long int size, unsigned int type, ikpcb*);
ikptr ik_mmap_ptr(int size, int gen, ikpcb*); ikptr ik_mmap_ptr(long int size, int gen, ikpcb*);
ikptr ik_mmap_data(int size, int gen, ikpcb*); ikptr ik_mmap_data(long int size, int gen, ikpcb*);
ikptr ik_mmap_code(int size, int gen, ikpcb*); ikptr ik_mmap_code(long int size, int gen, ikpcb*);
ikptr ik_mmap_mixed(int size, ikpcb*); ikptr ik_mmap_mixed(long int size, ikpcb*);
void ik_munmap(ikptr, int); void ik_munmap(ikptr, long int);
void ik_munmap_from_segment(ikptr, unsigned long int, ikpcb*); void ik_munmap_from_segment(ikptr, 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

@ -50,8 +50,8 @@ 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(int size); ikptr ik_mmap(long int size);
void ik_munmap(ikptr mem, int size); void ik_munmap(ikptr mem, 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){
@ -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, unsigned long int size, ikpcb* pcb){ ik_munmap_from_segment(ikptr base, 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, unsigned long int size, ikpcb* pcb){
ikptr ikptr
ik_mmap_typed(int size, unsigned int type, ikpcb* pcb){ ik_mmap_typed(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,17 +181,17 @@ ik_mmap_typed(int size, unsigned int type, ikpcb* pcb){
} }
ikptr ikptr
ik_mmap_ptr(int size, int gen, ikpcb* pcb){ ik_mmap_ptr(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(int size, int gen, ikpcb* pcb){ ik_mmap_data(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(int size, int gen, ikpcb* pcb){ ik_mmap_code(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);
@ -208,7 +208,7 @@ ik_mmap_code(int size, int gen, ikpcb* pcb){
ikptr ikptr
ik_mmap_mixed(int size, ikpcb* pcb){ ik_mmap_mixed(long int size, ikpcb* pcb){
return ik_mmap_typed(size, mainheap_mt, pcb); return ik_mmap_typed(size, mainheap_mt, pcb);
} }
@ -216,7 +216,7 @@ ik_mmap_mixed(int size, ikpcb* pcb){
ikptr ikptr
ik_mmap(int size){ ik_mmap(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;
@ -231,7 +231,7 @@ ik_mmap(int size){
0); 0);
/* FIXME: check if in range */ /* FIXME: check if in range */
if(mem == MAP_FAILED){ if(mem == MAP_FAILED){
fprintf(stderr, "Mapping failed: %s\n", strerror(errno)); fprintf(stderr, "Mapping (0x%lx bytes) failed: %s\n", size, strerror(errno));
exit(-1); exit(-1);
} }
#else #else
@ -246,7 +246,7 @@ ik_mmap(int size){
} }
void void
ik_munmap(ikptr mem, int size){ ik_munmap(ikptr mem, long int size){
int pages = (size + pagesize - 1) / pagesize; int pages = (size + pagesize - 1) / pagesize;
int mapsize = pages * pagesize; int mapsize = pages * pagesize;
assert(size == mapsize); assert(size == mapsize);