- reader syntax for arrays, byte arrays, displaced aliens\r
- out of memory error when printing global namespace\r
-- decompile is broken\r
+- removing unneeded #label\r
\r
+ ui:\r
\r
- value type structs\r
- bitfields in C structs\r
- setting struct members that are not *\r
+- callbacks\r
\r
+ compiler:\r
\r
: decompile ( word -- )
dup compiled? [
- "Decompiling " write dup .
- [ word-primitive ] keep set-word-primitive
+ "Decompiling " write dup . update-xt
] [
drop
] ifte ;
\ fixnum* [
! Turn multiplication by a power of two into a left shift.
- dup node-peek dup literal-fixnum? [
+ dup node-peek dup literal-immediate? [
literal-value dup power-of-2? [
nip fast-fixnum*
] [
! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: compiler-backend
-USING: generic inference kernel lists math namespaces
+USING: generic kernel lists math namespaces
prettyprint sequences strings words ;
! A peephole optimizer operating on the linear IR.
optimize-fold ;
! #label
-GENERIC: calls-label? ( label node -- ? )
-
-M: node calls-label? 2drop f ;
-
-M: #call-label calls-label? node-param eq? ;
-
-M: #label optimize-node* ( node -- node/t )
- dup node-param over node-children first calls-label? [
- drop t
- ] [
- dup node-children first dup node-successor [
- dup penultimate-node rot
- node-successor swap set-node-successor
- ] [
- drop node-successor
- ] ifte
- ] ifte ;
+GENERIC: calls-label* ( label node -- ? )
+
+M: node calls-label* 2drop f ;
+
+M: #call-label calls-label* node-param eq? ;
+
+: calls-label? ( label node -- ? )
+ [ calls-label? not ] all-nodes-with? not ;
+
+! M: #label optimize-node* ( node -- node/t )
+! dup node-param over node-children first calls-label? [
+! drop t
+! ] [
+! dup node-children first dup node-successor [
+! dup penultimate-node rot
+! node-successor swap set-node-successor
+! ] [
+! drop node-successor
+! ] ifte
+! ] ifte ;
IN: temporary
USING: gadgets namespaces styles test ;
-[
- 0 x set
- 0 y set
-
- [ { 255 0 0 } ] [ { 1 0 0 } red green <gradient> 0 gradient-color ] unit-test
- [ { 0 255 0 } ] [ { 1 0 0 } red green <gradient> 1 gradient-color ] unit-test
-
- [ 0 100 0 { 255 0 0 } ]
- [ { 0 1 0 } red green <gradient> { 100 200 0 } 0 (gradient-x) ] unit-test
-
- [ 0 100 100 { 255/2 255/2 0 } ]
- [ { 0 1 0 } red green <gradient> { 100 200 0 } 100 (gradient-x) ] unit-test
-
- [ 0 0 200 { 255 0 0 } ]
- [ { 1 0 0 } red green <gradient> { 100 200 0 } 0 (gradient-y) ] unit-test
-
- [ 50 0 200 { 255/2 255/2 0 } ]
- [ { 1 0 0 } red green <gradient> { 100 200 0 } 50 (gradient-y) ] unit-test
-] with-scope
+[ { 255 0 0 } ] [ { 1 0 0 } red green <gradient> 0 gradient-color ] unit-test
+[ { 0 255 0 } ] [ { 1 0 0 } red green <gradient> 1 gradient-color ] unit-test
+
+[ 0 100 0 { 255 0 0 } ]
+[ { 0 1 0 } red green <gradient> { 100 200 0 } 0 (gradient-x) ] unit-test
+
+[ 0 100 100 { 255/2 255/2 0 } ]
+[ { 0 1 0 } red green <gradient> { 100 200 0 } 100 (gradient-x) ] unit-test
+
+[ 0 0 200 { 255 0 0 } ]
+[ { 1 0 0 } red green <gradient> { 100 200 0 } 0 (gradient-y) ] unit-test
+
+[ 50 0 200 { 255/2 255/2 0 } ]
+[ { 1 0 0 } red green <gradient> { 100 200 0 } 50 (gradient-y) ] unit-test
IN: temporary
-USING: inspector math namespaces prettyprint test ;
+USING: kernel inspector math namespaces prettyprint test
+sequences ;
-[[ "hello" "world" ]] inspect
+{ } clone inspector-stack set
-[ "hello" ] [ 0 get ] unit-test
-[ "world" ] [ 1 get ] unit-test
+[[ "hello" "world" ]] (inspect)
-[ 1 2 3 ] inspect
-f inspect
-\ + inspect
+[ "hello" ] [ 0 inspector-slots get nth ] unit-test
+[ "world" ] [ 1 inspector-slots get nth ] unit-test
+
+[ 1 2 3 ] (inspect)
+f (inspect)
+\ + (inspect)
"hello" "x" unique@
"x" get
] unit-test
-
-[ [ "xyz" #{ 3 2 }# 1/5 [ { } ] ] ] [
- [ "xyz" , "xyz" unique,
- #{ 3 2 }# , #{ 3 2 }# unique,
- 1/5 , 1/5 unique,
- [ { } unique, ] [ ] make , ] [ ] make
-] unit-test
IN: temporary
-USING: compiler inference math generic parser ;
-
-USE: test
+USING: compiler inference math generic parser test ;
: foo 1 2 ;
: bar foo foo ; compiled
[ f ] [ [ 0 10 "hello" subseq ] [ not ] catch ] unit-test
-[ [ "hell" "o wo" "rld" ] ] [ 4 "hello world" group ] unit-test
+[ { "hell" "o wo" "rld" } ] [ 4 "hello world" group ] unit-test
[ 4 ] [
0 "There are Four Upper Case characters"