compiler.tree.propagation.call-effect: clear out dependency tracking variables to ensure that infer calls made by call( as part of the compile process doesn't pollute the dependencies of the word being compiled
parent
29fc287618
commit
817bc02392
|
@ -2,14 +2,19 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays combinators combinators.private effects
|
USING: accessors arrays combinators combinators.private effects
|
||||||
fry kernel kernel.private make sequences continuations
|
fry kernel kernel.private make sequences continuations
|
||||||
quotations words math stack-checker combinators.short-circuit
|
quotations words math stack-checker stack-checker.dependencies
|
||||||
stack-checker.transforms compiler.tree.propagation.info
|
combinators.short-circuit stack-checker.transforms
|
||||||
|
compiler.tree.propagation.info
|
||||||
compiler.tree.propagation.inlining compiler.units ;
|
compiler.tree.propagation.inlining compiler.units ;
|
||||||
IN: compiler.tree.propagation.call-effect
|
IN: compiler.tree.propagation.call-effect
|
||||||
|
|
||||||
! call( and execute( have complex expansions.
|
! call( and execute( have complex expansions.
|
||||||
|
|
||||||
! call( uses the following strategy:
|
! If the input quotation is a literal, or built up from curry and
|
||||||
|
! compose with terminal quotations literal, it is inlined at the
|
||||||
|
! call site.
|
||||||
|
|
||||||
|
! For dynamic call sites, call( uses the following strategy:
|
||||||
! - Inline caching. If the quotation is the same as last time, just call it unsafely
|
! - Inline caching. If the quotation is the same as last time, just call it unsafely
|
||||||
! - Effect inference. Infer quotation's effect, caching it in the cached-effect slot,
|
! - Effect inference. Infer quotation's effect, caching it in the cached-effect slot,
|
||||||
! and compare it with declaration. If matches, call it unsafely.
|
! and compare it with declaration. If matches, call it unsafely.
|
||||||
|
@ -58,7 +63,7 @@ M: compose cached-effect
|
||||||
[ first>> ] [ second>> ] bi [ cached-effect ] bi@ compose-effects* ;
|
[ first>> ] [ second>> ] bi [ cached-effect ] bi@ compose-effects* ;
|
||||||
|
|
||||||
: safe-infer ( quot -- effect )
|
: safe-infer ( quot -- effect )
|
||||||
[ infer ] [ 2drop +unknown+ ] recover ;
|
[ [ infer ] [ 2drop +unknown+ ] recover ] without-dependencies ;
|
||||||
|
|
||||||
: cached-effect-valid? ( quot -- ? )
|
: cached-effect-valid? ( quot -- ? )
|
||||||
cache-counter>> effect-counter eq? ; inline
|
cache-counter>> effect-counter eq? ; inline
|
||||||
|
|
|
@ -35,3 +35,10 @@ SYMBOL: generic-dependencies
|
||||||
: depends-on-generic ( class generic -- )
|
: depends-on-generic ( class generic -- )
|
||||||
generic-dependencies get dup
|
generic-dependencies get dup
|
||||||
[ [ ?class-or ] change-at ] [ 3drop ] if ;
|
[ [ ?class-or ] change-at ] [ 3drop ] if ;
|
||||||
|
|
||||||
|
: without-dependencies ( quot -- )
|
||||||
|
[
|
||||||
|
dependencies off
|
||||||
|
generic-dependencies off
|
||||||
|
call
|
||||||
|
] with-scope ; inline
|
||||||
|
|
Loading…
Reference in New Issue