C++ PATCH: Throttle inlining

Mark Mitchell mark@codesourcery.com
Tue Apr 3 16:37:00 GMT 2001


My inlining-throttling patch also avoided some unncessary deferrals of
the emission of inline functions in order to conserve memory.
Unfortunately, as Gerald found out, we sometimes emitted inlines as
strong symbols yielding linkage conflicts.

This patch fixes that.

Bootstrapped and tested on i686-pc-linux-gnu, installed on the
mainline and the branch.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-04-03  Mark Mitchell  <mark@codesourcery.com>

	* decl2.c (import_export_decl): Don't call import_export_class 
	when processing an inline member function.
	* semantics.c (expand_body): Call import_export_decl before
	emitting inline functions.

Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.437.2.9
diff -c -p -r1.437.2.9 decl2.c
*** decl2.c	2001/03/20 22:03:44	1.437.2.9
--- decl2.c	2001/04/03 23:28:45
*************** import_export_decl (decl)
*** 2673,2693 ****
      }
    else if (DECL_FUNCTION_MEMBER_P (decl))
      {
!       tree ctype = DECL_CONTEXT (decl);
!       import_export_class (ctype);
!       if (CLASSTYPE_INTERFACE_KNOWN (ctype)
! 	  && ! DECL_THIS_INLINE (decl))
  	{
! 	  DECL_NOT_REALLY_EXTERN (decl)
! 	    = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
! 		 || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
! 		     && !DECL_VINDEX (decl)));
  
! 	  /* Always make artificials weak.  */
! 	  if (DECL_ARTIFICIAL (decl) && flag_weak)
! 	    comdat_linkage (decl);
! 	  else
! 	    maybe_make_one_only (decl);
  	}
        else
  	comdat_linkage (decl);
--- 2673,2695 ----
      }
    else if (DECL_FUNCTION_MEMBER_P (decl))
      {
!       if (!DECL_THIS_INLINE (decl))
  	{
! 	  tree ctype = DECL_CONTEXT (decl);
! 	  import_export_class (ctype);
! 	  if (CLASSTYPE_INTERFACE_KNOWN (ctype))
! 	    {
! 	      DECL_NOT_REALLY_EXTERN (decl)
! 		= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
! 		     || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
! 			 && !DECL_VINDEX (decl)));
  
! 	      /* Always make artificials weak.  */
! 	      if (DECL_ARTIFICIAL (decl) && flag_weak)
! 		comdat_linkage (decl);
! 	      else
! 		maybe_make_one_only (decl);
! 	    }
  	}
        else
  	comdat_linkage (decl);
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.189.2.3
diff -c -p -r1.189.2.3 semantics.c
*** semantics.c	2001/03/27 04:41:18	1.189.2.3
--- semantics.c	2001/04/03 23:28:45
*************** expand_body (fn)
*** 2388,2393 ****
--- 2388,2398 ----
        return;
      }
  
+   /* Compute the appropriate object-file linkage for inline
+      functions.  */
+   if (DECL_INLINE (fn))
+     import_export_decl (fn);
+ 
    /* Emit any thunks that should be emitted at the same time as FN.  */
    emit_associated_thunks (fn);
  



More information about the Gcc-patches mailing list