"/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
[\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
: 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
] "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
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 )
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 , ;
#! 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 ) ;
: 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 = [