compiler: inline singleton predicates, and optimize predicate engines, reduces terrain demo deployed size by ~20kb

db4
Slava Pestov 2009-08-17 23:59:24 -05:00
parent 04397a63c7
commit d7594c3381
2 changed files with 4 additions and 3 deletions

2
basis/compiler/compiler.factor Normal file → Executable file
View File

@ -120,7 +120,7 @@ M: predicate-engine-word no-compile? "owner-generic" word-prop no-compile? ;
} cond ;
: optimize? ( word -- ? )
{ [ predicate-engine-word? ] [ single-generic? ] } 1|| not ;
single-generic? not ;
: contains-breakpoints? ( -- ? )
dependencies get keys [ "break?" word-prop ] any? ;

5
basis/compiler/tree/finalization/finalization.factor Normal file → Executable file
View File

@ -1,8 +1,8 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors sequences words memoize combinators
classes classes.builtin classes.tuple math.partial-dispatch
fry assocs combinators.short-circuit
classes classes.builtin classes.tuple classes.singleton
math.partial-dispatch fry assocs combinators.short-circuit
compiler.tree
compiler.tree.combinators
compiler.tree.propagation.info
@ -45,6 +45,7 @@ M: predicate finalize-word
"predicating" word-prop {
{ [ dup builtin-class? ] [ drop word>> cached-expansion ] }
{ [ dup tuple-class? ] [ drop word>> def>> splice-final ] }
{ [ dup singleton-class? ] [ drop word>> def>> splice-final ] }
[ drop ]
} cond ;