[PATCH] Speedup java front-end when compiling from source

Andrew Pinski pinskia@physics.uc.edu
Mon May 10 15:23:00 GMT 2004


On May 10, 2004, at 06:17, Andrew Haley wrote:

> Andrew Pinski writes:
>>
>> ChangeLog:
>>
>> 	* parse.y (check_pkg_class_access): Add new argument
>> 	and use it when cl is NULL to call lookup_cl on it.
>> 	(parser_check_super_interface): Do not call lookup_cl.
>> 	Pass this_decl to check_pkg_class_access and NULL
>> 	instead of lookup_cl.
>> 	(parser_check_super): Update for change in
>> 	check_pkg_class_access.
>> 	(do_resolve_class): Likewise.
>> 	(process_imports): Likewise.
>> 	(find_in_imports_on_demand): Likewise.
>
> This is OK.


This is what I checked in after the comment fixes pointed out
by Ranjit and updating for the recent additions of
resolve_qualified_expression_name.


Thanks,
Andrew Pinski

2004-05-10  Andrew Pinski  <pinskia@physics.uc.edu>

         * parse.y (check_pkg_class_access): Add new argument
         and use it when cl is NULL to call lookup_cl on it.
         (parser_check_super_interface): Do not call lookup_cl.
         Pass this_decl to check_pkg_class_access and NULL
         instead of lookup_cl.
         (parser_check_super): Update for change in
         check_pkg_class_access.
         (do_resolve_class): Likewise.
         (process_imports): Likewise.
         (find_in_imports_on_demand): Likewise.
         (resolve_qualified_expression_name): Likewise.


Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.476
diff -u -p -r1.476 parse.y
--- parse.y	6 May 2004 17:43:48 -0000	1.476
+++ parse.y	10 May 2004 15:06:09 -0000
@@ -107,7 +107,7 @@ static void read_import_dir (tree);
  static int find_in_imports_on_demand (tree, tree);
  static void find_in_imports (tree, tree);
  static void check_inner_class_access (tree, tree, tree);
-static int check_pkg_class_access (tree, tree, bool);
+static int check_pkg_class_access (tree, tree, bool, tree);
  static void register_package (tree);
  static tree resolve_package (tree, tree *, tree *);
  static tree resolve_class (tree, tree, tree, tree);
@@ -5079,7 +5079,7 @@ parser_check_super_interface (tree super
       access rules (6.6.1). */
    if (! INNER_CLASS_P (super_type)
        && check_pkg_class_access (DECL_NAME (super_decl),
-				 lookup_cl (this_decl), true))
+				 NULL_TREE, true, this_decl))
      return 1;

    SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
@@ -5117,7 +5117,7 @@ parser_check_super (tree super_decl, tre
    /* Check top-level class scope. Inner classes are subject to member 
access
       rules (6.6.1). */
    if (! INNER_CLASS_P (super_type)
-      && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true)))
+      && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true, 
NULL_TREE)))
      return 1;

    SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
@@ -5857,7 +5857,7 @@ do_resolve_class (tree enclosing, tree c
       by the caller. */
    if (cl)
      {
-      if (check_pkg_class_access (TYPE_NAME (class_type), cl, true))
+      if (check_pkg_class_access (TYPE_NAME (class_type), cl, true, 
NULL_TREE))
          return NULL_TREE;
      }

@@ -6817,7 +6817,7 @@ process_imports (void)
  	  QUALIFIED_P (to_be_found) = 1;
  	  load_class (to_be_found, 0);
  	  error_found =
-	    check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true);
+	    check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true, 
NULL_TREE);

  	  /* We found it, we can bail out */
  	  if (IDENTIFIER_CLASS_VALUE (to_be_found))
@@ -7061,7 +7061,7 @@ find_in_imports_on_demand (tree enclosin
  	}
        if (decl && ! INNER_CLASS_P (TREE_TYPE (decl)))
  	access_check = check_pkg_class_access (node, TREE_PURPOSE (import),
-					       false);
+					       false, NULL_TREE);
        else
  	/* 6.6.1: Inner classes are subject to member access rules. */
  	access_check = 0;
@@ -7247,10 +7247,11 @@ check_inner_class_access (tree decl, tre
  /* Accessibility check for top-level classes. If CLASS_NAME is in a
     foreign package, it must be PUBLIC. Return 0 if no access
     violations were found, 1 otherwise. If VERBOSE is true and an error
-   was found, it is reported and accounted for.  */
+   was found, it is reported and accounted for.  If CL is NULL then
+   look it up with THIS_DECL.  */

  static int
-check_pkg_class_access (tree class_name, tree cl, bool verbose)
+check_pkg_class_access (tree class_name, tree cl, bool verbose, tree 
this_decl)
  {
    tree type;

@@ -7275,7 +7276,8 @@ check_pkg_class_access (tree class_name,

        if (verbose)
  	parse_error_context
-	  (cl, "Can't access %s `%s'. Only public classes and interfaces in 
other packages can be accessed",
+	  (cl == NULL ? lookup_cl (this_decl): cl,
+           "Can't access %s `%s'. Only public classes and interfaces 
in other packages can be accessed",
  	   (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
  	   IDENTIFIER_POINTER (class_name));
        return 1;
@@ -9836,7 +9838,7 @@ resolve_qualified_expression_name (tree
  	      tree list;
  	      *where_found = decl;

-	      check_pkg_class_access (DECL_NAME (decl), qual_wfl, true);
+	      check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);

  	      /* We want to be absolutely sure that the class is laid
                   out. We're going to search something inside it. */
@@ -9888,7 +9890,7 @@ resolve_qualified_expression_name (tree
  	      return 1;
  	    }

-	  check_pkg_class_access (DECL_NAME (decl), qual_wfl, true);
+	  check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);

  	  check_deprecation (qual_wfl, decl);



More information about the Java-patches mailing list