OSDN Git Service

* where.h (struct _ffewhere_file_): Mark GTY.
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Aug 2002 02:20:43 +0000 (02:20 +0000)
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Aug 2002 02:20:43 +0000 (02:20 +0000)
(ffewhere_file_kill): Remove prototype.
* where.c: Include ggc.h.
(struct _ffewhere_ll_, struct _ffewhere_root_ll_): Mark GTY.
(ffewhere_root_ll_): Ditto.  Change type from struct
_ffewhere_root_ll_ to struct _ffewhere_root_ll_*.  All uses
changed.
(ffewhere_file_kill): Remove.
(ffewhere_file_new): Use GC to allocate ffewhereFile objects.
(ffewhere_file_set): Use GC to allocate ffewhereLL_ objects.
(ffewhere_init_1): Use GC to allocate ffewhere_root_ll_ sentinel.
Include gt-f-where.h.
* lex.c (ffelex_current_wf_, ffelex_include_wherefile_): Mark GTY.
Include gt-f-lex.h.
* std.c (ffestd_S3P4): Don't call ffewhere_file_kill.
* config-lang.in (gtfiles): Add f/where.h f/where.c and f/lex.c.
* Make-lang.in (gt-f-lex.h gt-f-where.h): Add to dependents of
s-gtype.
(f/lex.o): Depend on gt-f-lex.h.
(f/where.o): Depend on gt-f-where.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56502 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/f/ChangeLog
gcc/f/Make-lang.in
gcc/f/config-lang.in
gcc/f/lex.c
gcc/f/std.c
gcc/f/where.c
gcc/f/where.h

index 1f260b1..e96f197 100644 (file)
@@ -1,3 +1,26 @@
+2002-08-22  Hans-Peter Nilsson  <hp@bitrange.com>
+
+       * where.h (struct _ffewhere_file_): Mark GTY.
+       (ffewhere_file_kill): Remove prototype.
+       * where.c: Include ggc.h.
+       (struct _ffewhere_ll_, struct _ffewhere_root_ll_): Mark GTY.
+       (ffewhere_root_ll_): Ditto.  Change type from struct
+       _ffewhere_root_ll_ to struct _ffewhere_root_ll_*.  All uses
+       changed.
+       (ffewhere_file_kill): Remove.
+       (ffewhere_file_new): Use GC to allocate ffewhereFile objects.
+       (ffewhere_file_set): Use GC to allocate ffewhereLL_ objects.
+       (ffewhere_init_1): Use GC to allocate ffewhere_root_ll_ sentinel.
+       Include gt-f-where.h.
+       * lex.c (ffelex_current_wf_, ffelex_include_wherefile_): Mark GTY.
+       Include gt-f-lex.h.
+       * std.c (ffestd_S3P4): Don't call ffewhere_file_kill.
+       * config-lang.in (gtfiles): Add f/where.h f/where.c and f/lex.c.
+       * Make-lang.in (gt-f-lex.h gt-f-where.h): Add to dependents of
+       s-gtype.
+       (f/lex.o): Depend on gt-f-lex.h.
+       (f/where.o): Depend on gt-f-where.h.
+
 Tue Aug 20 16:49:40 2002  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * where.c (ffewhere_track): Remove impossible if-then clause.
index 3e51d29..95ec02c 100644 (file)
@@ -137,7 +137,7 @@ f/fini.o:
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
              -c $(srcdir)/f/fini.c $(OUTPUT_OPTION)
 
-gt-f-com.h gt-f-ste.h gtype-f.h : s-gtype; @true
+gt-f-lex.h gt-f-where.h gt-f-com.h gt-f-ste.h gtype-f.h : s-gtype; @true
 
 #\f
 # Build hooks:
@@ -414,7 +414,7 @@ f/lex.o: f/lex.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/top.h f/malloc.h f/where.h \
  f/bld-op.def f/bit.h f/info.h f/info-b.def f/info-k.def f/info-w.def \
  f/target.h f/lex.h f/type.h f/intrin.h f/intrin.def f/lab.h f/symbol.h \
  f/symbol.def f/equiv.h f/storag.h f/global.h f/name.h f/src.h flags.h \
- debug.h input.h toplev.h output.h $(GGC_H)
+ debug.h input.h toplev.h output.h $(GGC_H) gt-f-lex.h
 f/malloc.o: f/malloc.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/malloc.h
 f/name.o: f/name.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/bad.h f/bad.def f/where.h \
  glimits.h f/top.h f/malloc.h f/name.h f/global.h f/info.h f/info-b.def \
