Make the walker infer

db4
Slava Pestov 2009-04-16 23:14:11 -05:00
parent a69d404f74
commit 0a5b076c11
5 changed files with 32 additions and 25 deletions

View File

@ -63,19 +63,20 @@ SYMBOLS: +optimized+ +unoptimized+ ;
} 1||
] [ error-type +compiler-warning+ eq? ] bi* and ;
: fail ( word error -- * )
[ 2dup ignore-error? [ drop f ] when swap compiler-error ]
[
drop
: (fail) ( word -- * )
[ compiled-unxref ]
[ f swap compiled get set-at ]
[ +unoptimized+ save-compiled-status ]
tri
] 2bi
return ;
: fail ( word error -- * )
[ 2dup ignore-error? [ drop f ] when swap compiler-error ] [ drop (fail) ] 2bi ;
: frontend ( word -- nodes )
[ build-tree-from-word ] [ fail ] recover optimize-tree ;
dup contains-breakpoints? [ (fail) ] [
[ build-tree-from-word ] [ fail ] recover optimize-tree
] if ;
! Only switch this off for debugging.
SYMBOL: compile-dependencies?

View File

@ -58,3 +58,6 @@ TUPLE: do-not-compile word ;
} cleave
] maybe-cannot-infer
] with-tree-builder ;
: contains-breakpoints? ( word -- ? )
def>> [ word? ] filter [ "break?" word-prop ] any? ;

View File

@ -148,7 +148,11 @@ DEFER: (flat-length)
] sum-outputs ;
: should-inline? ( #call word -- ? )
dup "inline" word-prop [ 2drop t ] [ inlining-rank 5 >= ] if ;
{
{ [ dup contains-breakpoints? ] [ 2drop f ] }
{ [ dup "inline" word-prop ] [ 2drop t ] }
[ inlining-rank 5 >= ]
} cond ;
SYMBOL: history

View File

@ -12,7 +12,6 @@ IN: tools.continuations
: after-break ( object -- )
{
{ [ dup continuation? ] [ (continue) ] }
{ [ dup quotation? ] [ call ] }
{ [ dup not ] [ "Single stepping abandoned" rethrow ] }
} cond ;
@ -22,7 +21,7 @@ SYMBOL: break-hook
: break ( -- )
continuation callstack >>call
break-hook get call
break-hook get call( continuation -- continuation' )
after-break ;
\ break t "break?" set-word-prop
@ -125,14 +124,14 @@ PRIVATE>
} [ "step-into" set-word-prop ] assoc-each
! Never step into these words
: don't-step-into ( word -- )
dup [ execute break ] curry "step-into" set-word-prop ;
{
>n ndrop >c c>
continue continue-with
stop suspend (spawn)
} [
dup [ execute break ] curry
"step-into" set-word-prop
] each
} [ don't-step-into ] each
\ break [ break ] "step-into" set-word-prop

View File

@ -74,14 +74,14 @@ C: <continuation> continuation
<PRIVATE
: (continue) ( continuation -- * )
[
>continuation<
set-catchstack
set-namestack
set-retainstack
[ set-datastack ] dip
set-callstack ;
\ (continue) t "no-compile" set-word-prop
set-callstack
] (( continuation -- * )) call-effect-unsafe ;
PRIVATE>