expr.c (expand_java_field_op): Don't special-case references to java.lang.PRIMTYPE...
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>
Fri, 26 Oct 2001 01:53:56 +0000 (01:53 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 26 Oct 2001 01:53:56 +0000 (02:53 +0100)
* expr.c (expand_java_field_op): Don't special-case references to
java.lang.PRIMTYPE.TYPE.
(build_primtype_type_ref): Removed.
* java-tree.h (build_primtype_type_ref): Remove prototype.
* parse.y (maybe_build_primttype_type_ref): Removed.
(complete_function_arguments): Don't special-case references to
java.lang.PRIMTYPE.TYPE.
(patch_assignment): Likewise.
(array_constructor_check_entry): Likewise.

From-SVN: r46522

gcc/java/ChangeLog
gcc/java/expr.c
gcc/java/java-tree.h
gcc/java/parse.y

index 7e05cc20d9e687b93995e1f3d6ea680603d6b0f8..7b6b4efa5f28c5e83c301b496f14d2faaa3ce64f 100644 (file)
@@ -1,3 +1,15 @@
+2001-10-25  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
+
+       * expr.c (expand_java_field_op): Don't special-case references to
+       java.lang.PRIMTYPE.TYPE.
+       (build_primtype_type_ref): Removed.
+       * java-tree.h (build_primtype_type_ref): Remove prototype.
+       * parse.y (maybe_build_primttype_type_ref): Removed.
+       (complete_function_arguments): Don't special-case references to
+       java.lang.PRIMTYPE.TYPE.
+       (patch_assignment): Likewise.
+       (array_constructor_check_entry): Likewise.
+
 2001-10-24  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
        * mangle.c (static tree compression_table): Fixed leading comment.
index 5481289e444aff9e57fcfa5e9d78bd5350c20216..cf9bef46bf37ab3c7c287e268b917bbdbd3bd7a5 100644 (file)
@@ -2266,22 +2266,6 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
       return;
     }
 
-  /* Inline references to java.lang.PRIMTYPE.TYPE.
-     In addition to being a useful (minor) optimization,
-     this is also needed to avoid circularities in the implementation
-     of these fields in libjava. */
-  if (field_name == TYPE_identifier_node && ! is_putting
-      && ! flag_emit_class_files && field_type == class_ptr_type
-      && strncmp (self_name, "java.lang.", 10) == 0)
-    {
-      tree typ = build_primtype_type_ref (self_name);
-      if (typ)
-       {
-         push_value (typ);
-         return;
-       }
-    }
-
   field_ref = build_field_ref (field_ref, self_type, field_name);
   if (is_static)
     field_ref = build_class_init (self_type, field_ref);
@@ -2313,38 +2297,6 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
     push_value (field_ref);
 }
 
-tree
-build_primtype_type_ref (self_name)
-    const char *self_name;
-{
-  const char *class_name = self_name+10;
-  tree typ;
-  if (strncmp(class_name, "Byte", 4) == 0)
-    typ = byte_type_node;
-  else if (strncmp(class_name, "Short", 5) == 0)
-    typ = short_type_node;
-  else if (strncmp(class_name, "Integer", 7) == 0)
-    typ = int_type_node;
-  else if (strncmp(class_name, "Long", 4) == 0)
-    typ = long_type_node;
-  else if (strncmp(class_name, "Float", 5) == 0)
-    typ = float_type_node;
-  else if (strncmp(class_name, "Double", 6) == 0)
-    typ = double_type_node;
-  else if (strncmp(class_name, "Boolean", 7) == 0)
-    typ = boolean_type_node;
-  else if (strncmp(class_name, "Char", 4) == 0)
-    typ = char_type_node;
-  else if (strncmp(class_name, "Void", 4) == 0)
-    typ = void_type_node;
-  else
-    typ = NULL_TREE;
-  if (typ != NULL_TREE)
-    return build_class_ref (typ);
-  else
-    return NULL_TREE;
-}
-
 void
 load_type_state (label)
      tree label;
