1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs namespaces sequences kernel definitions ;
6 ! Nesting state to solve recursion
7 SYMBOL: recursive-state
9 ! Number of inputs current word expects from the stack
12 ! Compile-time data stack
15 : push-d ( obj -- ) meta-d get push ;
16 : pop-d ( -- obj ) meta-d get pop ;
17 : peek-d ( -- obj ) meta-d get peek ;
19 ! Compile-time retain stack
22 : push-r ( obj -- ) meta-r get push ;
23 : pop-r ( -- obj ) meta-r get pop ;
24 : peek-r ( -- obj ) meta-r get peek ;
27 SYMBOL: dataflow-graph
31 ! Words that the current dataflow IR depends on
34 : depends-on ( word how -- )
35 swap dependencies get dup [
36 2dup at +inlined+ eq? [ 3drop ] [ set-at ] if
39 ! Did the current control-flow path throw an error?
42 ! Words we've inferred the stack effect of, for rollback