This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: DECL_EXTERNAL handling
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 27 Apr 2005 11:35:43 -0600
- Subject: [gcjx] Patch: FYI: DECL_EXTERNAL handling
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This cleans up DECL_EXTERNAL handling. Now we always set
DECL_EXTERNAL on new decls, and then we later clear the flag if we are
actually defining that object.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* treegen.cc (generate): Clear DECL_EXTERNAL.
* tree.cc (visit_method): Clear DECL_EXTERNAL.
(build_jni_stub): Don't bother setting DECL_EXTERNAL.
* builtins.cc (add): Always set DECL_EXTERNAL.
Index: builtins.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/builtins.cc,v
retrieving revision 1.1.2.35
diff -u -r1.1.2.35 builtins.cc
--- builtins.cc 27 Apr 2005 17:32:55 -0000 1.1.2.35
+++ builtins.cc 27 Apr 2005 17:37:12 -0000
@@ -151,9 +151,10 @@
|| meth->static_p ()
|| meth->final_p ())
DECL_INLINE (result) = 1;
- if (meth->native_p ())
- DECL_EXTERNAL (result) = 1;
- // FIXME: if we're not compiling this method, set DECL_EXTERNAL.
+
+ // We mark all methods as external, but then we clear this bit when
+ // we actually compile the method in question.
+ DECL_EXTERNAL (result) = 1;
methodmap[meth] = result;
}
@@ -186,7 +187,9 @@
}
else
{
- DECL_EXTERNAL (result) = 1; // FIXME unless we're compiling it...
+ // We clear this later if we compile the field's declaring
+ // class.
+ DECL_EXTERNAL (result) = 1;
pushdecl (result);
}
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.43
diff -u -r1.1.2.43 tree.cc
--- tree.cc 27 Apr 2005 17:34:48 -0000 1.1.2.43
+++ tree.cc 27 Apr 2005 17:37:12 -0000
@@ -121,6 +121,9 @@
gcc_builtins->lay_out_class (meth->get_declaring_class ());
method_tree = gcc_builtins->map_method (meth);
+ if (block || flag_jni)
+ DECL_EXTERNAL (method_tree) = 0;
+
if (block)
{
assert (this_tree == NULL_TREE);
@@ -177,7 +180,6 @@
else
{
// For CNI (old ABI) just generate an external reference.
- DECL_EXTERNAL (method_tree) = 1;
}
}
@@ -194,7 +196,6 @@
DECL_INITIAL (method_tree) = current_block;
DECL_ARTIFICIAL (method_tree) = 1;
- DECL_EXTERNAL (method_tree) = 0;
tree env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node);
DECL_CONTEXT (env_var) = method_tree;
Index: treegen.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/treegen.cc,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 treegen.cc
--- treegen.cc 17 Apr 2005 21:36:00 -0000 1.1.2.9
+++ treegen.cc 27 Apr 2005 17:37:12 -0000
@@ -94,6 +94,7 @@
continue;
tree field = builtins->map_field ((*i).get ());
+ DECL_EXTERNAL (field) = 0;
cgraph_varpool_finalize_decl (field);
}