* c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only.
(lang_mark_false_label_stack): Remove.
* c-lex.c (init_c_lex): Add file_info_tree as GC root. Allocate
<top level> string in GC area.
(mark_splay_tree_node): New function.
(mark_splay_tree): Likewise.
* except.c (mark_eh_status): Only call lang_mark_false_label_stack
if it exists.
* ggc-callbacks.c (lang_mark_false_label_stack): Remove.
* ggc-common.c (lang_mark_false_label_stack): Change type.
* ggc.h (ggc_alloc_string): Add comment.
(ggc_strdup): New function.
* decl.c (lang_mark_false_label_stack): Remove.
* lex.c (cp_mang_lang_type): Use ggc_alloc_cleared.
* com.c (lang_mark_false_label_stack): Remove.
Convert to GC.
* Make-lang.in (s-java): Don't depend on ggc-callbacks.o.
* Makefile.in (BACKEND): Don't include ggc-callbacks.o.
(typeck.o): Depend on ggc.h.
* class.c (add_method_1): Use GC functions for allocation.
(init_class_processing): Register roots.
* decl.c (ggc_p): Set to 1.
(pending_local_decls): Make it static.
(push_jvm_slot): Use GC functions for allocation.
(init_decl_processing): Register roots.
(give_name_to_locals): Use GC functions for allocation.
(lang_mark_tree): New function.
* java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Use GC
functions for allocation.
* jcf-parse.c (jcf_parse_source): Use ggc_strdup.
* lex.c (java_lex): Use build_string, rather than replicating it
inline.
* parse.y (goal): Add more roots.
(mark_parser_ctxt): New function.
* typeck.c: Include ggc.h.
* splay-tree.c (splay_tree_insert): Fix formatting.
From-SVN: r36687
+2000-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only.
+ (lang_mark_false_label_stack): Remove.
+ * c-lex.c (init_c_lex): Add file_info_tree as GC root. Allocate
+ <top level> string in GC area.
+ (mark_splay_tree_node): New function.
+ (mark_splay_tree): Likewise.
+ * except.c (mark_eh_status): Only call lang_mark_false_label_stack
+ if it exists.
+ * ggc-callbacks.c (lang_mark_false_label_stack): Remove.
+ * ggc-common.c (lang_mark_false_label_stack): Change type.
+ * ggc.h (ggc_alloc_string): Add comment.
+ (ggc_strdup): New function.
+
Sat Sep 23 19:10:20 2000 Denis Chertykov <denisc@overta.ru>
* config/avr/avr.h (BRANCH_COST): Define as 0.
tree fndecl;
int nested_p;
{
+ /* There's no reason to do any of the work here if we're only doing
+ semantic analysis; this code just generates RTL. */
+ if (flag_syntax_only)
+ return;
+
/* Squirrel away our current state. */
if (nested_p)
push_function_context ();
DECL_LANG_SPECIFIC (decl) = ld;
}
-/* Mark ARG for GC. */
-
-void
-lang_mark_false_label_stack (arg)
- struct label_node *arg;
-{
- /* C doesn't use false_label_stack. It better be NULL. */
- if (arg != NULL)
- abort ();
-}
-
/* Mark the language specific bits in T for GC. */
void
static tree lex_charconst PARAMS ((const char *, unsigned int, int));
static void update_header_times PARAMS ((const char *));
static int dump_one_header PARAMS ((splay_tree_node, void *));
+static int mark_splay_tree_node PARAMS ((splay_tree_node, void *));
+static void mark_splay_tree PARAMS ((void *));
#if !USE_CPPLIB
static int skip_white_space PARAMS ((int));
file_info_tree = splay_tree_new ((splay_tree_compare_fn)strcmp,
0,
(splay_tree_delete_value_fn)free);
- toplevel = get_fileinfo ("<top level>");
+ /* Make sure to mark the filenames in the tree for GC. */
+ ggc_add_root (&file_info_tree, 1, sizeof (file_info_tree),
+ mark_splay_tree);
+ toplevel = get_fileinfo (ggc_strdup ("<top level>"));
if (flag_detailed_statistics)
{
header_time = 0;
return value;
}
+
+/* Mark for GC a node in a splay tree whose keys are strings. */
+
+static int
+mark_splay_tree_node (n, data)
+ splay_tree_node n;
+ void *data ATTRIBUTE_UNUSED;
+{
+ ggc_mark_string ((char *) n->key);
+ return 0;
+}
+
+/* Mark for GC a splay tree whose keys are strings. */
+
+static void
+mark_splay_tree (p)
+ void *p;
+{
+ splay_tree st = *(splay_tree *) p;
+
+ splay_tree_foreach (st, mark_splay_tree_node, NULL);
+}
+2000-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lang_mark_false_label_stack): Remove.
+ * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared.
+
2000-09-30 Joseph S. Myers <jsm28@cam.ac.uk>
* gxxint.texi: Use @email for formatting email addresses.
}
void
-lang_mark_false_label_stack (l)
- struct label_node *l;
-{
- /* C++ doesn't use false_label_stack. It better be NULL. */
- my_friendly_assert (l == NULL, 19990904);
-}
-
-void
lang_mark_tree (t)
tree t;
{
{
struct lang_type *pi;
- pi = (struct lang_type *) ggc_alloc (sizeof (struct lang_type));
- bzero ((char *) pi, (int) sizeof (struct lang_type));
+ pi = ((struct lang_type *)
+ ggc_alloc_cleared (sizeof (struct lang_type)));
TYPE_LANG_SPECIFIC (t) = pi;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
mark_eh_queue (eh->x_ehqueue);
ggc_mark_rtx (eh->x_catch_clauses);
- lang_mark_false_label_stack (eh->x_false_label_stack);
+ if (lang_mark_false_label_stack)
+ (*lang_mark_false_label_stack) (eh->x_false_label_stack);
mark_tree_label_node (eh->x_caught_return_label_stack);
ggc_mark_tree (eh->x_protect_list);
+Sun Oct 1 11:43:44 2000 Mark Mitchell <mark@codesourcery.com>
+
+ * com.c (lang_mark_false_label_stack): Remove.
+
2000-09-10 Zack Weinberg <zack@wolery.cumb.org>
* com.c: Include defaults.h.
ggc_mark (TYPE_LANG_SPECIFIC (t));
}
-void
-lang_mark_false_label_stack (l)
- struct label_node *l;
-{
- /* Fortran doesn't use false_label_stack. It better be NULL. */
- if (l != NULL)
- abort();
-}
-
#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
\f
#if FFECOM_GCC_INCLUDE
/* Empty GC callbacks to be used by languages that don't support GC.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
abort ();
}
-void ATTRIBUTE_NORETURN
-lang_mark_false_label_stack (l)
- struct label_node *l ATTRIBUTE_UNUSED;
-{
- /* If this function is called, we are doing GC. But, this file is
- only included in compilers for languages that don't support GC. */
- abort ();
-}
/* Statistics about the allocation. */
static ggc_statistics *ggc_stats;
+/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent
+ semantics. If a front-end needs to mark the false label stack, it
+ should set this pointer to a non-NULL value. Otherwise, no marking
+ will be done. */
+void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
+
/* Trees that have been marked, but whose children still need marking. */
varray_type ggc_pending_trees;
#define ggc_alloc_tree(LENGTH) ((union tree_node *) ggc_alloc (LENGTH))
+/* Allocate a gc-able string. If CONTENTS is null, then the memory will
+ be uninitialized. If LENGTH is -1, then CONTENTS is assumed to be a
+ null-terminated string and the memory sized accordingly. Otherwise,
+ the memory is filled with LENGTH bytes from CONTENTS. */
char *ggc_alloc_string PARAMS ((const char *contents, int length));
+/* Make a copy of S, in GC-able memory. */
+#define ggc_strdup(S) ggc_alloc_string((S), -1)
+
/* Invoke the collector. This is really just a hint, but in the case of
the simple collector, the only time it will happen. */
void ggc_collect PARAMS ((void));
the lang_specific hooks in the tree. */
void lang_mark_tree PARAMS ((union tree_node *));
-/* The FALSE_LABEL_STACK, declared in except.h, has
- language-dependent semantics. Each front-end should define this
- function appropriately. */
-void lang_mark_false_label_stack PARAMS ((struct label_node *));
+/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent
+ semantics. If a front-end needs to mark the false label stack, it
+ should set this pointer to a non-NULL value. Otherwise, no marking
+ will be done. */
+extern void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
/* Mark functions for various structs scattered about. */
+2000-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ Convert to GC.
+ * Make-lang.in (s-java): Don't depend on ggc-callbacks.o.
+ * Makefile.in (BACKEND): Don't include ggc-callbacks.o.
+ (typeck.o): Depend on ggc.h.
+ * class.c (add_method_1): Use GC functions for allocation.
+ (init_class_processing): Register roots.
+ * decl.c (ggc_p): Set to 1.
+ (pending_local_decls): Make it static.
+ (push_jvm_slot): Use GC functions for allocation.
+ (init_decl_processing): Register roots.
+ (give_name_to_locals): Use GC functions for allocation.
+ (lang_mark_tree): New function.
+ * java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Use GC
+ functions for allocation.
+ * jcf-parse.c (jcf_parse_source): Use ggc_strdup.
+ * lex.c (java_lex): Use build_string, rather than replicating it
+ inline.
+ * parse.y (goal): Add more roots.
+ (mark_parser_ctxt): New function.
+ * typeck.c: Include ggc.h.
+
2000-09-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (maybe_yank_clinit): Also keep <clinit> if its body
jc1$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext): s-java
-s-java: $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) ggc-callbacks.o \
+s-java: $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) \
$(GCJH_SOURCES) $(LIBDEPS) $(TREE_H) \
$(JV_SCAN_SOURCES) $(BACKEND) $(LIBDEPS) \
$(JCF_DUMP_SOURCES)
JAVA_OBJS_LITE = parse-scan.o jv-scan.o
# Language-independent object files.
-BACKEND = ../toplev.o ../ggc-callbacks.o ../libbackend.a
+BACKEND = ../toplev.o ../libbackend.a
compiler: ../jc1$(exeext) ../jv-scan$(exeext)
../jc1$(exeext): $(P) $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
- $(srcdir)/../toplev.h $(srcdir)/../system.h
+ $(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../ggc.h
verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
java-except.h $(srcdir)/../toplev.h $(srcdir)/../system.h
xref.o : xref.c xref.h $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../toplev.h \
DECL_CONTEXT (fndecl) = handle_class;
DECL_LANG_SPECIFIC (fndecl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl));
- bzero ((PTR) DECL_LANG_SPECIFIC (fndecl), sizeof (struct lang_decl));
+ = (struct lang_decl *) ggc_alloc_cleared (sizeof (struct lang_decl));
/* Initialize the static initializer test table. */
hash_table_init (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
{
registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass");
ggc_add_tree_root (®istered_class, 1);
+ ggc_add_rtx_root (®isterClass_libfunc, 1);
}
before static field references. */
extern int always_initialize_class_p;
+/* Use garbage collection. */
+
+int ggc_p = 1;
+
/* The DECL_MAP is a mapping from (index, type) to a decl node.
If index < max_locals, it is the index of a local variable.
if index >= max_locals, then index-max_locals is a stack slot.
/* A list of local variables VAR_DECLs for this method that we have seen
debug information, but we have not reached their starting (byte) PC yet. */
-tree pending_local_decls = NULL_TREE;
+static tree pending_local_decls = NULL_TREE;
tree throw_node [2];
if (DECL_LANG_SPECIFIC (decl) == NULL)
{
DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
+ = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
DECL_LOCAL_START_PC (decl) = 0;
DECL_LOCAL_END_PC (decl) = DECL_CODE_LENGTH (current_function_decl);
DECL_LOCAL_SLOT_NUMBER (decl) = index;
sizeof (throw_node) / sizeof (tree));
ggc_add_tree_root (predef_filenames,
sizeof (predef_filenames) / sizeof (tree));
+ ggc_add_tree_root (&decl_map, 1);
+ ggc_add_tree_root (&pending_local_decls, 1);
}
end_pc = DECL_CODE_LENGTH (current_function_decl);
}
DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
+ = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
DECL_LOCAL_SLOT_NUMBER (decl) = slot;
DECL_LOCAL_START_PC (decl) = start_pc;
#if 0
permanent_allocation (1);
asynchronous_exceptions = flag_asynchronous_exceptions;
}
+
+/* Mark language-specific parts of T for garbage-collection. */
+
+void
+lang_mark_tree (t)
+ tree t;
+{
+ if (TREE_CODE (t) == IDENTIFIER_NODE)
+ {
+ struct lang_identifier *li = (struct lang_identifier *) t;
+ ggc_mark_tree (li->global_value);
+ ggc_mark_tree (li->local_value);
+ ggc_mark_tree (li->utf8_ref);
+ }
+ else if (TREE_CODE (t) == VAR_DECL
+ || TREE_CODE (t) == PARM_DECL)
+ {
+ struct lang_decl_var *ldv =
+ ((struct lang_decl_var *) DECL_LANG_SPECIFIC (t));
+ if (ldv)
+ {
+ ggc_mark (ldv);
+ ggc_mark_tree (ldv->slot_chain);
+ }
+ }
+ else if (TREE_CODE (t) == FUNCTION_DECL)
+ {
+ struct lang_decl *ld = DECL_LANG_SPECIFIC (t);
+
+ if (ld)
+ {
+ ggc_mark (ld);
+ ggc_mark_tree (ld->throws_list);
+ ggc_mark_tree (ld->function_decl_body);
+ ggc_mark_tree (ld->called_constructor);
+ ggc_mark_tree (ld->inner_access);
+ }
+ }
+ else if (TYPE_P (t))
+ {
+ struct lang_type *lt = TYPE_LANG_SPECIFIC (t);
+
+ if (lt)
+ {
+ ggc_mark (lt);
+ ggc_mark_tree (lt->signature);
+ ggc_mark_tree (lt->cpool_data_ref);
+ ggc_mark_tree (lt->finit_stmt_list);
+ ggc_mark_tree (lt->clinit_stmt_list);
+ ggc_mark_tree (lt->ii_block);
+ ggc_mark_tree (lt->dot_class);
+ }
+ }
+}
#define TYPE_JCF(T) (TYPE_LANG_SPECIFIC(T)->jcf)
#define TYPE_CPOOL(T) (TYPE_LANG_SPECIFIC(T)->cpool)
#define TYPE_CPOOL_DATA_REF(T) (TYPE_LANG_SPECIFIC(T)->cpool_data_ref)
-#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
- if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
- { \
- TYPE_LANG_SPECIFIC ((T)) = \
- (struct lang_type *) xmalloc (sizeof (struct lang_type)); \
- \
- bzero ((char *) TYPE_LANG_SPECIFIC ((T)), \
- sizeof (struct lang_type)); \
+#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
+ if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
+ { \
+ TYPE_LANG_SPECIFIC ((T)) = \
+ ((struct lang_type *) \
+ ggc_alloc_cleared (sizeof (struct lang_type))); \
}
#define TYPE_FINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->finit_stmt_list)
java_parser_context_save_global ();
java_push_parser_context ();
- input_filename = current_jcf->filename;
+ input_filename = ggc_strdup (current_jcf->filename);
file = get_identifier (input_filename);
current_class = NULL_TREE;
current_function_decl = NULL_TREE;
if (!no_error || (c != '"'))
java_lval->node = error_mark_node; /* Requires futher testing FIXME */
else
- {
- tree s = make_node (STRING_CST);
- TREE_STRING_LENGTH (s) = strlen (string);
- TREE_STRING_POINTER (s) =
- obstack_alloc (expression_obstack, TREE_STRING_LENGTH (s)+1);
- strcpy (TREE_STRING_POINTER (s), string);
- java_lval->node = s;
- }
+ java_lval->node = build_string (strlen (string), string);
#endif
return STRING_LIT_TK;
}
static tree build_dot_class_method PARAMS ((tree));
static tree build_dot_class_method_invocation PARAMS ((tree));
static void create_new_parser_context PARAMS ((int));
+static void mark_parser_ctxt PARAMS ((void *));
/* Number of error found so far. */
int java_error_count;
int do_not_fold;
/* Cyclic inheritance report, as it can be set by layout_class */
char *cyclic_inheritance_report;
-
+
/* Tell when we're within an instance initializer */
static int in_instance_initializer;
ggc_add_tree_root (&package_list, 1);
ggc_add_tree_root (¤t_this, 1);
ggc_add_tree_root (¤tly_caught_type_list, 1);
+ ggc_add_root (&ctxp, 1,
+ sizeof (struct parser_ctxt *),
+ mark_parser_ctxt);
+ ggc_add_root (&ctxp_for_generation, 1,
+ sizeof (struct parser_ctxt *),
+ mark_parser_ctxt);
}
compilation_unit
{}
{
}
#endif
+
+/* Mark P, which is really a `struct parser_ctxt **' for GC. */
+
+static void
+mark_parser_ctxt (p)
+ void *p;
+{
+ struct parser_ctxt *pc = *((struct parser_ctxt **) p);
+ int i;
+
+ if (!pc)
+ return;
+
+#ifndef JC1_LITE
+ for (i = 0; i < 11; ++i)
+ ggc_mark_tree (pc->modifier_ctx[i]);
+ ggc_mark_tree (pc->class_type);
+ ggc_mark_tree (pc->function_decl);
+ ggc_mark_tree (pc->package);
+ ggc_mark_tree (pc->incomplete_class);
+ ggc_mark_tree (pc->gclass_list);
+ ggc_mark_tree (pc->class_list);
+ ggc_mark_tree (pc->current_parsed_class);
+ ggc_mark_tree (pc->current_parsed_class_un);
+ ggc_mark_tree (pc->non_static_initialized);
+ ggc_mark_tree (pc->static_initialized);
+ ggc_mark_tree (pc->instance_initializers);
+ ggc_mark_tree (pc->import_list);
+ ggc_mark_tree (pc->import_demand_list);
+ ggc_mark_tree (pc->current_loop);
+ ggc_mark_tree (pc->current_labeled_block);
+#endif /* JC1_LITE */
+
+ if (pc->next)
+ mark_parser_ctxt (&pc->next);
+}
#include "jcf.h"
#include "convert.h"
#include "toplev.h"
+#include "ggc.h"
static tree convert_ieee_real_to_integer PARAMS ((tree, tree));
static tree parse_signature_type PARAMS ((const unsigned char **,
+2000-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * splay-tree.c (splay_tree_insert): Fix formatting.
+
2000-09-16 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_predecessor): Fix typo in comment.
node->right->left = 0;
}
- sp->root = node;
- }
+ sp->root = node;
+ }
return sp->root;
}