Mainline merge part 14 - profiler improvements

Richard Henderson rth@redhat.com
Tue May 7 10:31:00 GMT 2002


On Tue, May 07, 2002 at 03:11:49PM +0200, Jan Hubicka wrote:
>         /* Count of the # of instrumented arcs.  */
> !       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);

build_index_type.

> ! 	field_value = make_node (TREE_LIST);

build_tree_list.

> +         gen_rtx_MEM (SImode,
> +                      gen_rtx_SYMBOL_REF (Pmode, "__global_counters"));

"int" is not SImode.  It's TYPE_MODE (integer_type_node).

> +   /* Where is adress of arc counters placed to?  */
> +   rtx arc_counters_adress;

"address".

> + DECLARE_ARC_COUNTERS_TSD;
> + 
> + #endif

else?

> +       /* 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.

> +       UNLOCK_ARC_COUNTERS;
> +     }
> + 
> + #endif
> + 
> + #ifdef __GTHREADS
> +   if (arc_counters)
> +     {
> +       LOCK_ARC_COUNTERS;

Unlock followed immediately by lock?

> ! __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, or (2) thread key not available?

Let's break up this patch next time, so we can get parts of it in.


r~



More information about the Gcc-patches mailing list