This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
patch to emit debug into emitted classes
- From: Per Bothner <per at bothner dot com>
- To: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 10 Mar 2005 15:12:05 -0800
- Subject: patch to emit debug into emitted classes
The attched patch suppresses debug into for classes that are
not emitted. Instead, we make use of the same "cross-reference
stubs" mechanism used for C++. The difference is huge:
$ ls -l libgcj.a libgcj.so.6.0.0 # before
-rw-rw-r-- 1 bothner bothner 154564856 Mar 1 00:11 libgcj.a
-rwxrwxr-x 1 bothner bothner 72487975 Mar 1 00:09 libgcj.so.6.0.0
$ ls -l libgcj.a libgcj.so.6.0.0 # after
-rw-rw-r-- 1 bothner bothner 54098170 Mar 10 14:10 libgcj.a
-rwxrwxr-x 1 bothner bothner 32394412 Mar 10 14:05 libgcj.so.6.0.0
The question of course is how well gdb handles such stubs for Java
code. Could somebody try it out? If it doesn't work, the savings
are substantial enough that it might be worth fixing gdb, assuming
that is doable.
If this works out, we might want this patch for 4.0 - the savings
are worth it.
It looks like this patch also fixes a bootstrap failure with
--enable-mapped-location, so I hope we can get it in asap.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2005-03-10 Per Bothner <per@bothner.com>
* class.c (push_class): By default, suppress debug output.
(finish_class): Enable debug output for classes we're emitting.
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.221
diff -u -p -r1.221 class.c
--- class.c 4 Mar 2005 15:38:13 -0000 1.221
+++ class.c 10 Mar 2005 22:19:48 -0000
@@ -422,6 +422,7 @@ push_class (tree class_type, tree class_
#endif
CLASS_P (class_type) = 1;
decl = build_decl (TYPE_DECL, class_name, class_type);
+ TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
/* dbxout needs a DECL_SIZE if in gstabs mode */
DECL_SIZE (decl) = integer_zero_node;
@@ -1904,6 +1905,7 @@ finish_class (void)
java_expand_catch_classes (current_class);
current_function_decl = NULL_TREE;
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (current_class)) = 1;
make_class_data (current_class);
register_class ();
rest_of_decl_compilation (TYPE_NAME (current_class), 1, 0);