]> gitweb.factorcode.org Git - factor.git/commitdiff
remove -falign-functions=8 restriction
authorSlava Pestov <slava@factorcode.org>
Wed, 28 Jul 2004 03:29:37 +0000 (03:29 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 28 Jul 2004 03:29:37 +0000 (03:29 +0000)
build.sh
library/platform/native/.image.factor.marks
library/platform/native/image.factor
native/gc.c
native/primitives.c
native/relocate.c
native/run.c
native/types.c
native/types.h
native/word.h

index 17fd95fb12f5f89d672d62ec013677fb9e80e778..410462d4b6004727c32492edbf457b0bb97c55d9 100644 (file)
--- 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
 
index 3338d6b2629396a907f6371ab5a628dd7a054627..e8c9eb1445e5026e64c3c91cd762bb534d2359b3 100644 (file)
Binary files a/library/platform/native/.image.factor.marks and b/library/platform/native/.image.factor.marks differ
index 8b801a7887452e6a4551bf08cbd3472d29512899..e57a51033ecb648556600d9c718347cdcb3501eb 100644 (file)
@@ -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,) ;
index b799673fc81b062cde3ddf8dad473e5a430bfed4..ec4039f60a4e92a4e05a62098c75a64eda15b068 100644 (file)
@@ -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;
index 8a4112ae3344b49bdeae0a152ffdbdc32def39ea..eef4bd40942d6ba36d4e1449b459cfb70b70415d 100644 (file)
@@ -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)
index 3c91e53a62876b342385a08d45aa0633fb00ba28..7d29c2017674a309b07d818c9db31fc2deec43eb 100644 (file)
@@ -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;
index bb79fb19fef8638dbbeeaf7c91c327cadf9edb71..26050fcc3b25c23f2c66224ec24103943b008866 100644 (file)
@@ -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)
 {
index 2b4c58ed87f2ebfd633e03087e3ac51689e55241..2e869630926d550519e1931e4b67da8ba9f45dcd 100644 (file)
@@ -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:
index ca91b8e4cb114d5429828a16d3192de2bc030cbe..1da17611da145c0376b6c5260a36fab1c27b6f9d 100644 (file)
@@ -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 ***/
 
index 6e04db02be08295317a597fa037dd5eb1f77fb4b..9adc014da4ac12b48abd3deef3ffa827404f71a6 100644 (file)
@@ -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;