*BSD News Article 12346


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!constellation!aardvark.ucs.uoknor.edu!ns1.nodak.edu!ogicse!flop.ENGR.ORST.EDU!gaia.ucs.orst.edu!umn.edu!math.fu-berlin.de!fauern!ira.uka.de!Germany.EU.net!tools!jk
Newsgroups: comp.os.386bsd.questions
Subject: Re: gcc - large arrays, out of vm - any way to avoid?
Message-ID: <JK.93Mar4211952@leo.tools.de>
From: jk@tools.de (Juergen Keil)
Date: 5 Mar 93 05:19:52 GMT
References: <9303022137.AA04169@pizzabox.demon.co.uk>
Organization: TooLs GmbH, Bonn, Germany
Article-I.D.: leo.JK.93Mar4211952
NNTP-Posting-Host: leo.tools.de
In-reply-to: gtoal@gtoal.com's message of Tue, 2 Mar 1993 21:37:15 +0000
Lines: 90

In article <9303022137.AA04169@pizzabox.demon.co.uk> gtoal@gtoal.com (Graham Toal) writes:

>   char prog[] = {
>	/* The 50915 elements of this array have been removed for brevity */
>   };

I'm using the following patch to reduce memory requirements somewhat.

*** c-typeck.c.orig	Wed Nov  4 17:51:56 1992
--- c-typeck.c	Thu Nov  5 13:54:41 1992
***************
*** 4947,4954 ****
  	 index value that will override it. */
  
        for (current_index = min_index; tail != 0 || end_index;
  	   current_index = fold (build (PLUS_EXPR, bound_type,
! 					current_index, one)))
  	{
  	  register tree next1 = 0;
  
--- 4947,4957 ----
  	 index value that will override it. */
  
        for (current_index = min_index; tail != 0 || end_index;
+ #if	0
  	   current_index = fold (build (PLUS_EXPR, bound_type,
! 					current_index, one))
! #endif
! 	   )
  	{
  	  register tree next1 = 0;
  
***************
*** 5081,5086 ****
--- 5084,5126 ----
  	  else if (initializer_constant_valid_p (next1, TREE_TYPE (next1)) == 0)
  	    allsimple = 0;
  
+ #if	1
+ 	  {
+ 	    int insert_at_end = 0;
+ 
+ 	    /* Now store NEXT1 in the list, I elements from the *end*.
+ 	       Make the list longer if necessary.  */
+ 	    while (! tree_int_cst_lt (current_index, members_index))
+ 	      {
+ 	        members = tree_cons (NULL_TREE, NULL_TREE, members);
+ 		members_index = fold (build (PLUS_EXPR, bound_type,
+ 					     members_index, one));
+ 		insert_at_end = 1;
+ 	      }
+ 
+ 	    if (insert_at_end)
+ 	      {
+ 		TREE_VALUE (members) = next1;
+ 		current_index = members_index;
+ 	      }
+ 	    else
+ 	      {
+ 	        tree temp;
+ 		tree idx;
+ 
+ 		temp = members;
+ 		for (idx = fold (build (MINUS_EXPR, bound_type,
+ 					members_index, one));
+ 		     tree_int_cst_lt (current_index, idx);
+ 		     idx = fold (build (MINUS_EXPR, bound_type, idx, one)))
+ 		  temp = TREE_CHAIN (temp);
+ 		TREE_VALUE (temp) = next1;
+ 
+ 		current_index = fold (build (PLUS_EXPR, bound_type,
+ 					     current_index, one));
+ 	      }
+           }
+ #else
  	  /* Now store NEXT1 in the list, I elements from the *end*.
  	     Make the list longer if necessary.  */
  	  while (! tree_int_cst_lt (current_index, members_index))
***************
*** 5102,5107 ****
--- 5142,5148 ----
  	      temp = TREE_CHAIN (temp);
  	    TREE_VALUE (temp) = next1;
  	  }
+ #endif
  	}
      }
    if (TREE_CODE (type) == RECORD_TYPE)
--
Juergen Keil          jk@tools.de ...!{uunet,mcsun}!unido!tools!jk