#include "gc.h"
#include "gc-internal.h"
#include "thread.h"
+#include "pseudo-atomic.h"
#include "alloc.h"
#include "genesis/vector.h"
#include "genesis/weak-pointer.h"
fprintf(stderr, "GC control variables:\n");
fprintf(stderr, " *GC-INHIBIT* = %s\n *GC-PENDING* = %s\n",
SymbolValue(GC_INHIBIT,thread)==NIL ? "false" : "true",
- SymbolValue(GC_PENDING,thread)==NIL ? "false" : "true");
+ (SymbolValue(GC_PENDING, thread) == T) ?
+ "true" : ((SymbolValue(GC_PENDING, thread) == NIL) ?
+ "false" : "in progress"));
#ifdef LISP_FEATURE_SB_THREAD
fprintf(stderr, " *STOP-FOR-GC-PENDING* = %s\n",
SymbolValue(STOP_FOR_GC_PENDING,thread)==NIL ? "false" : "true");
/* set things up so that GC happens when we finish the PA
* section */
SetSymbolValue(GC_PENDING,T,thread);
- if (SymbolValue(GC_INHIBIT,thread) == NIL)
- set_pseudo_atomic_interrupted(thread);
+ 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));
+#else
+ maybe_save_gc_mask_and_block_deferrables(NULL);
+#endif
+ }
}
}
new_obj = gc_alloc_with_region(nbytes, page_type_flag, region, 0);
if ((alloc_signal & FIXNUM_TAG_MASK) == 0) {
if ((signed long) alloc_signal <= 0) {
SetSymbolValue(ALLOC_SIGNAL, T, thread);
- thread_kill(thread->os_thread, SIGPROF);
+ raise(SIGPROF);
} else {
SetSymbolValue(ALLOC_SIGNAL,
alloc_signal - (1 << N_FIXNUM_TAG_BITS),
lispobj *
alloc(long nbytes)
{
+ gc_assert(get_pseudo_atomic_atomic(arch_os_get_current_thread()));
return general_alloc(nbytes, BOXED_PAGE_FLAG);
}
\f
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;
}