This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recent regression


Andrew Haley wrote:

from Ranjit Mathew <rmathew@hotmail.com>

       * jcf-parse.c (read_class): Create jcf for a class that has already
       been read from a source file. Avoids unnecessary call to find_class
       for this case.

OK.



Ranjit,


Would it not it be better to simply avoid calling read_class in the CLASS_FROM_SOURCE_P case? If you have a type decl for a class and CLASS_FROM_SOURCE_P is true, then (afaik) it must by definition be already loaded and been/being parsed. How about the following patch instead:


2004-06-25 Bryce McKinlay <mckinlay@redhat.com>


   * jcf-parse.c (load_class): Classes defined by source parser are
   already loaded.

--- jcf-parse.c 17 Jun 2004 13:45:23 -0000 1.160
+++ jcf-parse.c 25 Jun 2004 15:37:14 -0000
@@ -581,7 +581,12 @@
name = TYPE_NAME (TREE_PURPOSE (class_or_name));
/* Or it's a type in the making */
else
- name = DECL_NAME (TYPE_NAME (class_or_name));
+ {
+ /* If the class is from source code, then it must already be loaded. */
+ if (CLASS_FROM_SOURCE_P (class_or_name))
+ return;
+ name = DECL_NAME (TYPE_NAME (class_or_name));
+ }


  saved = name;
  while (1)


This would also allow us to get rid of many of the CLASS_FROM_SOURCE_P checks scattered around parse.y.


Regards

Bryce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]