/* the verbosity level. All non-error messages are disabled at level 0;
* and only a few rare messages are printed at level 1. */
-#ifdef QSHOW
+#if QSHOW
boolean gencgc_verbose = 1;
#else
boolean gencgc_verbose = 0;
return count;
}
-#ifdef QSHOW
+#if QSHOW
static long
count_dont_move_pages(void)
{
/* The verbose argument controls how much to print: 0 for normal
* level of detail; 1 for debugging. */
-static void
-print_generation_stats(int verbose) /* FIXME: should take FILE argument */
+extern void
+print_generation_stats() /* FIXME: should take FILE argument, or construct a string */
{
- generation_index_t i, gens;
+ generation_index_t i;
#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
#define FPU_STATE_SIZE 27
* so they need to be saved and reset for C. */
fpu_save(fpu_state);
- /* highest generation to print */
- if (verbose)
- gens = SCRATCH_GENERATION;
- else
- gens = PSEUDO_STATIC_GENERATION;
-
/* Print the heap stats. */
fprintf(stderr,
" Gen StaPg UbSta LaSta LUbSt Boxed Unboxed LB LUB !move Alloc Waste Trig WP GCs Mem-age\n");
- for (i = 0; i < gens; i++) {
+ for (i = 0; i < SCRATCH_GENERATION; i++) {
page_index_t j;
long boxed_cnt = 0;
long unboxed_cnt = 0;
/* If we are in GC, or totally out of memory there is no way
* to sanely transfer control to the lisp-side of things.
*/
- print_generation_stats(1);
+ print_generation_stats();
fprintf(stderr, "GC control variables:\n");
fprintf(stderr, " *GC-INHIBIT* = %s\n *GC-PENDING* = %s\n",
SymbolValue(GC_INHIBIT,thread)==NIL ? "false" : "true",
unsigned d2 = *((unsigned char *)p - 2);
unsigned d3 = *((unsigned char *)p - 3);
unsigned d4 = *((unsigned char *)p - 4);
-#ifdef QSHOW
+#if QSHOW
unsigned d5 = *((unsigned char *)p - 5);
unsigned d6 = *((unsigned char *)p - 6);
#endif
}
#endif
-#ifdef QSHOW
+#if QSHOW
if (gencgc_verbose > 1) {
long num_dont_move_pages = count_dont_move_pages();
fprintf(stderr,
}
if (gencgc_verbose > 1)
- print_generation_stats(0);
+ print_generation_stats();
do {
/* Collect the generation. */
if (gencgc_verbose > 1) {
FSHOW((stderr, "GC of generation %d finished:\n", gen));
- print_generation_stats(0);
+ print_generation_stats();
}
gen++;
}
if (gencgc_verbose > 1)
- print_generation_stats(0);
+ print_generation_stats();
/* Initialize gc_alloc(). */
gc_alloc_generation = 0;
generation_index_t gen = PSEUDO_STATIC_GENERATION;
do {
lispobj *first,*ptr= (lispobj *)page_address(page);
- page_table[page].allocated = BOXED_PAGE_FLAG;
page_table[page].gen = gen;
page_table[page].bytes_used = PAGE_BYTES;
page_table[page].large_object = 0;
page_table[page].need_to_zero = 1;
if (!gencgc_partial_pickup) {
+ page_table[page].allocated = BOXED_PAGE_FLAG;
first=gc_search_space(prev,(ptr+2)-prev,ptr);
- if(ptr == first) prev=ptr;
+ if(ptr == first)
+ prev=ptr;
page_table[page].region_start_offset =
page_address(page) - (void *)prev;
}
if (SymbolValue(GC_INHIBIT,thread) == NIL) {
set_pseudo_atomic_interrupted(thread);
#ifdef LISP_FEATURE_PPC
- /* PPC calls alloc() from a trap, look up the most
- * recent one and frob that. */
- maybe_save_gc_mask_and_block_deferrables
- (get_interrupt_context_for_thread(thread));
+ /* PPC calls alloc() from a trap or from pa_alloc(),
+ * look up the most context if it's from a trap. */
+ {
+ os_context_t *context =
+ thread->interrupt_data->allocation_trap_context;
+ maybe_save_gc_mask_and_block_deferrables
+ (context ? os_context_sigmask_addr(context) : NULL);
+ }
#else
maybe_save_gc_mask_and_block_deferrables(NULL);
#endif
{
page_index_t page_index = find_page_index(fault_addr);
-#ifdef QSHOW_SIGNALS
+#if QSHOW_SIGNALS
FSHOW((stderr, "heap WP violation? fault_addr=%x, page_index=%d\n",
fault_addr, page_index));
#endif
return 0;
} else {
+ int ret;
+ ret = thread_mutex_lock(&free_pages_lock);
+ gc_assert(ret == 0);
if (page_table[page_index].write_protected) {
/* Unprotect the page. */
os_protect(page_address(page_index), PAGE_BYTES, OS_VM_PROT_ALL);
page_index, boxed_region.first_page,
boxed_region.last_page);
}
+ ret = thread_mutex_unlock(&free_pages_lock);
+ gc_assert(ret == 0);
/* Don't worry, we can handle it. */
return 1;
}