expr.c (expand_java_field_op): Don't special-case references to java.lang.PRIMTYPE.TYPE.

* 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
This commit is contained in:
Bryce McKinlay 2001-10-26 01:53:56 +00:00 committed by Bryce McKinlay
parent 839f820424
commit 961b8e7028
4 changed files with 14 additions and 88 deletions

View 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.

View 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;

View 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));

View 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);