dup empty? [
drop
] [
- hash-case-table hash-dispatch-quot
- [ dup hashcode >fixnum ] swap append
+ dup length 4 <= [
+ case>quot
+ ] [
+ hash-case-table hash-dispatch-quot
+ [ dup hashcode >fixnum ] swap append
+ ] if
] if ;
io.streams.string layouts splitting math.intervals
math.floats.private tuples tuples.private classes
optimizer.def-use optimizer.backend optimizer.pattern-match
-float-arrays combinators.private ;
+float-arrays combinators.private combinators ;
! the output of <tuple> and <tuple-boa> has the class which is
! its second-to-last input
{ [ dup disjoint-eq? ] [ [ f ] inline-literals ] }
} define-optimizers
+: literal-member? ( #call -- ? )
+ node-in-d peek dup value?
+ [ value-literal sequence? ] [ drop f ] if ;
+
+: member-quot ( seq -- newquot )
+ [ [ t ] ] { } map>assoc [ drop f ] add [ nip case ] curry ;
+
+: expand-member ( #call -- )
+ dup node-in-d peek value-literal member-quot splice-quot ;
+
+\ member? {
+ { [ dup literal-member? ] [ expand-member ] }
+} define-optimizers
+
! if the result of eq? is t and the second input is a literal,
! the first input is equal to the second
\ eq? [
: post-process ( class interval node -- classes intervals )
dupd won't-overflow?
- [ >r dup { f integer } memq? [ drop fixnum ] when r> ] when
+ [ >r dup { f integer } member? [ drop fixnum ] when r> ] when
[ dup [ 1array ] when ] 2apply ;
: math-output-interval-1 ( node word -- interval )
{ "New, efficient implementations of " { $link bit? } " and " { $link log2 } " runs in constant time for large bignums" }
{ "New " { $link big-random } " word for generating large random numbers quickly" }
{ "Improved profiler no longer has to be explicitly enabled and disabled with a full recompile; instead, the " { $link profile } " word can be used at any time, and it dynamically patches words to increment call counts. There is no overhead when the profiler is not in use." }
+ { "Calls to " { $link member? } " with a literal sequence are now open-coded. If there are four or fewer elements, a series of conditionals are generated; if there are more than four elements, there is a hash dispatch followed by conditionals in each branch." }
}
{ $subheading "IO" }
{ $list