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
[ \ 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