gc2 places testing configure option
svn: r18798
This commit is contained in:
parent
e333734867
commit
bfbeb104be
|
@ -79,6 +79,7 @@ AC_ARG_ENABLE(libfw, [ --enable-userfw install Mac OS X frameworks to
|
|||
AC_ARG_ENABLE(macprefix, [ --enable-macprefix allow --prefix with a Mac OS X install])
|
||||
AC_ARG_ENABLE(mac64, [ --enable-mac64 do not force 32-bit build])
|
||||
|
||||
AC_ARG_ENABLE(gc2_places_testing, [ --enable-gc2-places-testing compile gc2 places tesging support])
|
||||
|
||||
###### Get OS Type #######
|
||||
|
||||
|
@ -152,6 +153,12 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "${enable_gc2_places_testing}" = "yes" ; then
|
||||
enable_shared=yes
|
||||
enable_places=yes
|
||||
fi
|
||||
|
||||
|
||||
# Hack for the implementor:
|
||||
if test "${enable_perl}" = "" ; then
|
||||
if test "$USER" = "mflatt" ; then
|
||||
|
@ -295,6 +302,7 @@ show_explicitly_disabled "${enable_jit}" JIT
|
|||
show_explicitly_disabled "${enable_foreign}" Foreign
|
||||
|
||||
show_explicitly_enabled "${enable_places}" Places
|
||||
show_explicitly_enabled "${enable_gc2_places_testing}" "GC2 Places Testing"
|
||||
show_explicitly_enabled "${enable_futures}" Futures
|
||||
show_explicitly_disabled "${enable_futures}" Futures
|
||||
|
||||
|
@ -983,6 +991,12 @@ if test "${endianness}" = "big" ; then
|
|||
AC_DEFINE(SCHEME_BIG_ENDIAN,1,[Big endian])
|
||||
fi
|
||||
|
||||
############### GC2_PLACES_TESTING ###################
|
||||
|
||||
if test "${enable_gc2_places_testing}" = "yes" ; then
|
||||
AC_DEFINE(GC2_PLACES_TESTING,1,[GC2 Places Testing])
|
||||
fi
|
||||
|
||||
############### places ###################
|
||||
|
||||
if test "${enable_places}" = "yes" ; then
|
||||
|
|
|
@ -470,6 +470,9 @@ int GC_is_allocated(void *p)
|
|||
return !!pagemap_find_page(gc->page_maps, p);
|
||||
}
|
||||
|
||||
#ifdef GC2_PLACES_TESTING
|
||||
#include "testing.c"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Allocation */
|
||||
|
|
83
src/mzscheme/gc2/testing.c
Normal file
83
src/mzscheme/gc2/testing.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
|
||||
int GC_is_live(void *p)
|
||||
{
|
||||
NewGC *gc = GC_get_GC();
|
||||
mpage *page = pagemap_find_page(gc->page_maps, p);
|
||||
if (!page) { /* NOT GC ALLOCATED */
|
||||
printf("%p page: %p NOT GC ALLOCATED\n", p, page);
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
else if (page->generation == 0) {
|
||||
if (page == gc->gen0.curr_alloc_page) {
|
||||
if (p < (void*) GC_gen0_alloc_page_ptr) {
|
||||
printf("GEN0 object %p page: %p gen: %i class: %i ALIVE\n", p, page, page->generation, page->size_class);
|
||||
printf("%p BEGIN: %p ALLOCED_UPTO: %p END: %p\n", p, (void*) gc->gen0.curr_alloc_page->addr, (void*) GC_gen0_alloc_page_ptr, (void*) GC_gen0_alloc_page_end);
|
||||
fflush(stdout);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("GEN0 object %p page: %p gen: %i class: %i DEAD\n", p, page, page->generation, page->size_class);
|
||||
printf("%p BEGIN: %p ALLOCED_UPTO: %p END: %p\n", p, (void*) gc->gen0.curr_alloc_page->addr, (void*) GC_gen0_alloc_page_ptr, (void*) GC_gen0_alloc_page_end);
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return NUM(p) < (NUM(page->addr) + page->size);
|
||||
}
|
||||
else { /* page->generation */
|
||||
if (page->size_class == 1) {
|
||||
int dead = OBJPTR_TO_OBJHEAD(p)->dead;
|
||||
printf("MEDIUM object %p page: %p gen: %i class: %i dead: %i\n", p, page, page->generation, page->size_class, dead);
|
||||
fflush(stdout);
|
||||
return !dead;
|
||||
}
|
||||
else if((NUM(page->addr) + page->size) > NUM(p)) {
|
||||
printf("%p page: %p gen: %i class: %i ALIVE\n", p, page, page->generation, page->size_class);
|
||||
printf("%p BEGIN: %p ALLOCED_UPTO: %p\n", p, (void*) page->addr, (void*) (NUM(page->addr) + page->size));
|
||||
fflush(stdout);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("%p page: %p gen: %i class: %i DEAD\n", p, page, page->generation, page->size_class);
|
||||
printf("%p BEGIN: %p ALLOCED_UPTO: %p\n", p, (void*) page->addr, (void*) (NUM(page->addr) + page->size));
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GC_dbg_dump_mpage(mpage *page) {
|
||||
printf("mpage: %p\n", page);
|
||||
printf("next: %p\n", page->next);
|
||||
printf("prev: %p\n", page->prev);
|
||||
printf("addr: %p\n", page->addr);
|
||||
printf("previous_size: %li\n", page->previous_size);
|
||||
printf("for med page, points to place to search for available block\n");
|
||||
printf("size: %li\n", page->size);
|
||||
printf("generation: %i\n", page->generation);
|
||||
|
||||
printf("back_pointers: %i\n", page->back_pointers);
|
||||
printf("size_class: %i 1 => med; 2 => big; 3 => big marked \n", page->size_class); ; /* */
|
||||
printf("page_type: %i\n", page->page_type);
|
||||
printf("marked_on %i\n", page->marked_on);
|
||||
printf("has_new %i\n", page->has_new);
|
||||
printf("mprotected %i\n", page->mprotected);
|
||||
printf("added %i\n", page->added);;
|
||||
printf("live_size: %i\n", page->live_size);
|
||||
printf("backgrace: %p\n", page->backtrace);
|
||||
}
|
||||
|
||||
int GC_dbg_dump_mpage_for_p(void *p) {
|
||||
NewGC *gc = GC_get_GC();
|
||||
mpage *page = pagemap_find_page(gc->page_maps, p);
|
||||
if (page) {
|
||||
GC_dbg_dump_mpage(page);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("Not allocated by the GC\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
# if _MSC_VER
|
||||
# define THREAD_LOCAL /* empty */
|
||||
# define IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS
|
||||
# elif defined(OS_X)
|
||||
# elif defined(OS_X) || defined(GC2_PLACES_TESTING)
|
||||
# define IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS
|
||||
# if defined(__x86_64__) || defined(__i386__)
|
||||
# define INLINE_GETSPECIFIC_ASSEMBLY_CODE
|
||||
|
|
|
@ -45,4 +45,7 @@
|
|||
/* Configure use of pthreads for the user-thread timer: */
|
||||
#undef USE_PTHREAD_INSTEAD_OF_ITIMER
|
||||
|
||||
/* Enable GC2 Places Testing: */
|
||||
#undef GC2_PLACES_TESTING
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user