On Fri, 29 Sep 2023, Jakub Jelinek wrote:

> On Thu, Sep 28, 2023 at 04:03:55PM +0200, Jakub Jelinek wrote:
> > Bet we should make wide_int_storage and widest_int_storage GTY ((user)) and
> > just declare but don't define the handlers or something similar.
> 
> That doesn't catch anything, but the following incremental patch compiles
> just fine, proving we don't have any wide_int in GC memory anymore after
> the wide_int -> rwide_int change in dwarf2out.h.
> And the attached incremental patch on top of it which deletes even
> widest_int from GC shows that we use widest_int in GC in:
[..]

> nb_iter_bound::member
> loop::nb_iterations_upper_bound
> loop::nb_iterations_likely_upper_bound
> loop::nb_iterations_estimate

I think those should better be bound to max-fixed-mode, they were
HWI at some point (even that should be OK, but of course
non-likely upper_bound needs to be conservative).  Using
widest_int here, esp. non-x86 is quite wasting.  The functions
setting these need to be careful with overflows then.

> so pretty much everything I spoke about (except I thought loop has
> 2 such members when it has 3).
> 
> --- gcc/wide-int.h    2023-09-28 14:55:40.059632413 +0200
> +++ gcc/wide-int.h    2023-09-29 09:59:58.703931879 +0200
> @@ -85,7 +85,7 @@
>       and it always uses an inline buffer.  offset_int and rwide_int are
>       GC-friendly, wide_int and widest_int are not.
>  
> -     3) widest_int.  This representation is an approximation of
> +     4) widest_int.  This representation is an approximation of
>       infinite precision math.  However, it is not really infinite
>       precision math as in the GMP library.  It is really finite
>       precision math where the precision is WIDEST_INT_MAX_PRECISION.
> @@ -4063,21 +4063,61 @@
>    return wi::smod_trunc (x, y);
>  }
>  
> -template<typename T>
> +void gt_ggc_mx (generic_wide_int <wide_int_storage> *) = delete;
> +void gt_pch_nx (generic_wide_int <wide_int_storage> *) = delete;
> +void gt_pch_nx (generic_wide_int <wide_int_storage> *,
> +             gt_pointer_operator, void *) = delete;
> +
> +inline void
> +gt_ggc_mx (generic_wide_int <rwide_int_storage> *)
> +{
> +}
> +
> +inline void
> +gt_pch_nx (generic_wide_int <rwide_int_storage> *)
> +{
> +}
> +
> +inline void
> +gt_pch_nx (generic_wide_int <rwide_int_storage> *, gt_pointer_operator, void 
> *)
> +{
> +}
> +
> +template<int N>
> +void
> +gt_ggc_mx (generic_wide_int <fixed_wide_int_storage <N> > *)
> +{
> +}
> +
> +template<int N>
> +void
> +gt_pch_nx (generic_wide_int <fixed_wide_int_storage <N> > *)
> +{
> +}
> +
> +template<int N>
> +void
> +gt_pch_nx (generic_wide_int <fixed_wide_int_storage <N> > *,
> +        gt_pointer_operator, void *)
> +{
> +}
> +
> +template<int N>
>  void
> -gt_ggc_mx (generic_wide_int <T> *)
> +gt_ggc_mx (generic_wide_int <widest_int_storage <N> > *)
>  {
>  }
>  
> -template<typename T>
> +template<int N>
>  void
> -gt_pch_nx (generic_wide_int <T> *)
> +gt_pch_nx (generic_wide_int <widest_int_storage <N> > *)
>  {
>  }
>  
> -template<typename T>
> +template<int N>
>  void
> -gt_pch_nx (generic_wide_int <T> *, gt_pointer_operator, void *)
> +gt_pch_nx (generic_wide_int <widest_int_storage <N> > *,
> +        gt_pointer_operator, void *)
>  {
>  }
>  
> 
> 
>       Jakub
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to