From ccdbccc139bfc548e32d101b00327de504d3e204 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 31 Jul 2004 20:11:30 +0000 Subject: [PATCH] it boots! --- TODO.FACTOR.txt | 1 + library/image.factor | 10 +++++++--- library/init.factor | 2 +- library/inspector.factor | 5 ++++- library/platform/native/cross-compiler.factor | 2 ++ native/factor.h | 2 +- native/fd.c | 1 + native/memory.c | 1 + 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 1d50330c55..3cca798fa4 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -2,6 +2,7 @@ ERROR: I/O error: [ "primitive_read_line_fd_8" "Resource temporarily unavailable" ] +- fixup-words is crusty - decide if overflow is a fatal error - f >n: crashes - typecases: type error reporting bad diff --git a/library/image.factor b/library/image.factor index f174ee51b6..53aa9995f9 100644 --- a/library/image.factor +++ b/library/image.factor @@ -130,7 +130,7 @@ USE: words ! Eg : foo [ 5 | foo ] ; : fixup-word-later ( word -- ) - image vector-length cons "word-fixups" cons@ ; + image vector-length cons "word-fixups" get vector-push ; : fixup-word ( where word -- ) dup pooled-object dup [ @@ -140,7 +140,7 @@ USE: words ] ifte ; : fixup-words ( -- ) - "word-fixups" get [ unswons fixup-word ] each ; + "word-fixups" get [ unswons fixup-word ] vector-each ; : 'word ( word -- pointer ) dup pooled-object dup [ @@ -148,7 +148,7 @@ USE: words ] [ drop ! Remember where we are, and add the reference later - fixup-word-later f + dup fixup-word-later ] ifte ; ( Conses ) @@ -318,6 +318,10 @@ IN: cross-compiler 300000 "image" set 521 "objects" set namespace-buckets "vocabularies" set + ! Note that this is a vector that we can side-effect, + ! since ; ends up using this variable from nested + ! parser namespaces. + 1000 "word-fixups" set begin call end "image" get ] bind ; diff --git a/library/init.factor b/library/init.factor index 7e844d0384..5f648e11a8 100644 --- a/library/init.factor +++ b/library/init.factor @@ -136,6 +136,6 @@ USE: strings [ interpreter-loop ] [ - default-error-handler suspend + [ default-error-handler suspend ] when* ] catch ] when ; diff --git a/library/inspector.factor b/library/inspector.factor index 2eecb67015..36c9a7fda5 100644 --- a/library/inspector.factor +++ b/library/inspector.factor @@ -70,8 +70,11 @@ USE: vocabularies : describe-namespace ( namespace -- ) [ vars-values ] bind describe-assoc ; +: ?unparse ( obj -- str ) + dup string? [ unparse ] unless ; + : describe-hashtable ( hashtables -- ) - hash>alist describe-assoc ; + hash>alist [ unswons ?unparse swons ] inject describe-assoc ; : describe ( obj -- ) [ diff --git a/library/platform/native/cross-compiler.factor b/library/platform/native/cross-compiler.factor index 1480420c8e..4624415309 100644 --- a/library/platform/native/cross-compiler.factor +++ b/library/platform/native/cross-compiler.factor @@ -29,6 +29,8 @@ IN: cross-compiler USE: lists USE: namespaces USE: parser +USE: prettyprint +USE: stack : cross-compile-resource ( resource -- ) [ diff --git a/native/factor.h b/native/factor.h index 03883a7e9e..4b8a970268 100644 --- a/native/factor.h +++ b/native/factor.h @@ -31,7 +31,7 @@ typedef unsigned char BYTE; #define BYTES 1 /* Memory heap size */ -#define DEFAULT_ARENA (4 * 1024 * 1024) +#define DEFAULT_ARENA (128 * 1024 * 1024) #define STACK_SIZE 1024 #include "error.h" diff --git a/native/fd.c b/native/fd.c index 87d0d9b6cf..5f4048b657 100644 --- a/native/fd.c +++ b/native/fd.c @@ -115,6 +115,7 @@ void primitive_write_fd_8(void) switch(type) { case FIXNUM_TYPE: + case BIGNUM_TYPE: write_fd_char_8(h,to_fixnum(text)); break; case STRING_TYPE: diff --git a/native/memory.c b/native/memory.c index 7fc9b4c11e..623545feda 100644 --- a/native/memory.c +++ b/native/memory.c @@ -37,6 +37,7 @@ CELL allot(CELL a) } else if(active->here > active->alarm) { + printf("GC\n"); /* Execute the 'garbage-collection' word */ cpush(env.cf); env.cf = env.user[GC_ENV];