public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Patch for memory blowup
@ 1997-12-12 17:52 Peter Schmid
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Schmid @ 1997-12-12 17:52 UTC (permalink / raw)
  To: egcs

The patch fixes my -O -Wall related problems!
The program quoted in  "egcs-bugs/1997-Nov/0235.html" compiles 
with -O -Wall without a memory leak. 
Thanks for fixing this problem.

Peter Schmid


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for memory blowup
  1997-12-11 22:59 ` Mark Mitchell
@ 1997-12-15 10:37   ` Jeffrey A Law
  0 siblings, 0 replies; 8+ messages in thread
From: Jeffrey A Law @ 1997-12-15 10:37 UTC (permalink / raw)
  To: mmitchell; +Cc: egcs, Jason Merrill, Fred Richardson

  In message < 199712112301.XAA00683@quickstep.stanford.edu >you write:
  > 
  > I'm getting forgetful about ChangeLog entries.  I apologize.  Here's
  > an entry for the patch in the email whose subject line matches this one.
  > 
  > 1997-12-11  Mark Mitchell  <mmitchell@usa.net>
  > 
  > 	    * toplev.c (rest_of_compilation): Don't call save_for_inline_copy
  > 	      if all we're doing is dealing with -Wreturn-type.
Thanks.  I installed this patch.

jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for memory blowup
  1997-12-12  7:40 ` Bruce Korb
  1997-12-12  7:49   ` Jeffrey A Law
@ 1997-12-12 10:18   ` Mark Mitchell
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Mitchell @ 1997-12-12 10:18 UTC (permalink / raw)
  To: egcs

>>>>> "Bruce" == Bruce Korb <korbb@datadesign.com> writes:

    Bruce> Mark Mitchell wrote: ....
    >> The diffs below look longer than they are due to an indentation
    >> change that happened when a set of curly braces went away.
    >> Fred's program:
    Bruce> ....
    >> Index: gcc/toplev.c
    >> ===================================================================
    >> RCS file: /home/mitchell/Repository/egcs/gcc/toplev.c,v
    >> retrieving revision 1.1.1.4 diff -c -p -r1.1.1.4 toplev.c ***
    >> toplev.c 1997/12/08 07:30:40 1.1.1.4 --- toplev.c 1997/12/12
    >> 00:09:17

    Bruce> Try using:

    Bruce>   diff -cwb -p -r1.1.1.4 toplev.c

The problem with that is that when Jeff applies the patch his code
will be indented wrongly.

    Bruce> -- Bruce Korb | Data Design Systems, Inc.  Korbb at
    Bruce> DataDesign dot com | 45 Cabot Dr., Suite 110 Voice:
    Bruce> 408-260-0280 | Santa Clara, CA 95051 Fax: 408-260-0281 |
    Bruce> USA

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for memory blowup
  1997-12-12  7:40 ` Bruce Korb
@ 1997-12-12  7:49   ` Jeffrey A Law
  1997-12-12 10:18   ` Mark Mitchell
  1 sibling, 0 replies; 8+ messages in thread
From: Jeffrey A Law @ 1997-12-12  7:49 UTC (permalink / raw)
  To: korbb; +Cc: egcs

  In message < 34915A5D.4B28@datadesign.com >you write:
  > Try using:
  > 
  >   diff -cwb -p -r1.1.1.4 toplev.c
Nobody should submit patches for installation with these options;
in particular the "-b" option will lose the indention.  "-b" may
be suitable for "here's something to play with", but it is not
suitable for something to be installed.

Jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for memory blowup
  1997-12-11 17:11 Mark Mitchell
  1997-12-11 22:59 ` Mark Mitchell
  1997-12-11 23:55 ` Tudor Hulubei
