From 1f39689e761a2618479730bc170bf41d3f1935a8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Jul 2008 19:27:03 -0500 Subject: [PATCH 1/2] Fix bootstrap --- core/bootstrap/stage1.factor | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor index 5c55bb15ca..9a0f8f9d1f 100755 --- a/core/bootstrap/stage1.factor +++ b/core/bootstrap/stage1.factor @@ -19,8 +19,13 @@ load-help? off [ [ ! Rehash hashtables, since bootstrap.image creates them - ! using the host image's hashing algorithms - [ hashtable? ] instances [ rehash ] each + ! using the host image's hashing algorithms. We don't + ! use each-object here since the catch stack isn't yet + ! set up. + begin-scan + [ hashtable? ] pusher [ (each-object) ] dip + end-scan + [ rehash ] each boot ] % From 5a0c3e3d73586d6847a53254c22bbeef6f63a8b7 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Jul 2008 22:05:36 -0500 Subject: [PATCH 2/2] Add better error message for out of memory --- vm/errors.c | 7 +++++++ vm/errors.h | 1 + vm/os-unix.c | 2 +- vm/os-windows.c | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vm/errors.c b/vm/errors.c index 57dc8b66a1..f2147041a2 100755 --- a/vm/errors.c +++ b/vm/errors.c @@ -1,5 +1,12 @@ #include "master.h" +void out_of_memory(void) +{ + fprintf(stderr,"Out of memory\n\n"); + dump_generations(); + exit(1); +} + void fatal_error(char* msg, CELL tagged) { fprintf(stderr,"fatal_error: %s %lx\n",msg,tagged); diff --git a/vm/errors.h b/vm/errors.h index 227fed9228..22cd6533c3 100755 --- a/vm/errors.h +++ b/vm/errors.h @@ -19,6 +19,7 @@ typedef enum ERROR_MEMORY, } F_ERRORTYPE; +void out_of_memory(void); void fatal_error(char* msg, CELL tagged); void critical_error(char* msg, CELL tagged); DECLARE_PRIMITIVE(die); diff --git a/vm/os-unix.c b/vm/os-unix.c index 48d9a2dea8..d4aebad537 100755 --- a/vm/os-unix.c +++ b/vm/os-unix.c @@ -174,7 +174,7 @@ F_SEGMENT *alloc_segment(CELL size) MAP_ANON | MAP_PRIVATE,-1,0); if(array == (char*)-1) - fatal_error("Out of memory in alloc_segment",0); + out_of_memory(); if(mprotect(array,pagesize,PROT_NONE) == -1) fatal_error("Cannot protect low guard page",(CELL)array); diff --git a/vm/os-windows.c b/vm/os-windows.c index dc931d31c8..4c21c9b5c9 100755 --- a/vm/os-windows.c +++ b/vm/os-windows.c @@ -171,7 +171,7 @@ F_SEGMENT *alloc_segment(CELL size) if((mem = (char *)VirtualAlloc(NULL, getpagesize() * 2 + size, MEM_COMMIT, PAGE_EXECUTE_READWRITE)) == 0) - fatal_error("Out of memory in alloc_segment",0); + out_of_memory(); if (!VirtualProtect(mem, getpagesize(), PAGE_NOACCESS, &ignore)) fatal_error("Cannot allocate low guard page", (CELL)mem);