Clean up out of memory handler

slava 2006-02-09 03:12:20 +00:00
parent ce4858b656
commit 3d5e96172f
3 changed files with 12 additions and 11 deletions

View File

@ -18,6 +18,11 @@ void primitive_set_compiled_offset(void)
{ {
CELL offset = unbox_unsigned_cell(); CELL offset = unbox_unsigned_cell();
compiling.here = offset; compiling.here = offset;
if(compiling.here > compiling.limit)
{
fprintf(stderr,"Code space exhausted\n");
factorbug();
}
} }
void primitive_literal_top(void) void primitive_literal_top(void)

View File

@ -92,6 +92,12 @@ INLINE void *allot_zone(ZONE *z, CELL a)
{ {
CELL h = z->here; CELL h = z->here;
z->here = h + align8(a); z->here = h + align8(a);
if(z->here > z->limit)
{
fprintf(stderr,"Nursery space exhausted\n");
factorbug();
}
allot_barrier(h); allot_barrier(h);
return (void*)h; return (void*)h;
} }

View File

@ -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) void signal_handler(int signal, siginfo_t* siginfo, void* uap)
{ {
if(nursery.here > nursery.limit) if(in_page(siginfo->si_addr, (void *) ds_bot, 0, -1))
{
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))
signal_stack_error(false, false); signal_stack_error(false, false);
else if(in_page(siginfo->si_addr, (void *) ds_bot, ds_size, 0)) else if(in_page(siginfo->si_addr, (void *) ds_bot, ds_size, 0))
signal_stack_error(false, true); signal_stack_error(false, true);