@ 1997-12-12  7:40 ` Bruce Korb
  1997-12-12  7:49   ` Jeffrey A Law
  1997-12-12 10:18   ` Mark Mitchell
  2 siblings, 2 replies; 8+ messages in thread
From: Bruce Korb @ 1997-12-12  7:40 UTC (permalink / raw)
  To: egcs

Mark Mitchell wrote:
...
> The diffs below look longer than they are due to an indentation change
> that happened when a set of curly braces went away.  Fred's program:
...
> Index: gcc/toplev.c
> ===================================================================
> RCS file: /home/mitchell/Repository/egcs/gcc/toplev.c,v
> retrieving revision 1.1.1.4
> diff -c -p -r1.1.1.4 toplev.c
> *** toplev.c    1997/12/08 07:30:40     1.1.1.4
> --- toplev.c    1997/12/12 00:09:17

Try using:

  diff -cwb -p -r1.1.1.4 toplev.c

-- 
Bruce Korb                      | Data Design Systems, Inc.
Korbb at DataDesign dot com     | 45 Cabot Dr., Suite 110
Voice:  408-260-0280            | Santa Clara,  CA   95051
Fax:    408-260-0281            | USA

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for memory blowup
  1997-12-11 17:11 Mark Mitchell
  1997-12-11 22:59 ` Mark Mitchell
@ 1997-12-11 23:55 ` Tudor Hulubei
  1997-12-12  7:40 ` Bruce Korb
  2 siblings, 0 replies; 8+ messages in thread
From: Tudor Hulubei @ 1997-12-11 23:55 UTC (permalink / raw)
  To: egcs; +Cc: Jeffrey A. Law, Jason Merrill, Fred Richardson

Hi,

 > I believe I have a patch (attached) for the memory explosions that
 > occur when using g++ -O2 -Wall with lots of templates.  See for
 > example:

I applied the patch (by hand) to egcs-1.0 and indeed, it made a big
difference.  gcc previously required around 150-170Mb to compile it,
now we're down to 69Mb.  And the generated code works fine.  Thanks.

Tudor

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Patch for memory blowup
  1997-12-11 17:11 Mark Mitchell
@ 1997-12-11 22:59 ` Mark Mitchell
  1997-12-15 10:37   ` Jeffrey A Law
  1997-12-11 23:55 ` Tudor Hulubei
  1997-12-12  7:40 ` Bruce Korb
  2 siblings, 1 reply; 8+ messages in thread
From: Mark Mitchell @ 1997-12-11 22:59 UTC (permalink / raw)
  To: egcs; +Cc: Jeffrey A. Law, Jason Merrill, Fred Richardson

I'm getting forgetful about ChangeLog entries.  I apologize.  Here's
an entry for the patch in the email whose subject line matches this one.

