This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: don't collect types
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 24 Mar 2005 12:58:30 -0700
- Subject: [gcjx] Patch: FYI: don't collect types
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This makes sure that types and other global objects are registered
with the GC.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* builtins.cc (map_type): Call pushdecl.
(map_class_object): Likewise.
(add): Likewise.
* hooks.hh (pushdecl): Declare.
(all_decls): Declare.
* decl.cc (pushdecl): No longer static.
(all_decls): Updated comment.
Index: builtins.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/builtins.cc,v
retrieving revision 1.1.2.23
diff -u -r1.1.2.23 builtins.cc
--- builtins.cc 24 Mar 2005 02:11:11 -0000 1.1.2.23
+++ builtins.cc 24 Mar 2005 15:31:15 -0000
@@ -186,7 +186,10 @@
TYPE_FIELDS (context) = result;
}
else
- DECL_EXTERNAL (result) = 1; // FIXME unless we're compiling it...
+ {
+ DECL_EXTERNAL (result) = 1; // FIXME unless we're compiling it...
+ pushdecl (result);
+ }
fieldmap[field] = result;
}
@@ -245,7 +248,6 @@
// FIXME: make a NAMESPACE_DECL and use it as the DECL_CONTEXT.
- // FIXME: pushdecl() ?
// FIXME: should we use the class's name or its fully qualified
// name? For the moment we use the latter.
tree decl = build_decl (TYPE_DECL, TYPE_NAME (record), record);
@@ -253,6 +255,8 @@
TYPE_STUB_DECL (record) = decl;
typemap[klass] = build_pointer_type (record);
+
+ pushdecl (typemap[klass]);
}
return typemap[type];
}
@@ -272,6 +276,7 @@
DECL_NAME (decl) = DECL_ASSEMBLER_NAME (decl);
classobj_map[klass] = decl;
+ pushdecl (decl);
}
return classobj_map[klass];
}
Index: decl.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/decl.cc,v
retrieving revision 1.1.2.15
diff -u -r1.1.2.15 decl.cc
--- decl.cc 24 Mar 2005 02:15:42 -0000 1.1.2.15
+++ decl.cc 24 Mar 2005 15:31:15 -0000
@@ -29,7 +29,7 @@
// Used when computing the ABI version.
#define GCJ_BINARYCOMPAT_ADDITION 5
-// FIXME: do we need this? Global decl list.
+// DECLs that we want to protect from GC.
tree all_decls;
// Type of a Utf8Const structure, and pointer to it.
@@ -147,7 +147,9 @@
-static void
+// In gcjx this is used only to protect the tree from garbage
+// collection.
+void
pushdecl (tree x)
{
all_decls = tree_cons (NULL_TREE, x, all_decls);
Index: hooks.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/hooks.hh,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 hooks.hh
--- hooks.hh 24 Mar 2005 02:15:42 -0000 1.1.2.7
+++ hooks.hh 24 Mar 2005 15:31:15 -0000
@@ -23,6 +23,7 @@
#define GCC_TREE_HOOKS_HH
// See decl.cc for documentation of these globals.
+extern GTY (()) tree all_decls;
extern GTY (()) tree type_utf8const;
extern GTY (()) tree type_utf8const_ptr;
extern GTY (()) tree type_dtable;
@@ -105,6 +106,7 @@
extern tree build_address_of (tree);
extern void push_field (tree record, tree &field, const char *name,
tree field_type, bool is_private = false);
+extern void pushdecl (tree);
namespace gcjx
{