index 22be14965cca68547f9f2cc97bd004f1843f62fb..132cd719730bb0c5d0d27738115c5c6752b1be1a 100644 (file)
@@ -1102,7 +1102,6 @@ extern void write_classfile PARAMS ((tree));
 extern char *print_int_node PARAMS ((tree));
 extern void parse_error_context PARAMS ((tree cl, const char *, ...))
   ATTRIBUTE_PRINTF_2;
-extern tree build_primtype_type_ref PARAMS ((const char *));
 extern void finish_class PARAMS ((void));
 extern void java_layout_seen_class_methods PARAMS ((void));
 extern unsigned int check_for_initialization PARAMS ((tree));
index 0fed076b5a3f1fa654132866294d0acb20d1ed85..089d2c30f82c997744b129397a44d6be06301247 100644 (file)
@@ -258,7 +258,6 @@ static int check_method_redefinition PARAMS ((tree, tree));
 static int check_method_types_complete PARAMS ((tree));
 static void java_check_regular_methods PARAMS ((tree));
 static void java_check_abstract_methods PARAMS ((tree));
-static tree maybe_build_primttype_type_ref PARAMS ((tree, tree));
 static void unreachable_stmt_error PARAMS ((tree));
 static tree find_expr_with_wfl PARAMS ((tree));
 static void missing_return_error PARAMS ((tree));
@@ -3650,7 +3649,7 @@ find_as_inner_class (enclosing, name, cl)
   /* Otherwise, create a qual for the other part of the resolution. */
   else
     qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
-
+  
   return find_as_inner_class_do (qual, enclosing);
 }
 
@@ -12247,8 +12246,6 @@ complete_function_arguments (node)
         `+' operator. Build `parm.toString()' and expand it. */
       if ((temp = patch_string (parm)))
        parm = temp;
-      /* Inline PRIMTYPE.TYPE read access */
-      parm = maybe_build_primttype_type_ref (parm, wfl);
 
       TREE_VALUE (cn) = parm;
     }
@@ -12790,33 +12787,6 @@ check_final_assignment (lvalue, wfl)
   return 1;
 }
 
-/* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
-   read. This is needed to avoid circularities in the implementation
-   of these fields in libjava. */
-
-static tree
-maybe_build_primttype_type_ref (rhs, wfl)
-    tree rhs, wfl;
-{
-  tree to_return = NULL_TREE;
-  tree rhs_type = TREE_TYPE (rhs);
-  if (TREE_CODE (rhs) == COMPOUND_EXPR)
-    {
-      tree n = TREE_OPERAND (rhs, 1);
-      if (TREE_CODE (n) == VAR_DECL 
-         && DECL_NAME (n) == TYPE_identifier_node
-         && rhs_type == class_ptr_type
-         && TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION
-         && TREE_CODE (EXPR_WFL_NODE (wfl)) == IDENTIFIER_NODE)
-       {
-         const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
-         if (!strncmp (self_name, "java.lang.", 10))
-           to_return = build_primtype_type_ref (self_name);
-       }
-    }
-  return (to_return ? to_return : rhs );
-}
-
 /* 15.25 Assignment operators. */
 
 static tree
@@ -12927,10 +12897,6 @@ patch_assignment (node, wfl_op1, wfl_op2)
       error_found = 1;
     }
 
-  /* Inline read access to java.lang.PRIMTYPE.TYPE */
-  if (new_rhs)
-    new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
-
   if (error_found)
     return error_mark_node;
 
@@ -14875,10 +14841,7 @@ array_constructor_check_entry (type, entry)
     }
   
   if (new_value)
-    {
-      new_value = maybe_build_primttype_type_ref (new_value, wfl_value);
-      TREE_VALUE (entry) = new_value;
-    }
+    TREE_VALUE (entry) = new_value;
 
   if (array_type_string)
     free (array_type_string);