1997-12-11  Mark Mitchell  <mmitchell@usa.net>

	    * toplev.c (rest_of_compilation): Don't call save_for_inline_copy
	      if all we're doing is dealing with -Wreturn-type.

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Patch for memory blowup
@ 1997-12-11 17:11 Mark Mitchell
  1997-12-11 22:59 ` Mark Mitchell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mark Mitchell @ 1997-12-11 17:11 UTC (permalink / raw)
  To: Jeffrey A. Law, Jason Merrill, Fred Richardson; +Cc: egcs

I believe I have a patch (attached) for the memory explosions that
occur when using g++ -O2 -Wall with lots of templates.  See for
example:

  http://www.cygnus.com/ml/egcs/1997-Oct/0300.html

This is also mentioned in the FAQ.

The diffs below look longer than they are due to an indentation change
that happened when a set of curly braces went away.  Fred's program:

    #include <stdlib.h>
    #include <iostream.h>
    #include <algorithm>
    #include <vector.h>

    int main()
    {
        vector<int>             int_vec(size_t(5), int(1));
        vector<vector<int> >    int_vec_vec(size_t(7), int_vec);
        vector<vector<vector<int> > > int_vec_vec_vec(size_t(9), int_vec_vec);

        cout << int_vec_vec_vec[3][3][3] << endl;
        cout << "wow" << endl;
    }

which used to use >200M now compiles as gently as without -Wall.  And,
the .s file generated (I checked -O3 -Wall, actually) is precisely the
same as without -Wall.

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu

Index: gcc/toplev.c
===================================================================
RCS file: /home/mitchell/Repository/egcs/gcc/toplev.c,v
retrieving revision 1.1.1.4
diff -c -p -r1.1.1.4 toplev.c
*** toplev.c	1997/12/08 07:30:40	1.1.1.4
--- toplev.c	1997/12/12 00:09:17
*************** rest_of_compilation (decl)
*** 3116,3150 ****
  	{
  	  DECL_DEFER_OUTPUT (decl) = 1;
  
! 	  /* If -Wreturn-type, we have to do a bit of compilation.  */
! 	  if (! warn_return_type)
  	    {
  #ifdef DWARF_DEBUGGING_INFO
! 	      /* Generate the DWARF info for the "abstract" instance
! 		 of a function which we may later generate inlined and/or
! 		 out-of-line instances of.  */
! 	      if (write_symbols == DWARF_DEBUG)
! 		{
! 		  set_decl_abstract_flags (decl, 1);
! 		  TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
! 		  set_decl_abstract_flags (decl, 0);
! 		}
  #endif
  #ifdef DWARF2_DEBUGGING_INFO
! 	      /* Generate the DWARF2 info for the "abstract" instance
! 		 of a function which we may later generate inlined and/or
! 		 out-of-line instances of.  */
! 	      if (write_symbols == DWARF2_DEBUG)
! 		{
! 		  set_decl_abstract_flags (decl, 1);
! 		  TIMEVAR (symout_time, dwarf2out_decl (decl));
! 		  set_decl_abstract_flags (decl, 0);
! 		}
! #endif
! 	      TIMEVAR (integration_time, save_for_inline_nocopy (decl));
! 	      RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlinable;
! 	      goto exit_rest_of_compilation;
  	    }
  	}
  
        /* If we have to compile the function now, save its rtl and subdecls
--- 3116,3163 ----
  	{
  	  DECL_DEFER_OUTPUT (decl) = 1;
  
! 	  /* If -Wreturn-type, we have to do a bit of compilation.
! 	     However, if we just fall through we will call
! 	     save_for_inline_copying() which results in excessive
! 	     memory use.  Instead, we just want to call
! 	     jump_optimize() to figure out whether or not we can fall
! 	     off the end of the function; we do the minimum amount of
! 	     work necessary to make that safe.  And, we set optimize
! 	     to zero to keep jump_optimize from working too hard.  */
! 	  if (warn_return_type)
  	    {
+ 	      int saved_optimize = optimize;
+ 	      optimize = 0;
+ 	      find_exception_handler_labels ();
+ 	      jump_optimize (get_insns(), 0, 0, 0);
+ 	      optimize = saved_optimize;
+ 	    }
+ 
  #ifdef DWARF_DEBUGGING_INFO
! 	  /* Generate the DWARF info for the "abstract" instance
! 	     of a function which we may later generate inlined and/or
! 	     out-of-line instances of.  */
! 	  if (write_symbols == DWARF_DEBUG)
! 	    {
! 	      set_decl_abstract_flags (decl, 1);
! 	      TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
! 	      set_decl_abstract_flags (decl, 0);
! 	    }
  #endif
  #ifdef DWARF2_DEBUGGING_INFO
! 	  /* Generate the DWARF2 info for the "abstract" instance
! 	     of a function which we may later generate inlined and/or
! 	     out-of-line instances of.  */
! 	  if (write_symbols == DWARF2_DEBUG)
! 	    {
! 	      set_decl_abstract_flags (decl, 1);
! 	      TIMEVAR (symout_time, dwarf2out_decl (decl));
! 	      set_decl_abstract_flags (decl, 0);
  	    }
+ #endif
+ 	  TIMEVAR (integration_time, save_for_inline_nocopy (decl));
+ 	  RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlinable;
+ 	  goto exit_rest_of_compilation;
  	}
  
        /* If we have to compile the function now, save its rtl and subdecls

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1997-12-15 10:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-12 17:52 Patch for memory blowup Peter Schmid
  -- strict thread matches above, loose matches on Subject: below --
1997-12-11 17:11 Mark Mitchell
1997-12-11 22:59 ` Mark Mitchell
1997-12-15 10:37   ` Jeffrey A Law
1997-12-11 23:55 ` Tudor Hulubei
1997-12-12  7:40 ` Bruce Korb
1997-12-12  7:49   ` Jeffrey A Law
1997-12-12 10:18   ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).