From 396208b860ede3c48842e362f2b87961bcf4bc8b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 28 Jul 2004 03:29:37 +0000 Subject: [PATCH] remove -falign-functions=8 restriction --- build.sh | 2 +- library/platform/native/.image.factor.marks | Bin 39 -> 39 bytes library/platform/native/image.factor | 7 ++++--- native/gc.c | 7 +++---- native/primitives.c | 8 +------- native/relocate.c | 7 +++---- native/run.c | 3 +-- native/types.c | 2 ++ native/types.h | 3 +-- native/word.h | 6 ++++-- 10 files changed, 20 insertions(+), 25 deletions(-) diff --git a/build.sh b/build.sh index 17fd95fb12..410462d4b6 100644 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ rm *.o export CC=gcc34 -export CFLAGS="-pedantic -Wall -Winline -O4 -Os -march=pentium4 -fomit-frame-pointer -falign-functions=8" +export CFLAGS="-pedantic -Wall -Winline -O3 -march=pentium4 -fomit-frame-pointer" $CC $CFLAGS -o f native/*.c diff --git a/library/platform/native/.image.factor.marks b/library/platform/native/.image.factor.marks index 3338d6b2629396a907f6371ab5a628dd7a054627..e8c9eb1445e5026e64c3c91cd762bb534d2359b3 100644 GIT binary patch literal 39 hcmY#Pv^KIdF$WV|iVW7K21XWO0>m-1Ft7jm*hx3B;cTmY2w2R8r! diff --git a/library/platform/native/image.factor b/library/platform/native/image.factor index 8b801a7887..e57a51033e 100644 --- a/library/platform/native/image.factor +++ b/library/platform/native/image.factor @@ -68,7 +68,6 @@ USE: words : cons-tag BIN: 010 ; : object-tag BIN: 011 ; : header-tag BIN: 100 ; -: xt-tag BIN: 101 ; : immediate ( x tag -- tagged ) swap tag-bits shift< bitor ; : >header ( id -- tagged ) header-tag immediate ; @@ -121,7 +120,8 @@ USE: words ( Words ) -: word, ( -- pointer ) word-tag here-as xt-tag emit ; +: word, ( -- pointer ) + word-tag here-as word-tag >header emit 0 emit ; ! This is to handle mutually recursive words ! It is a hack. A recursive word in the cdr of a @@ -232,7 +232,8 @@ IN: cross-compiler r> ( -- plist ) r> ( primitive -- ) emit r> ( parameter -- ) emit - ( plist -- ) emit ; + ( plist -- ) emit + 0 emit ( padding ) ; : primitive, ( word primitive -- ) f (worddef,) ; : compound, ( word definition -- ) 1 swap (worddef,) ; diff --git a/native/gc.c b/native/gc.c index b799673fc8..ec4039f60a 100644 --- a/native/gc.c +++ b/native/gc.c @@ -69,6 +69,9 @@ void collect_object(void) switch(untag_header(get(scan))) { + case WORD_TYPE: + collect_word((WORD*)scan); + break; case ARRAY_TYPE: collect_array((ARRAY*)scan); break; @@ -91,10 +94,6 @@ void collect_next(void) gc_debug("collect_next header",get(scan)); switch(TAG(get(scan))) { - case XT_TYPE: - collect_word((WORD*)scan); - scan += sizeof(WORD); - break; case HEADER_TYPE: collect_object(); break; diff --git a/native/primitives.c b/native/primitives.c index 8a4112ae33..eef4bd4094 100644 --- a/native/primitives.c +++ b/native/primitives.c @@ -94,16 +94,10 @@ XT primitives[] = { CELL primitive_to_xt(CELL primitive) { - XT xt; - if(primitive < 0 || primitive >= PRIMITIVE_COUNT) general_error(ERROR_BAD_PRIMITIVE,tag_fixnum(primitive)); - xt = primitives[primitive]; - if((CELL)xt % 8 != 0) - fatal_error("compile with -falign-functions=8",xt); - - return RETAG(xt,XT_TYPE); + return primitives[primitive]; } void primitive_eq(void) diff --git a/native/relocate.c b/native/relocate.c index 3c91e53a62..7d29c20176 100644 --- a/native/relocate.c +++ b/native/relocate.c @@ -12,6 +12,9 @@ void relocate_object() size = untagged_object_size(relocating); switch(untag_header(get(relocating))) { + case WORD_TYPE: + fixup_word((WORD*)relocating); + break; case ARRAY_TYPE: fixup_array((ARRAY*)relocating); break; @@ -32,10 +35,6 @@ void relocate_next() { switch(TAG(get(relocating))) { - case XT_TYPE: - fixup_word((WORD*)relocating); - relocating += sizeof(WORD); - break; case HEADER_TYPE: relocate_object(); break; diff --git a/native/run.c b/native/run.c index bb79fb19fe..26050fcc3b 100644 --- a/native/run.c +++ b/native/run.c @@ -9,7 +9,6 @@ void clear_environment(void) void init_environment(void) { - /* + CELLS * 2 to skip header and length cell */ env.ds_bot = tag_object(array(STACK_SIZE,empty)); reset_datastack(); env.cs_bot = tag_object(array(STACK_SIZE,empty)); @@ -17,7 +16,7 @@ void init_environment(void) env.cf = env.boot; } -#define EXECUTE(w) ((XT)(UNTAG(w->xt)))() +#define EXECUTE(w) ((XT)(w->xt))() void run(void) { diff --git a/native/types.c b/native/types.c index 2b4c58ed87..2e86963092 100644 --- a/native/types.c +++ b/native/types.c @@ -80,6 +80,8 @@ CELL untagged_object_size(CELL pointer) switch(untag_header(get(pointer))) { + case WORD_TYPE: + return align8(sizeof(WORD)); case F_TYPE: case T_TYPE: case EMPTY_TYPE: diff --git a/native/types.h b/native/types.h index ca91b8e4cb..1da17611da 100644 --- a/native/types.h +++ b/native/types.h @@ -10,8 +10,7 @@ #define CONS_TYPE 2 #define OBJECT_TYPE 3 #define HEADER_TYPE 4 -#define XT_TYPE 5 -#define GC_COLLECTED 6 /* See gc.c */ +#define GC_COLLECTED 5 /* See gc.c */ /*** Header types ***/ diff --git a/native/word.h b/native/word.h index 6e04db02be..9adc014da4 100644 --- a/native/word.h +++ b/native/word.h @@ -1,9 +1,11 @@ typedef void (*XT)(void); typedef struct { - /* TAGGED execution token: jump here to execute word */ + /* TAGGED header */ + CELL header; + /* untagged execution token: jump here to execute word */ CELL xt; - /* on-disk primitive number */ + /* untagged on-disk primitive number */ CELL primitive; /* TAGGED parameter to xt; used for colon definitions */ CELL parameter; -- 2.34.1