compiler.tree.escape-analysis: make tests a bit more robust; a change to boa constructors recently meant dead curries were showing up on certain expansions, this was throwing off the escape-analysis test's unboxed allocation counting. Fix this by having the test run DCE first, and remove a few tests that no longer make sense now

db4
Slava Pestov 2010-01-18 23:32:34 +13:00
parent c4f19bc117
commit ac800e2396
1 changed files with 3 additions and 19 deletions

View File

@ -7,7 +7,7 @@ math.private kernel tools.test accessors slots.private
quotations.private prettyprint classes.tuple.private classes quotations.private prettyprint classes.tuple.private classes
classes.tuple namespaces classes.tuple namespaces
compiler.tree.propagation.info stack-checker.errors compiler.tree.propagation.info stack-checker.errors
compiler.tree.checker compiler.tree.checker compiler.tree.def-use compiler.tree.dead-code
kernel.private vectors ; kernel.private vectors ;
IN: compiler.tree.escape-analysis.tests IN: compiler.tree.escape-analysis.tests
@ -37,6 +37,8 @@ M: node count-unboxed-allocations* drop ;
cleanup cleanup
escape-analysis escape-analysis
dup check-nodes dup check-nodes
compute-def-use
remove-dead-code
0 swap [ count-unboxed-allocations* ] each-node ; 0 swap [ count-unboxed-allocations* ] each-node ;
[ 0 ] [ [ [ + ] curry ] count-unboxed-allocations ] unit-test [ 0 ] [ [ [ + ] curry ] count-unboxed-allocations ] unit-test
@ -173,12 +175,6 @@ TUPLE: cons { car read-only } { cdr read-only } ;
[ 10 [ drop ] each-integer ] count-unboxed-allocations [ 10 [ drop ] each-integer ] count-unboxed-allocations
] unit-test ] unit-test
[ 2 ] [
[
1 2 cons boa 10 [ 2drop 1 2 cons boa ] each-integer car>>
] count-unboxed-allocations
] unit-test
[ 0 ] [ [ 0 ] [
[ [
1 2 cons boa 10 [ drop 2 cons boa ] each-integer car>> 1 2 cons boa 10 [ drop 2 cons boa ] each-integer car>>
@ -304,14 +300,6 @@ C: <ro-box> ro-box
[ 0 ] [ [ 1 cons boa "x" get slot ] count-unboxed-allocations ] unit-test [ 0 ] [ [ 1 cons boa "x" get slot ] count-unboxed-allocations ] unit-test
: impeach-node ( quot: ( node -- ) -- )
[ call ] keep impeach-node ; inline recursive
: bleach-node ( quot: ( node -- ) -- )
[ bleach-node ] curry [ ] compose impeach-node ; inline recursive
[ 3 ] [ [ [ ] bleach-node ] count-unboxed-allocations ] unit-test
[ 0 ] [ [ 0 ] [
[ dup -1 over >= [ 0 >= [ "A" throw ] unless ] [ drop ] if ] [ dup -1 over >= [ 0 >= [ "A" throw ] unless ] [ drop ] if ]
count-unboxed-allocations count-unboxed-allocations
@ -322,10 +310,6 @@ C: <ro-box> ro-box
count-unboxed-allocations count-unboxed-allocations
] unit-test ] unit-test
[ 0 ] [
[ { null } declare [ 1 ] [ 2 ] if ] count-unboxed-allocations
] unit-test
! Doug found a regression ! Doug found a regression
TUPLE: empty-tuple ; TUPLE: empty-tuple ;