This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Mainline merge part 14 - profiler improvements
Uff, I didn't noticed there is review on the patch (for some purpose it is not
in my inbox). I broke the patch already, so I will update the bits and send
anotehr version shortly.
> > > + /* 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.
I would not feel confortable to have bits of code no one knows the purpose,
pelase try to take a look at it.
>
> > > + UNLOCK_ARC_COUNTERS;
> > > + }
> > > +
> > > + #endif
> > > +
> > > + #ifdef __GTHREADS
> > > + if (arc_counters)
> > > + {
> > > + LOCK_ARC_COUNTERS;
> >
> > Unlock followed immediately by lock?
>
> Stupid, of course. I will fix it.
Looks like my merger error, sorry.
>
> > > ! __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).
I guess just abort the program with error message is sane.
Honza
>
> >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