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
Showing
- code/error.lisp 9 additions, 2 deletionscode/error.lisp
- code/interr.lisp 18 additions, 2 deletionscode/interr.lisp
- code/lispinit.lisp 13 additions, 1 deletioncode/lispinit.lisp
- compiler/generic/new-genesis.lisp 5 additions, 1 deletioncompiler/generic/new-genesis.lisp
- compiler/sparc/parms.lisp 12 additions, 4 deletionscompiler/sparc/parms.lisp
- lisp/gencgc.c 56 additions, 25 deletionslisp/gencgc.c
- lisp/interrupt.c 16 additions, 1 deletionlisp/interrupt.c
- lisp/sparc-arch.c 15 additions, 1 deletionlisp/sparc-arch.c
- lisp/sparc-assem.S 22 additions, 0 deletionslisp/sparc-assem.S
Loading
Please register or sign in to comment