This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
gcj/85
- To: apbianco at cygnus dot com
- Subject: gcj/85
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 5 Nov 1999 17:00:00 -0000
- Cc: java-prs at sourceware dot cygnus dot com,
- Reply-To: Tom Tromey <tromey at cygnus dot com>
The following reply was made to PR gcj/85; it has been noted by GNATS.
From: Tom Tromey <tromey@cygnus.com>
To: Java Gnats Server <java-gnats@sourceware.cygnus.com>
Cc: Alexandre Petit-Bianco <apbianco@cygnus.com>,
Bryce McKinlay <bryce@albatross.co.nz>
Subject: gcj/85
Date: 05 Nov 1999 09:55:57 -0700
I looked at this bug. I believe this patch implements the heuristic
we discussed on java-discuss: if the class has any native methods, all
methods, even private methods, are generated.
I'm not sure this works in every case. I only tried rebuilding
libjava with it. I suspect that compilation from .class works
differently, but I'm not certain. (In any case, this patch shouldn't
make things worse there.)
Before the patch, building with -O3 gave me several undefined symbols.
After the patch (and one minor bug fix in libjava, which I'll commit
soon), compilation worked with -O3.
Alex, is this ok to commit? Or would you prefer to put a "native
method" flag on the class and compute it incrementally? I'm not sure
how to go about doing that, but I'd be willing to try if that is what
you want.
1999-11-05 Tom Tromey <tromey@cygnus.com>
* class.c (finish_class): Emit inlined methods if any native
methods exist in the class.
Tom
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.46
diff -u -r1.46 class.c
--- class.c 1999/10/29 21:32:27 1.46
+++ class.c 1999/11/05 16:43:01
@@ -1205,7 +1205,21 @@
{
tree method;
tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
-
+ int saw_native_method = 0;
+
+ /* Find out if we have any native methods. We use this information
+ later. */
+ for (method = type_methods;
+ method != NULL_TREE;
+ method = TREE_CHAIN (method))
+ {
+ if (METHOD_NATIVE (method))
+ {
+ saw_native_method = 1;
+ break;
+ }
+ }
+
/* Emit deferred inline methods. */
for (method = type_methods; method != NULL_TREE; )
{
@@ -1214,7 +1228,8 @@
/* It's a deferred inline method. Decide if we need to emit it. */
if (flag_keep_inline_functions
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (method))
- || ! METHOD_PRIVATE (method))
+ || ! METHOD_PRIVATE (method)
+ || saw_native_method)
{
temporary_allocation ();
output_inline_function (method);