From ecd0bdbd589d242896abb9e389da414d839b5121 Mon Sep 17 00:00:00 2001 From: Joe Groff <arcata@gmail.com> Date: Wed, 26 Aug 2009 21:38:00 -0500 Subject: [PATCH] test that struct-arrays and struct construction optimize down --- basis/classes/struct/struct-tests.factor | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/basis/classes/struct/struct-tests.factor b/basis/classes/struct/struct-tests.factor index d788b9bdb1..cc781225e6 100644 --- a/basis/classes/struct/struct-tests.factor +++ b/basis/classes/struct/struct-tests.factor @@ -4,7 +4,8 @@ alien.structs.fields alien.syntax ascii classes.struct combinators destructors io.encodings.utf8 io.pathnames io.streams.string kernel libc literals math multiline namespaces prettyprint prettyprint.config see sequences specialized-arrays.ushort -system tools.test combinators.short-circuit ; +system tools.test compiler.tree.debugger struct-arrays +classes.tuple.private ; IN: classes.struct.tests << @@ -178,3 +179,14 @@ STRUCT: struct-test-array-slots [ y>> [ 8 3 ] dip set-nth ] [ y>> ushort-array{ 2 3 5 8 11 13 } sequence= ] bi ] unit-test + +STRUCT: struct-test-optimization + { x int } { y int } ; + +[ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test +[ t ] [ + [ 3 struct-test-optimization <direct-struct-array> third y>> ] + { <tuple> <tuple-boa> memory>struct y>> } inlined? +] unit-test + +[ f ] [ [ memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test