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:
omp_declare_variant_entry::score
omp_declare_variant_entry::score_in_declare_simd_clone
nb_iter_bound::member
loop::nb_iterations_upper_bound
loop::nb_iterations_likely_upper_bound
loop::nb_iterations_estimate
ipa_bits::value
ipa_bits::mask
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
--- gcc/wide-int.h.jj   2023-09-29 09:59:58.703931879 +0200
+++ gcc/wide-int.h      2023-09-29 10:05:27.653317149 +0200
@@ -4103,23 +4103,12 @@ gt_pch_nx (generic_wide_int <fixed_wide_
 }
 
 template<int N>
-void
-gt_ggc_mx (generic_wide_int <widest_int_storage <N> > *)
-{
-}
-
+void gt_ggc_mx (generic_wide_int <widest_int_storage <N> > *) = delete;
 template<int N>
-void
-gt_pch_nx (generic_wide_int <widest_int_storage <N> > *)
-{
-}
-
+void gt_pch_nx (generic_wide_int <widest_int_storage <N> > *) = delete;
 template<int N>
-void
-gt_pch_nx (generic_wide_int <widest_int_storage <N> > *,
-          gt_pointer_operator, void *)
-{
-}
+void gt_pch_nx (generic_wide_int <widest_int_storage <N> > *,
+               gt_pointer_operator, void *) = delete;
 
 template<int N>
 void

Reply via email to