@@ -529,4 +529,4 @@ f/top.o: f/top.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/top.h f/malloc.h f/where.h \
 f/type.o: f/type.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/type.h f/malloc.h
 f/version.o: f/version.c f/version.h
 f/where.o: f/where.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/where.h glimits.h f/top.h \
- f/malloc.h f/lex.h $(GGC_H)
+ f/malloc.h f/lex.h $(GGC_H) gt-f-where.h
index 2c5bd2d..92ba5cc 100644 (file)
@@ -1,5 +1,5 @@
 # Top level configure fragment for GNU FORTRAN.
-#   Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+#   Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 #This file is part of GNU Fortran.
 
@@ -33,4 +33,4 @@ stagestuff="g77\$(exeext) g77-cross\$(exeext) f771\$(exeext)"
 
 target_libs=target-libf2c
 
-gtfiles="\$(srcdir)/f/com.c \$(srcdir)/f/com.h \$(srcdir)/f/ste.c"
+gtfiles="\$(srcdir)/f/com.c \$(srcdir)/f/com.h \$(srcdir)/f/ste.c \$(srcdir)/f/where.h \$(srcdir)/f/where.c \$(srcdir)/f/lex.c"
index b3e57ba..6d065dd 100644 (file)
@@ -93,7 +93,7 @@ static ffelexType ffelex_first_char_[256];
 
 /* The wf argument of the most recent active ffelex_file_(fixed,free)
    function.  */
-static ffewhereFile ffelex_current_wf_;
+static GTY (()) ffewhereFile ffelex_current_wf_;
 
 /* TRUE if an INCLUDE statement can be processed (ffelex_set_include
    can be called).  */
@@ -106,7 +106,7 @@ static bool ffelex_set_include_;
 /* Information on the pending INCLUDE file.  */
 static FILE *ffelex_include_file_;
 static bool ffelex_include_free_form_;
-static ffewhereFile ffelex_include_wherefile_;
+static GTY(()) ffewhereFile ffelex_include_wherefile_;
 
 /* Current master line count.  */
 static ffewhereLineNumber ffelex_linecount_current_;
@@ -4634,3 +4634,5 @@ ffelex_token_use (ffelexToken t)
   t->uses++;
   return t;
 }
+
+#include "gt-f-lex.h"
index db8c723..bd2add2 100644 (file)
@@ -1,5 +1,5 @@
 /* std.c -- Implementation File (module.c template V1.0)
-   Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2000, 2002 Free Software Foundation, Inc.
    Contributed by James Craig Burley.
 
 This file is part of GNU Fortran.
@@ -4774,9 +4774,7 @@ ffestd_S3P4 (ffebld filename)
       fi = ffecom_open_include (ffewhere_file_name (wf),
                                ffelex_token_where_line (ffesta_tokens[0]),
                                ffelex_token_where_column (ffesta_tokens[0]));
-      if (fi == NULL)
-       ffewhere_file_kill (wf);
-      else
+      if (fi != NULL)
        ffelex_set_include (wf, (ffelex_token_type (ffesta_tokens[0])
                                 == FFELEX_typeNAME), fi);
     }
index db350e9..b16f965 100644 (file)
@@ -1,5 +1,5 @@
 /* where.c -- Implementation File (module.c template V1.0)
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2002 Free Software Foundation, Inc.
    Contributed by James Craig Burley.
 
 This file is part of GNU Fortran.
@@ -33,6 +33,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "where.h"
 #include "lex.h"
 #include "malloc.h"
+#include "ggc.h"
 
 /* Externals defined here. */
 
@@ -52,7 +53,7 @@ typedef struct _ffewhere_ll_ *ffewhereLL_;
 
 /* Internal structure definitions. */
 
-struct _ffewhere_ll_
+struct _ffewhere_ll_ GTY (())
   {
     ffewhereLL_ next;
     ffewhereLL_ previous;
@@ -61,7 +62,7 @@ struct _ffewhere_ll_
     ffewhereLineNumber offset; /* User-desired offset (usually 1). */
   };
 
