]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' into propagation
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Tue, 15 Jun 2010 17:26:01 +0000 (13:26 -0400)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Tue, 15 Jun 2010 17:26:01 +0000 (13:26 -0400)
1  2 
basis/compiler/tree/propagation/transforms/transforms.factor

index da081800df53769b098a3f3aa136a56ac9d73a6c,28de7abd4bfc93fc0d84f91f266b02732a707444..947f481cef60021a85affd4bbdaf3e199e4523f9
@@@ -6,9 -6,10 +6,10 @@@ definitions stack-checker.dependencies 
  classes.tuple.private math math.partial-dispatch math.private
  math.intervals sets.private math.floats.private
  math.integers.private layouts math.order vectors hashtables
- combinators effects generalizations assocs sets
- combinators.short-circuit sequences.private locals growable
- stack-checker namespaces compiler.tree.propagation.info ;
+ combinators effects generalizations sequences.generalizations
+ assocs sets combinators.short-circuit sequences.private locals
+ growable stack-checker namespaces compiler.tree.propagation.info
+ ;
  FROM: math => float ;
  FROM: sets => set ;
  IN: compiler.tree.propagation.transforms
      } case
  ] "custom-inlining" set-word-prop
  
 +:: inline-instance ( node -- quot/f )
 +    node in-d>> first2 [ value-info ] bi@ literal>> :> ( obj class )
 +    class class? [
 +        {
 +            [ class \ f = not ]
 +            [ obj class>> \ f class-not class-and class class<= ]
 +        } 0&& [
 +            ! TODO: replace this with an implicit null check when
 +            ! profitable, once Factor gets OSR implemented
 +            [ drop >boolean ]
 +        ] [
 +            class "predicate" word-prop '[ drop @ ]
 +        ] if
 +    ] [ f ] if ;
 +
 +\ instance? [ inline-instance ] "custom-inlining" set-word-prop
 +
  ERROR: bad-partial-eval quot word ;
  
  : check-effect ( quot word -- )
  
  \ new [ inline-new ] 1 define-partial-eval
  
 -\ instance? [
 -    dup class?
 -    [ "predicate" word-prop ] [ drop f ] if
 -] 1 define-partial-eval
 -
  ! Shuffling
  : nths-quot ( indices -- quot )
      [ [ '[ _ swap nth ] ] map ] [ length ] bi
@@@ -312,12 -301,16 +313,10 @@@ M\ set intersect [ intersect-quot ] 1 d
      [ \ push def>> ] [ f ] if
  ] "custom-inlining" set-word-prop
  
 -! Speeds up fasta benchmark
 -\ >fixnum [
 -    in-d>> first value-info class>> fixnum \ f class-or class<=
 -    [ [ dup [ \ >fixnum no-method ] unless ] ] [ f ] if
 -] "custom-inlining" set-word-prop
 -
  ! We want to constant-fold calls to heap-size, and recompile those
  ! calls when a C type is redefined
  \ heap-size [
-     dup word? [
-         [ depends-on-definition ] [ heap-size '[ _ ] ] bi
-     ] [ drop f ] if
+     [ depends-on-c-type ] [ heap-size '[ _ ] ] bi
  ] 1 define-partial-eval
  
  ! Eliminates a few redundant checks here and there