]> gitweb.factorcode.org Git - factor.git/commitdiff
clean up x86 generator, add SDL and alien to bootstrap
authorSlava Pestov <slava@factorcode.org>
Mon, 13 Dec 2004 23:40:21 +0000 (23:40 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 13 Dec 2004 23:40:21 +0000 (23:40 +0000)
library/bootstrap/boot-stage2.factor
library/compiler/alien.factor
library/compiler/generator-x86.factor
library/compiler/linearizer.factor

index c44de529a3dff8978a964d2507c30b6d5d0a4b38..5dead6a080c353022d8a681c6f5b6e80e42f136d 100644 (file)
@@ -113,12 +113,21 @@ USE: stdio
     "/library/inference/branches.factor"\r
     "/library/inference/stack.factor"\r
 \r
-    "/library/compiler/optimizer.factor"\r
-    "/library/compiler/linearizer.factor"\r
     "/library/compiler/assembler.factor"\r
     "/library/compiler/xt.factor"\r
+    "/library/compiler/optimizer.factor"\r
+    "/library/compiler/linearizer.factor"\r
     "/library/compiler/generator.factor"\r
     "/library/compiler/compiler.factor"\r
+    "/library/compiler/alien-types.factor"\r
+    "/library/compiler/alien.factor"\r
+\r
+    "/library/sdl/sdl.factor"\r
+    "/library/sdl/sdl-video.factor"\r
+    "/library/sdl/sdl-event.factor"\r
+    "/library/sdl/sdl-gfx.factor"\r
+    "/library/sdl/sdl-keysym.factor"\r
+    "/library/sdl/sdl-utils.factor"\r
 \r
     "/library/bootstrap/image.factor"\r
     "/library/bootstrap/cross-compiler.factor"\r
@@ -149,21 +158,7 @@ cpu "x86" = [
     [\r
          "/library/compiler/assembly-x86.factor"\r
          "/library/compiler/generator-x86.factor"\r
-!        "/library/compiler/compiler-macros.factor"\r
-!        "/library/compiler/ifte.factor"\r
-!        "/library/compiler/generic.factor"\r
-!        "/library/compiler/stack.factor"\r
-!        "/library/compiler/interpret-only.factor"\r
-!        "/library/compiler/alien-types.factor"\r
 !        "/library/compiler/alien-macros.factor"\r
-!        "/library/compiler/alien.factor"\r
-!        \r
-!        "/library/sdl/sdl.factor"\r
-!        "/library/sdl/sdl-video.factor"\r
-!        "/library/sdl/sdl-event.factor"\r
-!        "/library/sdl/sdl-gfx.factor"\r
-!        "/library/sdl/sdl-keysym.factor"\r
-!        "/library/sdl/sdl-utils.factor"\r
     ] [\r
         dup print\r
         run-resource\r
index f6fd7139869091aa2993a96f495a0f8867e692b8..5e5e4817643caae7b60d8d13a2ec37d0b4f6a2cb 100644 (file)
@@ -73,12 +73,12 @@ USE: words
 : alien-function ( function library -- )
     [ library dlsym ] [ dlsym-self ] ifte* ;
 
-: compile-alien-call
-    pop-literal reverse PARAMETERS >r
-    pop-literal pop-literal alien-function CALL JUMP-FIXUP
-    r> CLEANUP
-    pop-literal RETURNS ;
-
-global [ <namespace> "libraries" set ] bind
-
-\ alien-call [ compile-alien-call ] "compiling" set-word-property
+: compile-alien-call
+    pop-literal reverse PARAMETERS >r
+    pop-literal pop-literal alien-function CALL JUMP-FIXUP
+    r> CLEANUP
+    pop-literal RETURNS ;
+! 
+global [ <namespace> "libraries" set ] bind
+! 
+\ alien-call [ compile-alien-call ] "compiling" set-word-property
index 1f342beb1aeccd49371428e134df3c8cad9aa2b6..92b78c375dee0e7e1b419a273452f5954f01fddd 100644 (file)
@@ -57,19 +57,14 @@ USE: words
 ] "generator" set-word-property
 
 #call [
-    dup postpone-word
     CALL compiled-offset defer-xt
 ] "generator" set-word-property
 
-#call-label [
-    CALL compiled-offset defer-xt
-] "generator" set-word-property
-
-#jump-label [
+#jump [
     JUMP compiled-offset defer-xt
 ] "generator" set-word-property
 
-#jump-label-t [
+#jump-t [
     POP-DS
     ! condition is now in EAX
     f address EAX CMP-I-R
index ccc3baaf0c36e4b26ab900abcdf12ae80a68512f..2267134df4360b87c68b8dbacfa0d0b4d8d72dda 100644 (file)
@@ -44,8 +44,7 @@ USE: errors
 
 SYMBOL: #push-immediate
 SYMBOL: #push-indirect
-SYMBOL: #jump-label-t ( branch if top of stack is true )
-SYMBOL: #jump-label ( unconditional branch )
+SYMBOL: #jump-t ( branch if top of stack is true )
 SYMBOL: #jump ( tail-call )
 SYMBOL: #return-to ( push addr on C stack )
 
@@ -87,8 +86,18 @@ SYMBOL: #target ( part of jump table )
     swons ,
 ] "linearizer" set-word-property
 
+#call [
+    dup [ node-param get ] bind postpone-word
+    linear,
+] "linearizer" set-word-property
+
+#call-label [
+    [ node-param get ] bind #call swons ,
+] "linearizer" set-word-property
+
 : <label> ( -- label )
-    gensym ;
+    gensym
+    dup t "label" set-word-property ;
 
 : label, ( label -- )
     #label swons , ;
@@ -124,9 +133,9 @@ SYMBOL: #target ( part of jump table )
     #! IR.
     uncons car
     <label> [
-        #jump-label-t swons ,
+        #jump-t swons ,
         (linearize) ( false branch )
-        <label> dup #jump-label swons ,
+        <label> dup #jump swons ,
     ] keep label, ( branch target of BRANCH-T )
     swap (linearize) ( true branch )
     label, ( branch target of false branch end ) ;
@@ -144,9 +153,7 @@ SYMBOL: #target ( part of jump table )
 
 : dispatch-body ( end label/param -- )
     #! Output each branch, with a jump to the end label.
-    [
-        uncons label,  (linearize)  dup #jump-label swons ,
-    ] each drop ;
+    [ uncons label, (linearize) dup #jump swons , ] each drop ;
 
 : check-dispatch ( vtable -- )
     length num-types = [