-struct _ffewhere_root_ll_
+struct _ffewhere_root_ll_ GTY (())
   {
     ffewhereLL_ first;
     ffewhereLL_ last;
@@ -76,7 +77,7 @@ struct _ffewhere_root_line_
 
 /* Static objects accessed by functions in this module. */
 
-static struct _ffewhere_root_ll_ ffewhere_root_ll_;
+static GTY (()) struct _ffewhere_root_ll_ *ffewhere_root_ll_;
 static struct _ffewhere_root_line_ ffewhere_root_line_;
 
 /* Static functions (internal). */
@@ -94,10 +95,10 @@ ffewhere_ll_lookup_ (ffewhereLineNumber ln)
   ffewhereLL_ ll;
 
   if (ln == 0)
-    return ffewhere_root_ll_.first;
+    return ffewhere_root_ll_->first;
 
-  for (ll = ffewhere_root_ll_.last;
-       ll != (ffewhereLL_) &ffewhere_root_ll_.first;
+  for (ll = ffewhere_root_ll_->last;
+       ll != (ffewhereLL_) &ffewhere_root_ll_->first;
        ll = ll->previous)
     {
       if (ll->line_no <= ln)
@@ -108,30 +109,13 @@ ffewhere_ll_lookup_ (ffewhereLineNumber ln)
   return NULL;
 }
 
-/* Kill file object.
-
-   Note that this object must not have been passed in a call
-   to any other ffewhere function except ffewhere_file_name and
-   ffewhere_file_namelen.  */
-
-void
-ffewhere_file_kill (ffewhereFile wf)
-{
-  malloc_kill_ks (ffe_pool_file (), wf,
-                 offsetof (struct _ffewhere_file_, text)
-                 + wf->length + 1);
-}
-
 /* Create file object.  */
 
 ffewhereFile
 ffewhere_file_new (const char *name, size_t length)
 {
   ffewhereFile wf;
-
-  wf = malloc_new_ks (ffe_pool_file (), "ffewhereFile",
-                     offsetof (struct _ffewhere_file_, text)
-                     + length + 1);
+  wf = ggc_alloc (offsetof (struct _ffewhere_file_, text) + length + 1);
   wf->length = length;
   memcpy (&wf->text[0], name, length);
   wf->text[length] = '\0';
@@ -147,10 +131,9 @@ void
 ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln)
 {
   ffewhereLL_ ll;
-
-  ll = malloc_new_kp (ffe_pool_file (), "ffewhereLL_", sizeof (*ll));
-  ll->next = (ffewhereLL_) &ffewhere_root_ll_.first;
-  ll->previous = ffewhere_root_ll_.last;
+  ll = ggc_alloc (sizeof (*ll));
+  ll->next = (ffewhereLL_) &ffewhere_root_ll_->first;
+  ll->previous = ffewhere_root_ll_->last;
   ll->next->previous = ll;
   ll->previous->next = ll;
   if (wf == NULL)
@@ -184,8 +167,12 @@ ffewhere_init_1 ()
   = (ffewhereLine) &ffewhere_root_line_.first;
   ffewhere_root_line_.none = 0;
 
-  ffewhere_root_ll_.first = ffewhere_root_ll_.last
-    = (ffewhereLL_) &ffewhere_root_ll_.first;
+  /* The sentinel is (must be) GGC-allocated.  It is accessed as a
+     struct _ffewhere_ll_/ffewhereLL_ though its type contains just the
+     first two fields (layout-wise).  */
+  ffewhere_root_ll_ = ggc_alloc_cleared (sizeof (struct _ffewhere_ll_));
+  ffewhere_root_ll_->first = ffewhere_root_ll_->last
+    = (ffewhereLL_) &ffewhere_root_ll_->first;
 }
 
 /* Return the textual content of the line.  */
@@ -529,3 +516,5 @@ ffewhere_track_kill (ffewhereLine wrl, ffewhereColumn wrc UNUSED,
        }
     }
 }
+
+#include "gt-f-where.h"
index a0a6882..cce7b2a 100644 (file)
@@ -1,5 +1,5 @@
 /* where.h -- Public #include File (module.h template V1.0)
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2002 Free Software Foundation, Inc.
    Contributed by James Craig Burley.
 
 This file is part of GNU Fortran.
@@ -65,7 +65,7 @@ typedef unsigned int ffewhereUses_;
 
 /* Structure definitions. */
 
-struct _ffewhere_file_
+struct _ffewhere_file_ GTY (())
   {
     size_t length;
     char text[1];
@@ -87,7 +87,6 @@ extern struct _ffewhere_line_ ffewhere_unknown_line_;
 
 /* Declare functions with prototypes. */
 
-void ffewhere_file_kill (ffewhereFile wf);
 ffewhereFile ffewhere_file_new (const char *name, size_t length);
 void ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln);
 void ffewhere_init_1 (void);