static void test_length () { const int count = 5; size_t sz = sizeof (test_of_length) + (count- 1) * sizeof (test_of_length *); root_test_of_length = (test_of_length *)ggc_internal_cleared_alloc (sz); root_test_of_length->num_elem = count; for (int i = 0; i < count; i++) root_test_of_length->elem[i] = ggc_cleared_alloc <test_of_length> (); selftest::forcibly_ggc_collect (); ASSERT_TRUE (ggc_marked_p (root_test_of_length)); for (int i = 0; i < count; i++) ASSERT_TRUE (ggc_marked_p (root_test_of_length->elem[i])); }
struct target_globals * save_target_globals (void) { struct target_globals *g; struct target_globals_extra { struct target_globals g; struct target_flag_state flag_state; struct target_optabs optabs; struct target_cfgloop cfgloop; struct target_builtins builtins; struct target_gcse gcse; struct target_bb_reorder bb_reorder; struct target_lower_subreg lower_subreg; } *p; p = (struct target_globals_extra *) ggc_internal_cleared_alloc (sizeof (struct target_globals_extra)); g = (struct target_globals *) p; g->flag_state = &p->flag_state; g->regs = ggc_internal_cleared_alloc (sizeof (struct target_regs)); g->rtl = ggc_cleared_alloc<target_rtl> (); g->recog = ggc_internal_cleared_alloc (sizeof (struct target_recog)); g->hard_regs = ggc_internal_cleared_alloc (sizeof (struct target_hard_regs)); g->reload = ggc_internal_cleared_alloc (sizeof (struct target_reload)); g->expmed = ggc_internal_cleared_alloc (sizeof (struct target_expmed)); g->optabs = &p->optabs; g->libfuncs = ggc_cleared_alloc<target_libfuncs> (); g->cfgloop = &p->cfgloop; g->ira = ggc_internal_cleared_alloc (sizeof (struct target_ira)); g->ira_int = ggc_internal_cleared_alloc (sizeof (struct target_ira_int)); g->builtins = &p->builtins; g->gcse = &p->gcse; g->bb_reorder = &p->bb_reorder; g->lower_subreg = &p->lower_subreg; restore_target_globals (g); init_reg_sets (); target_reinit (); return g; }