[libcxxabi] r262717 - Reducing stack usage of test

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 4 06:25:14 PST 2016


Author: bcraig
Date: Fri Mar  4 08:25:13 2016
New Revision: 262717

URL: http://llvm.org/viewvc/llvm-project?rev=262717&view=rev
Log:
Reducing stack usage of test

This test has a lot of classes with large amounts of manually inserted padding in them, presumably to prevent various optimizations. The test then creates lots of these objects on the stack. On embedded targets, this was usually enough to overflow the stack.

I moved the objects to global / namespace scope. Since the tests are each in their own namespace, there should be no cross-test conflicts.

Modified:
    libcxxabi/trunk/test/dynamic_cast14.pass.cpp

Modified: libcxxabi/trunk/test/dynamic_cast14.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/dynamic_cast14.pass.cpp?rev=262717&r1=262716&r2=262717&view=diff
==============================================================================
--- libcxxabi/trunk/test/dynamic_cast14.pass.cpp (original)
+++ libcxxabi/trunk/test/dynamic_cast14.pass.cpp Fri Mar  4 08:25:13 2016
@@ -213,20 +213,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == a3.getA3());
     assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
 
@@ -934,20 +934,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == 0);
     assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
 
@@ -1655,20 +1655,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == a3.getA3());
     assert(dynamic_cast<A3*>(a3.getA2()) == 0);
 




More information about the cfe-commits mailing list