diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-17 10:47:02 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-17 21:00:10 +0200 |
commit | 0edf2e81bb02cba43b649b3f6e7258b68a779ac0 (patch) | |
tree | 5b18e566cc8b9c254b6e1ef74f90575fe49cca0a /gcc/ggc-tests.c | |
parent | a42467bdb70650cd2f421e67b6c3418f74feaec2 (diff) | |
download | gcc-0edf2e81bb02cba43b649b3f6e7258b68a779ac0.zip gcc-0edf2e81bb02cba43b649b3f6e7258b68a779ac0.tar.gz gcc-0edf2e81bb02cba43b649b3f6e7258b68a779ac0.tar.bz2 |
Turn global 'ggc_force_collect' variable into 'force_collect' parameter to 'ggc_collect'
This simplifies the interface and gets us rid of a global variable.
No change in behavior.
Clean-up for 2004-09-02 CVS commit (Subversion r86974,
Git commit 0772402279c0161fe41784911b52c77e12803c42)
"Better memory statistics, take 2".
gcc/
* ggc.h (ggc_collect): Add 'force_collect' parameter.
* ggc-page.c (ggc_collect): Use that one instead of global
'ggc_force_collect'. Adjust all users.
* doc/gty.texi (Invoking the garbage collector): Update.
* ggc-internal.h (ggc_force_collect): Remove.
* ggc-common.c (ggc_force_collect): Likewise.
* selftest.h (forcibly_ggc_collect): Remove.
* ggc-tests.c (selftest::forcibly_ggc_collect): Likewise.
* read-rtl-function.c (test_loading_labels): Adjust.
* selftest-run-tests.c (run_tests): Likewise.
Diffstat (limited to 'gcc/ggc-tests.c')
-rw-r--r-- | gcc/ggc-tests.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c index 4ee9550..2891c20 100644 --- a/gcc/ggc-tests.c +++ b/gcc/ggc-tests.c @@ -22,21 +22,10 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree-core.h" #include "tree.h" -#include "ggc-internal.h" /* (for ggc_force_collect). */ #include "selftest.h" #if CHECKING_P -/* A helper function for writing ggc tests. */ - -void -selftest::forcibly_ggc_collect () -{ - ggc_force_collect = true; - ggc_collect (); - ggc_force_collect = false; -} - /* The various GTY markers must be outside of a namespace to be seen by gengtype, so we don't put this file within the selftest namespace. */ @@ -58,7 +47,7 @@ test_basic_struct () root_test_struct = ggc_cleared_alloc <test_struct> (); root_test_struct->other = ggc_cleared_alloc <test_struct> (); - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_TRUE (ggc_marked_p (root_test_struct)); ASSERT_TRUE (ggc_marked_p (root_test_struct->other)); @@ -88,7 +77,7 @@ test_length () for (int i = 0; i < count; i++) root_test_of_length->elem[i] = ggc_cleared_alloc <test_of_length> (); - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_TRUE (ggc_marked_p (root_test_of_length)); for (int i = 0; i < count; i++) @@ -162,7 +151,7 @@ test_union () test_struct *referenced_by_other = ggc_cleared_alloc <test_struct> (); other->m_ptr = referenced_by_other; - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_TRUE (ggc_marked_p (root_test_of_union_1)); ASSERT_TRUE (ggc_marked_p (ts)); @@ -203,7 +192,7 @@ test_finalization () test_struct_with_dtor::dtor_call_count = 0; - selftest::forcibly_ggc_collect (); + ggc_collect (true); /* Verify that the destructor was run for each instance. */ ASSERT_EQ (count, test_struct_with_dtor::dtor_call_count); @@ -221,7 +210,7 @@ test_deletable_global () test_of_deletable = ggc_cleared_alloc <test_struct> (); ASSERT_TRUE (test_of_deletable != NULL); - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_EQ (NULL, test_of_deletable); } @@ -294,7 +283,7 @@ test_inheritance () test_some_subclass_as_base_ptr = new some_subclass (); test_some_other_subclass_as_base_ptr = new some_other_subclass (); - selftest::forcibly_ggc_collect (); + ggc_collect (true); /* Verify that the roots and everything referenced by them got marked (both for fields in the base class and those in subclasses). */ @@ -373,7 +362,7 @@ test_chain_next () tail_node = new_node; } - selftest::forcibly_ggc_collect (); + ggc_collect (true); /* If we got here, we survived. */ @@ -440,7 +429,7 @@ test_user_struct () num_calls_to_user_gt_ggc_mx = 0; - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_TRUE (ggc_marked_p (root_user_struct_ptr)); ASSERT_TRUE (ggc_marked_p (referenced)); @@ -458,7 +447,7 @@ test_tree_marking () { dummy_unittesting_tree = build_int_cst (integer_type_node, 1066); - selftest::forcibly_ggc_collect (); + ggc_collect (true); ASSERT_TRUE (ggc_marked_p (dummy_unittesting_tree)); } |