This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
clean up some old obstack stuff
- From: Geoffrey Keating <geoffk at romulus dot sfbay dot redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Aug 2002 15:44:39 -0700
- Subject: clean up some old obstack stuff
This patch deletes permanent_obstack, and tidies a few other things.
Bootstrapped & tested on x86-linux; I also checked that cc1 built on
these targets: alpha-unicosmk c4x-elf frv-elf hppa1.1-hpux11 mips-elf
powerpc-ibm-aix4.3; and either it built or the failure didn't appear
to be due to this patch.
--
Geoff Keating <geoffk@redhat.com>
===File ~/patches/gcc-nopermanentobstack.patch==============
Index: ChangeLog
2002-08-04 Geoffrey Keating <geoffk@redhat.com>
* Makefile.in (sdbout.o): Doesn't need $(OBSTACK_H).
* collect2.h (permanent_obstack): Delete declaration.
* collect2.c (permanent_obstack): Delete definition.
(main): Don't initialise permanent_obstack. Use xstrdup instead.
* expr.c: Don't include obstack.h.
(permanent_obstack): Delete declaration.
* function.c: Don't include obstack.h.
(permanent_obstack): Delete declaration.
* integrate.c: Don't include obstack.h.
(function_maybepermanent_obstack): Delete declaration.
* print-tree.c (debug_tree): Use x*alloc not permalloc.
* sdbout.c (gen_fake_label): Use x*alloc not permalloc.
* tlink.c (pfgets): Use xstrdup not permanent_obstack.
* toplev.c (lang_independent_init): Rename init_obstacks to init_ttree.
* tree.h: Rename init_obstacks to init_ttree. Remove declarations
of permalloc, expralloc, perm_calloc.
* tree.c (permanent_obstack): Delete definition.
(init_ttree): Rename from init_obstacks.
(permalloc): Delete.
(perm_calloc): Delete.
(dump_tree_statistics): Don't print information about
permanent_obstack.
* varasm.c (assemble_start_function): Use xstrdup instead of
permalloc/strcpy.
(assemble_variable): Likewise.
* config/alpha/alpha.c (unicosmk_need_dex): Use xmalloc instead of
permalloc.
(unicosmk_add_extern): Likewise.
* config/c4x/c4x.c (c4x_external_ref): Likewise.
(c4x_global_label): Likewise.
* config/frv/frv.c (frv_encode_section_info): Likewise.
* config/i386/winnt.c (i386_pe_record_external_function): Likewise.
(i386_pe_record_exported_symbol): Likewise.
* config/mips/mips.c (mips_output_external): Likewise.
(mips_output_external_libcall): Likewise.
* config/pa/pa.c: (permanent_obstack): Delete declaration.
(output_call): Use ggc_strdup instead of allocating on
permanent_obstack.
* config/romp/romp.c: Include ggc.h.
(get_symref): Don't declare permanent_obstack, use ggc_strdup
intead of permanent_obstack.
* config/rs6000/aix31.h (ASM_OUTPUT_EXTERNAL): Use concat
instead of permalloc.
* config/rs6000/rs6000.c (rs6000_gen_section_name): Use xmalloc
instead of permalloc
* config/rs6000/xcoff.h (ASM_OUTPUT_EXTERNAL): Use concat
instead of permalloc.
* config/vax/vax.c (vms_check_external): Use xmalloc instead of
permalloc.
Index: cp/ChangeLog
2002-08-04 Geoffrey Keating <geoffk@redhat.com>
* cvt.c (ocp_convert): Delete obsolete code.
* parse.y (permanent_obstack): Delete declaration.
* pt.c (permanent_obstack): Delete declaration.
* repo.c (permanent_obstack): Delete declaration.
(open_repo_file): Use xmalloc instead of permanent_obstack.
(init_repo): Use xstrdup instead of permanent_obstack.
Index: java/ChangeLog
2002-08-04 Geoffrey Keating <geoffk@redhat.com>
* class.c: (permanent_obstack): Delete declaration.
* constants.c: (permanent_obstack): Delete declaration.
* except.c: (permanent_obstack): Delete declaration.
* expr.c: (permanent_obstack): Delete declaration.
* jcf-parse.c: (permanent_obstack): Delete declaration.
(saveable_obstack): Delete declaration.
* parse.h: (permanent_obstack): Delete declaration.
* typeck.c: (permanent_obstack): Delete declaration.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.923
diff -p -u -p -r1.923 Makefile.in
--- Makefile.in 2 Aug 2002 22:30:09 -0000 1.923
+++ Makefile.in 4 Aug 2002 22:41:48 -0000
@@ -1446,7 +1446,7 @@ dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM
debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H)
sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \
- insn-config.h $(OBSTACK_H) xcoffout.h c-pragma.h ggc.h \
+ insn-config.h xcoffout.h c-pragma.h ggc.h \
sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h gt-sdbout.h
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \
flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \
Index: collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.139
diff -p -u -p -r1.139 collect2.c
--- collect2.c 25 Jul 2002 18:57:31 -0000 1.139
+++ collect2.c 4 Aug 2002 22:41:48 -0000
@@ -231,7 +231,6 @@ static struct head exports; /* list of
static struct head frame_tables; /* list of frame unwind info tables */
struct obstack temporary_obstack;
-struct obstack permanent_obstack;
char * temporary_firstobj;
/* Holds the return value of pexecute. */
@@ -916,7 +915,6 @@ main (argc, argv)
#endif
obstack_begin (&temporary_obstack, 0);
- obstack_begin (&permanent_obstack, 0);
temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0);
current_demangling_style = auto_demangling;
@@ -1076,18 +1074,18 @@ main (argc, argv)
{
const char *q = extract_string (&p);
if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
- *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
+ *c_ptr++ = xstrdup (q);
if (strcmp (q, "-EL") == 0 || strcmp (q, "-EB") == 0)
- *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
+ *c_ptr++ = xstrdup (q);
if (strcmp (q, "-shared") == 0)
shared_obj = 1;
if (*q == '-' && q[1] == 'B')
{
- *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
+ *c_ptr++ = xstrdup (q);
if (q[2] == 0)
{
q = extract_string (&p);
- *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
+ *c_ptr++ = xstrdup (q);
}
}
}
Index: collect2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.h,v
retrieving revision 1.6
diff -p -u -p -r1.6 collect2.h
--- collect2.h 22 Aug 2001 14:34:47 -0000 1.6
+++ collect2.h 4 Aug 2002 22:41:48 -0000
@@ -36,7 +36,6 @@ extern int file_exists PARAMS ((const ch
extern const char *ldout;
extern const char *c_file_name;
extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
extern char *temporary_firstobj;
extern int vflag, debug;
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.475
diff -p -u -p -r1.475 expr.c
--- expr.c 3 Aug 2002 20:20:35 -0000 1.475
+++ expr.c 4 Aug 2002 22:41:49 -0000
@@ -25,7 +25,6 @@ Software Foundation, 59 Temple Place - S
#include "real.h"
#include "rtl.h"
#include "tree.h"
-#include "obstack.h"
#include "flags.h"
#include "regs.h"
#include "hard-reg-set.h"
@@ -117,8 +116,6 @@ struct store_by_pieces
PTR constfundata;
int reverse;
};
-
-extern struct obstack permanent_obstack;
static rtx enqueue_insn PARAMS ((rtx, rtx));
static unsigned HOST_WIDE_INT move_by_pieces_ninsns
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.378
diff -p -u -p -r1.378 function.c
--- function.c 26 Jul 2002 20:10:38 -0000 1.378
+++ function.c 4 Aug 2002 22:41:50 -0000
@@ -53,7 +53,6 @@ Software Foundation, 59 Temple Place - S
#include "recog.h"
#include "output.h"
#include "basic-block.h"
-#include "obstack.h"
#include "toplev.h"
#include "hashtab.h"
#include "ggc.h"
@@ -6421,8 +6420,6 @@ expand_main_function ()
#endif
}
-extern struct obstack permanent_obstack;
-
/* The PENDING_SIZES represent the sizes of variable-sized types.
Create RTL for the various sizes now (using temporary variables),
so that we can refer to the sizes from the RTL we are generating
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.201
diff -p -u -p -r1.201 integrate.c
--- integrate.c 1 Aug 2002 23:07:33 -0000 1.201
+++ integrate.c 4 Aug 2002 22:41:50 -0000
@@ -45,10 +45,6 @@ Software Foundation, 59 Temple Place - S
#include "target.h"
#include "langhooks.h"
-#include "obstack.h"
-
-extern struct obstack *function_maybepermanent_obstack;
-
/* Similar, but round to the next highest integer that meets the
alignment. */
#define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
Index: print-tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-tree.c,v
retrieving revision 1.59
diff -p -u -p -r1.59 print-tree.c
--- print-tree.c 28 May 2002 17:32:28 -0000 1.59
+++ print-tree.c 4 Aug 2002 22:41:50 -0000
@@ -48,8 +48,7 @@ void
debug_tree (node)
tree node;
{
- table = (struct bucket **) permalloc (HASH_SIZE * sizeof (struct bucket *));
- memset ((char *) table, 0, HASH_SIZE * sizeof (struct bucket *));
+ table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *));
print_node (stderr, "", node, 0);
table = 0;
fprintf (stderr, "\n");
@@ -213,7 +212,7 @@ print_node (file, prefix, node, indent)
}
/* Add this node to the table. */
- b = (struct bucket *) permalloc (sizeof (struct bucket));
+ b = (struct bucket *) xmalloc (sizeof (struct bucket));
b->node = node;
b->next = table[hash];
table[hash] = b;
Index: sdbout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sdbout.c,v
retrieving revision 1.69
diff -p -u -p -r1.69 sdbout.c
--- sdbout.c 4 Jun 2002 07:07:54 -0000 1.69
+++ sdbout.c 4 Aug 2002 22:41:50 -0000
@@ -361,8 +361,7 @@ gen_fake_label ()
char *labelstr;
SDB_GENERATE_FAKE (label, unnamed_struct_number);
unnamed_struct_number++;
- labelstr = (char *) permalloc (strlen (label) + 1);
- strcpy (labelstr, label);
+ labelstr = xstrdup (label);
return labelstr;
}
Index: tlink.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tlink.c,v
retrieving revision 1.43
diff -p -u -p -r1.43 tlink.c
--- tlink.c 23 Jul 2002 06:21:56 -0000 1.43
+++ tlink.c 4 Aug 2002 22:41:50 -0000
@@ -334,7 +334,7 @@ static char *
pfgets (stream)
FILE *stream;
{
- return obstack_fgets (stream, &permanent_obstack);
+ return xstrdup (tfgets (stream));
}
/* Real tlink code. */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.666
diff -p -u -p -r1.666 toplev.c
--- toplev.c 4 Aug 2002 16:21:02 -0000 1.666
+++ toplev.c 4 Aug 2002 22:41:51 -0000
@@ -5161,7 +5161,7 @@ lang_independent_init (no_backend)
init_ggc ();
init_stringpool ();
- init_obstacks ();
+ init_ttree ();
if (no_backend)
return;
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.268
diff -p -u -p -r1.268 tree.c
--- tree.c 23 Jul 2002 21:58:56 -0000 1.268
+++ tree.c 4 Aug 2002 22:41:51 -0000
@@ -27,11 +27,7 @@ Software Foundation, 59 Temple Place - S
nodes of that code.
It is intended to be language-independent, but occasionally
- calls language-dependent routines defined (for C) in typecheck.c.
-
- The low-level allocation routines oballoc and permalloc
- are used also for allocating many other kinds of objects
- by all passes of the compiler. */
+ calls language-dependent routines defined (for C) in typecheck.c. */
#include "config.h"
#include "system.h"
@@ -51,10 +47,6 @@ Software Foundation, 59 Temple Place - S
/* obstack.[ch] explicitly declined to prototype this. */
extern int _obstack_allocated_p PARAMS ((struct obstack *h, PTR obj));
-/* Objects allocated on this obstack last forever. */
-
-struct obstack permanent_obstack;
-
#ifdef GATHER_STATISTICS
/* Statistics-gathering stuff. */
typedef enum
@@ -136,43 +128,17 @@ static int type_hash_marked_p PARAMS ((c
tree global_trees[TI_MAX];
tree integer_types[itk_none];
-/* Init the principal obstacks. */
+/* Init tree.c. */
void
-init_obstacks ()
+init_ttree ()
{
- gcc_obstack_init (&permanent_obstack);
-
/* Initialize the hash table of types. */
type_hash_table = htab_create (TYPE_HASH_INITIAL_SIZE, type_hash_hash,
type_hash_eq, 0);
}
-/* Allocate SIZE bytes in the permanent obstack
- and return a pointer to them. */
-
-char *
-permalloc (size)
- int size;
-{
- return (char *) obstack_alloc (&permanent_obstack, size);
-}
-
-/* Allocate NELEM items of SIZE bytes in the permanent obstack
- and return a pointer to them. The storage is cleared before
- returning the value. */
-
-char *
-perm_calloc (nelem, size)
- int nelem;
- long size;
-{
- char *rval = (char *) obstack_alloc (&permanent_obstack, nelem * size);
- memset (rval, 0, nelem * size);
- return rval;
-}
-
/* The name of the object as the assembler will see it (but before any
translations made by ASM_OUTPUT_LABELREF). Often this is the same
as DECL_NAME. It is an IDENTIFIER_NODE. */
@@ -4359,7 +4325,6 @@ dump_tree_statistics ()
#else
fprintf (stderr, "(No per-node statistics)\n");
#endif
- print_obstack_statistics ("permanent_obstack", &permanent_obstack);
print_type_hash_statistics ();
(*lang_hooks.print_statistics) ();
}
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.347
diff -p -u -p -r1.347 tree.h
--- tree.h 16 Jul 2002 02:16:32 -0000 1.347
+++ tree.h 4 Aug 2002 22:41:52 -0000
@@ -2103,8 +2103,6 @@ extern GTY(()) tree integer_types[itk_no
statistical reports, not code generation. */
extern double approx_sqrt PARAMS ((double));
-extern char *permalloc PARAMS ((int));
-extern char *expralloc PARAMS ((int));
extern tree decl_assembler_name PARAMS ((tree));
/* Compute the number of bytes occupied by 'node'. This routine only
@@ -2730,7 +2728,6 @@ extern tree builtin_function PARAMS ((c
const char *, tree));
/* In tree.c */
-extern char *perm_calloc PARAMS ((int, long));
extern void clean_symbol_name PARAMS ((char *));
extern tree get_file_function_name_long PARAMS ((const char *));
extern tree get_set_constructor_bits PARAMS ((tree, char *, int));
@@ -2891,7 +2888,7 @@ extern int real_onep PARAMS ((tree));
extern int real_twop PARAMS ((tree));
extern int real_minus_onep PARAMS ((tree));
extern void gcc_obstack_init PARAMS ((struct obstack *));
-extern void init_obstacks PARAMS ((void));
+extern void init_ttree PARAMS ((void));
extern void build_common_tree_nodes PARAMS ((int));
extern void build_common_tree_nodes_2 PARAMS ((int));
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.300
diff -p -u -p -r1.300 varasm.c
--- varasm.c 2 Aug 2002 01:12:09 -0000 1.300
+++ varasm.c 4 Aug 2002 22:41:52 -0000
@@ -1205,8 +1205,7 @@ assemble_start_function (decl, fnname)
char *name;
p = (* targetm.strip_name_encoding) (fnname);
- name = permalloc (strlen (p) + 1);
- strcpy (name, p);
+ name = xstrdup (p);
if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
first_global_object_name = name;
@@ -1529,8 +1528,7 @@ assemble_variable (decl, top_level, at_e
char *xname;
p = (* targetm.strip_name_encoding) (name);
- xname = permalloc (strlen (p) + 1);
- strcpy (xname, p);
+ xname = xstrdup (p);
first_global_object_name = xname;
}
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.267
diff -p -u -p -r1.267 alpha.c
--- config/alpha/alpha.c 16 Jul 2002 20:58:56 -0000 1.267
+++ config/alpha/alpha.c 4 Aug 2002 22:41:53 -0000
@@ -9824,7 +9824,7 @@ unicosmk_add_extern (name)
struct unicosmk_extern_list *p;
p = (struct unicosmk_extern_list *)
- permalloc (sizeof (struct unicosmk_extern_list));
+ xmalloc (sizeof (struct unicosmk_extern_list));
p->next = unicosmk_extern_head;
p->name = name;
unicosmk_extern_head = p;
@@ -9906,7 +9906,7 @@ unicosmk_need_dex (x)
--i;
}
- dex = (struct unicosmk_dex *) permalloc (sizeof (struct unicosmk_dex));
+ dex = (struct unicosmk_dex *) xmalloc (sizeof (struct unicosmk_dex));
dex->name = name;
dex->next = unicosmk_dex_list;
unicosmk_dex_list = dex;
Index: config/c4x/c4x.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.c,v
retrieving revision 1.107
diff -p -u -p -r1.107 c4x.c
--- config/c4x/c4x.c 16 Jul 2002 02:16:35 -0000 1.107
+++ config/c4x/c4x.c 4 Aug 2002 22:41:53 -0000
@@ -4497,7 +4497,7 @@ c4x_global_label (name)
return;
p = p->next;
}
- p = (struct name_list *) permalloc (sizeof *p);
+ p = (struct name_list *) xmalloc (sizeof *p);
p->next = global_head;
p->name = name;
global_head = p;
@@ -4546,7 +4546,7 @@ c4x_external_ref (name)
return;
p = p->next;
}
- p = (struct name_list *) permalloc (sizeof *p);
+ p = (struct name_list *) xmalloc (sizeof *p);
p->next = extern_head;
p->name = name;
extern_head = p;
Index: config/frv/frv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.c,v
retrieving revision 1.1
diff -p -u -p -r1.1 frv.c
--- config/frv/frv.c 4 Aug 2002 19:37:03 -0000 1.1
+++ config/frv/frv.c 4 Aug 2002 22:41:54 -0000
@@ -748,7 +748,7 @@ frv_encode_section_info (decl)
if (is_small)
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
- char * str = permalloc (2 + strlen (XSTR (sym_ref, 0)));
+ char * str = xmalloc (2 + strlen (XSTR (sym_ref, 0)));
str[0] = SDATA_FLAG_CHAR;
strcpy (&str[1], XSTR (sym_ref, 0));
Index: config/i386/winnt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.33
diff -p -u -p -r1.33 winnt.c
--- config/i386/winnt.c 1 Aug 2002 23:29:55 -0000 1.33
+++ config/i386/winnt.c 4 Aug 2002 22:41:54 -0000
@@ -622,7 +622,7 @@ i386_pe_record_external_function (name)
{
struct extern_list *p;
- p = (struct extern_list *) permalloc (sizeof *p);
+ p = (struct extern_list *) xmalloc (sizeof *p);
p->next = extern_head;
p->name = name;
extern_head = p;
@@ -652,7 +652,7 @@ i386_pe_record_exported_symbol (name, is
{
struct export_list *p;
- p = (struct export_list *) permalloc (sizeof *p);
+ p = (struct export_list *) xmalloc (sizeof *p);
p->next = export_head;
p->name = name;
p->is_data = is_data;
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.222
diff -p -u -p -r1.222 mips.c
--- config/mips/mips.c 2 Aug 2002 14:55:08 -0000 1.222
+++ config/mips/mips.c 4 Aug 2002 22:41:55 -0000
@@ -6044,7 +6044,7 @@ mips_output_external (file, decl, name)
|| strcmp (TREE_STRING_POINTER (section_name), ".sbss") == 0
|| strcmp (TREE_STRING_POINTER (section_name), ".sdata") == 0))
{
- p = (struct extern_list *) permalloc (sizeof (struct extern_list));
+ p = (struct extern_list *) xmalloc (sizeof (struct extern_list));
p->next = extern_head;
p->name = name;
p->size = len;
@@ -6060,7 +6060,7 @@ mips_output_external (file, decl, name)
bootstrap under Irix 5.1. */
&& strcmp (name, "__builtin_next_arg"))
{
- p = (struct extern_list *) permalloc (sizeof (struct extern_list));
+ p = (struct extern_list *) xmalloc (sizeof (struct extern_list));
p->next = extern_head;
p->name = name;
p->size = -1;
@@ -6079,7 +6079,7 @@ mips_output_external_libcall (file, name
{
register struct extern_list *p;
- p = (struct extern_list *) permalloc (sizeof (struct extern_list));
+ p = (struct extern_list *) xmalloc (sizeof (struct extern_list));
p->next = extern_head;
p->name = name;
p->size = -1;
Index: config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.174
diff -p -u -p -r1.174 pa.c
--- config/pa/pa.c 18 Jul 2002 17:58:44 -0000 1.174
+++ config/pa/pa.c 4 Aug 2002 22:41:56 -0000
@@ -6168,8 +6168,6 @@ output_millicode_call (insn, call_dest)
return "";
}
-extern struct obstack permanent_obstack;
-
/* INSN is either a function call. It may have an unconditional jump
in its delay slot.
@@ -6298,9 +6296,7 @@ output_call (insn, call_dest, sibcall)
i = n_deferred_plabels++;
deferred_plabels[i].internal_label = gen_label_rtx ();
- deferred_plabels[i].name = obstack_alloc (&permanent_obstack,
- strlen (name) + 1);
- strcpy (deferred_plabels[i].name, name);
+ deferred_plabels[i].name = ggc_strdup (name);
/* Gross. We have just implicitly taken the address of this
function, mark it as such. */
Index: config/romp/romp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/romp/romp.c,v
retrieving revision 1.25
diff -p -u -p -r1.25 romp.c
--- config/romp/romp.c 19 May 2002 05:23:19 -0000 1.25
+++ config/romp/romp.c 4 Aug 2002 22:41:56 -0000
@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */
#include "tree.h"
#include "function.h"
#include "expr.h"
+#include "ggc.h"
#include "toplev.h"
#include "tm_p.h"
#include "target.h"
@@ -1345,7 +1346,6 @@ rtx
get_symref (name)
register const char *name;
{
- extern struct obstack permanent_obstack;
register const char *sp = name;
unsigned int hash = 0;
struct symref_hashent *p, **last_p;
@@ -1367,10 +1367,8 @@ get_symref (name)
{
/* Ensure SYMBOL_REF will stay around. */
p = *last_p = (struct symref_hashent *)
- permalloc (sizeof (struct symref_hashent));
- p->symref = gen_rtx_SYMBOL_REF (Pmode,
- obstack_copy0 (&permanent_obstack,
- name, strlen (name)));
+ xmalloc (sizeof (struct symref_hashent));
+ p->symref = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
p->next = 0;
}
Index: config/rs6000/aix31.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/aix31.h,v
retrieving revision 1.9
diff -p -u -p -r1.9 aix31.h
--- config/rs6000/aix31.h 10 Jul 2002 00:33:51 -0000 1.9
+++ config/rs6000/aix31.h 4 Aug 2002 22:41:56 -0000
@@ -29,25 +29,25 @@ Boston, MA 02111-1307, USA. */
where we can't, it gets stripped off. */
#undef ASM_OUTPUT_EXTERNAL
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
- fputs ("\t.extern ", FILE); \
- assemble_name (FILE, XSTR (_symref, 0)); \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- { \
- fputs ("\n\t.extern .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
- } \
- putc ('\n', FILE); \
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
+ if ((TREE_CODE (DECL) == VAR_DECL \
+ || TREE_CODE (DECL) == FUNCTION_DECL) \
+ && (NAME)[strlen (NAME) - 1] != ']') \
+ { \
+ XSTR (_symref, 0) = concat (XSTR (_symref, 0), \
+ (TREE_CODE (DECL) == FUNCTION_DECL \
+ ? "[DS]" : "[RW]"), \
+ NULL); \
+ } \
+ fputs ("\t.extern ", FILE); \
+ assemble_name (FILE, XSTR (_symref, 0)); \
+ if (TREE_CODE (DECL) == FUNCTION_DECL) \
+ { \
+ fputs ("\n\t.extern .", FILE); \
+ RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
+ } \
+ putc ('\n', FILE); \
}
/* Similar, but for libcall. We only have to worry about the function name,
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.356
diff -p -u -p -r1.356 rs6000.c
--- config/rs6000/rs6000.c 2 Aug 2002 02:53:24 -0000 1.356
+++ config/rs6000/rs6000.c 4 Aug 2002 22:41:57 -0000
@@ -11874,7 +11874,7 @@ rs6000_gen_section_name (buf, filename,
}
len = strlen (after_last_slash) + strlen (section_desc) + 2;
- *buf = (char *) permalloc (len);
+ *buf = (char *) xmalloc (len);
p = *buf;
*p++ = '_';
Index: config/rs6000/xcoff.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/xcoff.h,v
retrieving revision 1.29
diff -p -u -p -r1.29 xcoff.h
--- config/rs6000/xcoff.h 3 Aug 2002 23:23:49 -0000 1.29
+++ config/rs6000/xcoff.h 4 Aug 2002 22:41:57 -0000
@@ -306,17 +306,17 @@ toc_section () \
/* This says how to output an external. */
#undef ASM_OUTPUT_EXTERNAL
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
+ if ((TREE_CODE (DECL) == VAR_DECL \
+ || TREE_CODE (DECL) == FUNCTION_DECL) \
+ && (NAME)[strlen (NAME) - 1] != ']') \
+ { \
+ XSTR (_symref, 0) = concat (XSTR (_symref, 0), \
+ (TREE_CODE (DECL) == FUNCTION_DECL \
+ ? "[DS]" : "[RW]"), \
+ NULL); \
+ } \
}
/* This is how to output an internal numbered label where
Index: config/vax/vax.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/vax.c,v
retrieving revision 1.27
diff -p -u -p -r1.27 vax.c
--- config/vax/vax.c 21 Jun 2002 23:58:45 -0000 1.27
+++ config/vax/vax.c 4 Aug 2002 22:41:58 -0000
@@ -810,7 +810,7 @@ vms_check_external (decl, name, pending)
}
/* Not previously seen; create a new list entry. */
- p = (struct extern_list *)permalloc ((long) sizeof (struct extern_list));
+ p = (struct extern_list *) xmalloc (sizeof (struct extern_list));
p->name = name;
if (pending)
Index: cp/cvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cvt.c,v
retrieving revision 1.120
diff -p -u -p -r1.120 cvt.c
--- cp/cvt.c 1 Aug 2002 04:46:18 -0000 1.120
+++ cp/cvt.c 4 Aug 2002 22:41:59 -0000
@@ -779,14 +779,6 @@ ocp_convert (type, expr, convtype, flags
return build_cplus_new (type, ctor);
}
- /* If TYPE or TREE_TYPE (E) is not on the permanent_obstack,
- then it won't be hashed and hence compare as not equal,
- even when it is. */
- if (code == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (e)) == TREE_TYPE (type)
- && index_type_equal (TYPE_DOMAIN (TREE_TYPE (e)), TYPE_DOMAIN (type)))
- return e;
-
if (flags & LOOKUP_COMPLAIN)
error ("conversion from `%T' to non-scalar type `%T' requested",
TREE_TYPE (expr), type);
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parse.y,v
retrieving revision 1.273
diff -p -u -p -r1.273 parse.y
--- cp/parse.y 1 Aug 2002 04:46:19 -0000 1.273
+++ cp/parse.y 4 Aug 2002 22:42:00 -0000
@@ -44,8 +44,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "ggc.h"
-extern struct obstack permanent_obstack;
-
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.606
diff -p -u -p -r1.606 pt.c
--- cp/pt.c 1 Aug 2002 04:46:19 -0000 1.606
+++ cp/pt.c 4 Aug 2002 22:42:01 -0000
@@ -47,8 +47,6 @@ Boston, MA 02111-1307, USA. */
returning an int. */
typedef int (*tree_fn_t) PARAMS ((tree, void*));
-extern struct obstack permanent_obstack;
-
/* The PENDING_TEMPLATES is a TREE_LIST of templates whose
instantiations have been deferred, either because their definitions
were not yet available, or because we were putting off doing the
Index: cp/repo.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/repo.c,v
retrieving revision 1.40
diff -p -u -p -r1.40 repo.c
--- cp/repo.c 4 Jun 2002 07:10:20 -0000 1.40
+++ cp/repo.c 4 Aug 2002 22:42:01 -0000
@@ -50,7 +50,6 @@ static FILE *repo_file;
static char *old_args, *old_dir, *old_main;
static struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
#define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE))
@@ -292,8 +291,9 @@ open_repo_file (filename)
if (! p)
p = s + strlen (s);
- obstack_grow (&permanent_obstack, s, p - s);
- repo_name = obstack_copy0 (&permanent_obstack, ".rpo", 4);
+ repo_name = xmalloc (p - s + 5);
+ memcpy (repo_name, s, p - s);
+ memcpy (repo_name + (p - s), ".rpo", 5);
repo_file = fopen (repo_name, "r");
}
@@ -332,16 +332,13 @@ init_repo (filename)
switch (buf[0])
{
case 'A':
- old_args = obstack_copy0 (&permanent_obstack, buf + 2,
- strlen (buf + 2));
+ old_args = ggc_strdup (buf + 2);
break;
case 'D':
- old_dir = obstack_copy0 (&permanent_obstack, buf + 2,
- strlen (buf + 2));
+ old_dir = ggc_strdup (buf + 2);
break;
case 'M':
- old_main = obstack_copy0 (&permanent_obstack, buf + 2,
- strlen (buf + 2));
+ old_main = ggc_strdup (buf + 2);
break;
case 'C':
case 'O':
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.133
diff -p -u -p -r1.133 class.c
--- java/class.c 4 Jun 2002 20:31:52 -0000 1.133
+++ java/class.c 4 Aug 2002 22:42:03 -0000
@@ -60,7 +60,6 @@ static tree build_method_symbols_entry P
static GTY(()) rtx registerClass_libfunc;
static GTY(()) rtx registerResource_libfunc;
-extern struct obstack permanent_obstack;
struct obstack temporary_obstack;
/* The compiler generates different code depending on whether or not
Index: java/constants.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/constants.c,v
retrieving revision 1.20
diff -p -u -p -r1.20 constants.c
--- java/constants.c 4 Jun 2002 07:10:47 -0000 1.20
+++ java/constants.c 4 Aug 2002 22:42:03 -0000
@@ -29,8 +29,6 @@ The Free Software Foundation is independ
#include "toplev.h"
#include "ggc.h"
-extern struct obstack permanent_obstack;
-
static void set_constant_entry PARAMS ((CPool *, int, int, jword));
static int find_class_or_string_constant PARAMS ((CPool *, int, tree));
static int find_name_and_type_constant PARAMS ((CPool *, tree, tree));
Index: java/except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/except.c,v
retrieving revision 1.27
diff -p -u -p -r1.27 except.c
--- java/except.c 29 Mar 2002 00:42:54 -0000 1.27
+++ java/except.c 4 Aug 2002 22:42:03 -0000
@@ -44,8 +44,6 @@ static void link_handler PARAMS ((struct
static void check_start_handlers PARAMS ((struct eh_range *, int));
static void free_eh_ranges PARAMS ((struct eh_range *range));
-extern struct obstack permanent_obstack;
-
struct eh_range *current_method_handlers;
struct eh_range *current_try_block = NULL;
Index: java/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.148
diff -p -u -p -r1.148 expr.c
--- java/expr.c 25 Jun 2002 13:27:19 -0000 1.148
+++ java/expr.c 4 Aug 2002 22:42:03 -0000
@@ -86,7 +86,6 @@ static int emit_init_test_initialization
static int get_offset_table_index PARAMS ((tree));
static GTY(()) tree operand_type[59];
-extern struct obstack permanent_obstack;
static GTY(()) tree methods_ident;
static GTY(()) tree ncode_ident;
Index: java/jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.118
diff -p -u -p -r1.118 jcf-parse.c
--- java/jcf-parse.c 4 Jun 2002 20:32:00 -0000 1.118
+++ java/jcf-parse.c 4 Aug 2002 22:42:03 -0000
@@ -66,9 +66,7 @@ The Free Software Foundation is independ
#include "jcf.h"
-extern struct obstack *saveable_obstack;
extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
/* Set to non-zero value in order to emit class initilization code
before static field references. */
Index: java/parse.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.h,v
retrieving revision 1.84
diff -p -u -p -r1.84 parse.h
--- java/parse.h 17 Apr 2002 08:23:00 -0000 1.84
+++ java/parse.h 4 Aug 2002 22:42:03 -0000
@@ -31,7 +31,6 @@ The Free Software Foundation is independ
/* Extern global variable declarations */
extern int java_error_count;
extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
extern int quiet_flag;
#ifndef JC1_LITE
Index: java/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/typeck.c,v
retrieving revision 1.50
diff -p -u -p -r1.50 typeck.c
--- java/typeck.c 4 Jun 2002 20:32:07 -0000 1.50
+++ java/typeck.c 4 Aug 2002 22:42:03 -0000
@@ -44,7 +44,6 @@ static tree lookup_do PARAMS ((tree, tre
static tree build_null_signature PARAMS ((tree));
tree * type_map;
-extern struct obstack permanent_obstack;
/* Set the type of the local variable with index SLOT to TYPE. */
============================================================