From 3d5e96172f4ccaf1d2f49ea924cb3be0d3acbd61 Mon Sep 17 00:00:00 2001 From: slava Date: Thu, 9 Feb 2006 03:12:20 +0000 Subject: [PATCH] Clean up out of memory handler --- native/compiler.c | 5 +++++ native/gc.h | 6 ++++++ native/unix/signal.c | 12 +----------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/native/compiler.c b/native/compiler.c index c381f9ffe9..27cf8155a0 100644 --- a/native/compiler.c +++ b/native/compiler.c @@ -18,6 +18,11 @@ void primitive_set_compiled_offset(void) { CELL offset = unbox_unsigned_cell(); compiling.here = offset; + if(compiling.here > compiling.limit) + { + fprintf(stderr,"Code space exhausted\n"); + factorbug(); + } } void primitive_literal_top(void) diff --git a/native/gc.h b/native/gc.h index 75f4d18824..3bcddfc88b 100644 --- a/native/gc.h +++ b/native/gc.h @@ -92,6 +92,12 @@ INLINE void *allot_zone(ZONE *z, CELL a) { CELL h = z->here; z->here = h + align8(a); + if(z->here > z->limit) + { + fprintf(stderr,"Nursery space exhausted\n"); + factorbug(); + } + allot_barrier(h); return (void*)h; } diff --git a/native/unix/signal.c b/native/unix/signal.c index 8491a47c3a..2c515dd333 100644 --- a/native/unix/signal.c +++ b/native/unix/signal.c @@ -18,17 +18,7 @@ static bool in_page(void *fault, void *i_area, CELL area_size, int offset) void signal_handler(int signal, siginfo_t* siginfo, void* uap) { - if(nursery.here > nursery.limit) - { - fprintf(stderr,"Nursery space exhausted\n"); - factorbug(); - } - else if(compiling.here + sizeof(CELL) > compiling.limit) - { - fprintf(stderr,"Code space exhausted\n"); - factorbug(); - } - else if(in_page(siginfo->si_addr, (void *) ds_bot, 0, -1)) + if(in_page(siginfo->si_addr, (void *) ds_bot, 0, -1)) signal_stack_error(false, false); else if(in_page(siginfo->si_addr, (void *) ds_bot, ds_size, 0)) signal_stack_error(false, true);