void glstack_ensure_space(CTXTdeclc size_t extra, int arity) { if ((pb)top_of_localstk < (pb)top_of_heap+(256*ZOOM_FACTOR)) { xsb_basic_abort("\nFatal ERROR: -- " "Local Stack clobbered Heap --\n"); } else { if (pflags[STACK_REALLOC] == FALSE) xsb_basic_abort(local_global_exception); if (pflags[GARBAGE_COLLECT] != NO_GC && arity < 255) { gc_heap(CTXTc arity,FALSE); } if ((pb)top_of_localstk < (pb)top_of_heap + OVERFLOW_MARGIN + extra) { glstack_realloc(CTXTc resize_stack(glstack.size,extra+OVERFLOW_MARGIN),arity); } } }
/* SIGSEGV/SIGBUS handler that catches segfaults; used unless configured with DEBUG */ void xsb_segfault_catcher(int err) { char *tmp_message = xsb_segfault_message; #ifdef MULTI_THREAD th_context *th = find_context(xsb_thread_self()); xsb_exit(th, tmp_message); #else xsb_segfault_message = xsb_default_segfault_msg; /* restore default */ printf("segfault!!\n"); xsb_basic_abort(tmp_message); #endif }