Skip to content
Snippets Groups Projects
Commit 3e309c44 authored by toy's avatar toy
Browse files

Add support for catching heap overflows, similar to the control stack

overflow checking.  Enable with :heap-overflow-check.  We reserve some
number of pages on the heap.  When the heap reaches the reserved
pages, an overflow warning is signalled.  The reserved pages are set
0.  This allows some additional allocation to happen during debugging,
if necessary.  If another overflow happens, we throw to top-level.

Sparc only right now.

	* lisp/sparc-assem.S (_do_dynamic_space_overflow_error): New
	function to handle a heap overflow error.
	(_do_dynamic_space_overflow_warning): New function to handle heap
	overflow warning.

	* lisp/sparc-arch.c (sigill_handler): Handle the two new traps
	caused by heap overflows.

	* lisp/interrupt.c (interrupt_handle_space_overflow): New function
	to handle interrupt caused by heap space overflows.

	* lisp/gencgc.c (handle_heap_overflow): New function to handle
	heap overflows.
	(gc_alloc_new_region): Use handle_heap_overflow.
	(gc_alloc_large): Use handle_heap_overflow

	* compiler/sparc/parms.lisp (static-symbols): Add new static
	symbols for heap overflow checking:
	dynamic-space-overflow-error-hit and
	dynamic-space-overflow-warning-hit.

	* compiler/generic/new-genesis.lisp (finish-symbols): Initialize
	the new dynamic-space-overflow-error-hit and
	dynamic-space-overflow-warning-hit static symbols.

	* code/lispinit.lisp (:heap-overflow-check): Add
	heap-overflow-check to *runtime-features*, if necessary.
	("reserved_heap_pages"): Access to alien variable for heap
	overflow.
	(*reserved-heap-pages*): Default number of heap pages to reserve
	for heap overflow.
	(%top-level): Set reserved-heap-pages to the default.

	* code/interr.lisp (dynamic-space-overflow-warning-hit): Add
	function to handle heap overflow warnings.
	(dynamic-space-overflow-error-hit): Add function to handle heap
	overflow error.

	* code/error.lisp (heap-overflow): Add new condition type for heap
	overflow
parent b4e9348e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment