compiler.tree.dead-code: methods on flushable generics should be flushable

db4
Slava Pestov 2009-07-03 21:31:26 -05:00
parent 14f2405814
commit 0180209f4e
2 changed files with 29 additions and 3 deletions

View File

@ -6,6 +6,7 @@ definitions system layouts vectors math.partial-dispatch
math.order math.functions accessors hashtables classes assocs math.order math.functions accessors hashtables classes assocs
io.encodings.utf8 io.encodings.ascii io.encodings fry slots io.encodings.utf8 io.encodings.ascii io.encodings fry slots
sorting.private combinators.short-circuit grouping prettyprint sorting.private combinators.short-circuit grouping prettyprint
generalizations
compiler.tree compiler.tree
compiler.tree.combinators compiler.tree.combinators
compiler.tree.cleanup compiler.tree.cleanup
@ -518,3 +519,23 @@ cell-bits 32 = [
[ { integer integer } declare + drop ] [ { integer integer } declare + drop ]
{ + +-integer-integer } inlined? { + +-integer-integer } inlined?
] unit-test ] unit-test
[ [ ] ] [
[
20 f <array>
[ 0 swap nth ] keep
[ 1 swap nth ] keep
[ 2 swap nth ] keep
[ 3 swap nth ] keep
[ 4 swap nth ] keep
[ 5 swap nth ] keep
[ 6 swap nth ] keep
[ 7 swap nth ] keep
[ 8 swap nth ] keep
[ 9 swap nth ] keep
[ 10 swap nth ] keep
[ 11 swap nth ] keep
[ 12 swap nth ] keep
14 ndrop
] cleaned-up-tree nodes>quot
] unit-test

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors words assocs sequences arrays namespaces USING: kernel accessors words assocs sequences arrays namespaces
fry locals definitions classes.algebra fry locals definitions classes classes.algebra generic
stack-checker.state stack-checker.state
stack-checker.backend stack-checker.backend
compiler.tree compiler.tree
@ -9,8 +9,13 @@ compiler.tree.propagation.info
compiler.tree.dead-code.liveness ; compiler.tree.dead-code.liveness ;
IN: compiler.tree.dead-code.simple IN: compiler.tree.dead-code.simple
: flushable? ( word -- ? ) GENERIC: flushable? ( word -- ? )
[ "flushable" word-prop ] [ "predicating" word-prop ] bi or ;
M: predicate flushable? drop t ;
M: word flushable? "flushable" word-prop ;
M: method-body flushable? "method-generic" word-prop flushable? ;
: flushable-call? ( #call -- ? ) : flushable-call? ( #call -- ? )
dup word>> dup flushable? [ dup word>> dup flushable? [