]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tree/propagation/propagation-tests.factor
compiler.tree.propagation: Eliminate redundant resize calls
[factor.git] / basis / compiler / tree / propagation / propagation-tests.factor
index 5a4b3dffc81d4ef5bc008f706291a706b194ceaa..e8fdf70bc251894d95b0471c58ddd3c806a41bed 100644 (file)
@@ -44,6 +44,22 @@ IN: compiler.tree.propagation.tests
     [ 42 swap resize-array length ] final-literals first
 ] unit-test
 
+{ f } [
+    [ resize-array ] { resize-array } inlined?
+] unit-test
+
+{ t } [
+    [ 3 { 1 2 3 } resize-array ] { resize-array } inlined?
+] unit-test
+
+{ f } [
+    [ 4 { 1 2 3 } resize-array ] { resize-array } inlined?
+] unit-test
+
+{ f } [
+    [ 4 swap { array } declare resize-array ] { resize-array } inlined?
+] unit-test
+
 ! Byte arrays
 { V{ 3 } } [
     [ 3 <byte-array> length ] final-literals
@@ -63,6 +79,10 @@ IN: compiler.tree.propagation.tests
     [ 43 swap resize-byte-array length ] final-literals first
 ] unit-test
 
+{ t } [
+    [ 3 B{ 1 2 3 } resize-byte-array ] { resize-byte-array } inlined?
+] unit-test
+
 ! Strings
 { V{ 3 } } [
     [ 3 f <string> length ] final-literals
@@ -77,6 +97,10 @@ IN: compiler.tree.propagation.tests
     [ 44 swap resize-string length ] final-literals
 ] unit-test
 
+{ t } [
+    [ 3 "123" resize-string ] { resize-string } inlined?
+] unit-test
+
 { V{ t } } [
     [ { string } declare string? ] final-classes
 ] unit-test