This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mainline merge part 14 - profiler improvements


> > !       field_decl =
> > ! 	build_decl (FIELD_DECL, get_identifier ("ncounts"),
> > ! 		    long_integer_type_node);
> > !       value_chain = tree_cons (field_decl,
> > ! 			       build_int_2 (profile_info.
> > ! 					    count_instrumented_edges, 0),
> 
> Need convert(long_integer_type_node, (build_int_2 (...))).
> Most other occurrences of build_int_2 need to be examined
> as well.
> 
> > ! 	domain = make_node (INTEGER_TYPE);
> > ! 	TYPE_MIN_VALUE (domain) = integer_zero_node;
> > ! 	/* Note that the array contains a terminator, hence no - 1.  */
> > ! 	TYPE_MAX_VALUE (domain) = build_int_2 (num_nodes, 0);
> 
Hello.

> > + DECLARE_ARC_COUNTERS_TSD;
> > + 
> > + #endif
> 
> else?

Else we are not compiled with thread support -- so there is nothing to do
and we use the old code.

> > +       /* propagate counters of main thread to global ones.  */
> > +       __bb_thread_end_func (GET_ARC_COUNTERS_TSD);
> > + 
> > +       /* If we are here for the first time (could be more times due
> > +          to forking), move results from static counters.  */
> > +       LOCK_ARC_COUNTERS;
> 
> What, exactly, are you locking here?  AFAICT, __bb_thread_end_func
> is synchronous with this function.

Maybe, I'm not so sure about it. We probably won't spoil anything by leaving
lock here.

> > +       UNLOCK_ARC_COUNTERS;
> > +     }
> > + 
> > + #endif
> > + 
> > + #ifdef __GTHREADS
> > +   if (arc_counters)
> > +     {
> > +       LOCK_ARC_COUNTERS;
> 
> Unlock followed immediately by lock?

Stupid, of course. I will fix it.

> > ! __bb_thread_start_func (void)
> > ! {
> > !   gcov_type *ret;
> > ! 
> > !   if (arc_counters && __gthreads_active)
> > !     {
> > !       ret = calloc (aofs, sizeof (gcov_type));
> > !       SET_ARC_COUNTERS_TSD (ret);
> 
> Failure mode when (1) calloc fails,

I will think of what to do with this (I don't see completely correct solution
just now).

>or (2) thread key not available?

I should test it __bb_init_func. I will fix it (but anyway, I'm probably the
first one to ask for a key; so I really should obtain one :-)

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]