class.c (build_static_field_ref): Check FIELD_FINAL.
* class.c (build_static_field_ref): Check FIELD_FINAL. * constants.c (alloc_class_constant): Use TYPE_CPOOL_DATA_REF instead of current_constant_pool_data_ref. * java-tree.h (current_constant_pool_data_ref): Undefine. (JTI_CURRENT_CONSTANT_POOL_DATA_REF): Remove. * jcf-parse.c (init_outgoing_cpool): Don't initialize current_constant_pool_data_ref. * except.c (prepare_eh_table_type ): Use DECL_NAME of class type, not build_internal_class_name. * parse.y (patch_incomplete_class_ref): Always emit `class$' method. Use it when class ref isn't certain to be compiled. From-SVN: r60448
This commit is contained in:
parent
46d40353c3
commit
d3ab697ba4
@ -1,3 +1,20 @@
|
||||
2002-12-23 Jeff Sturm <jsturm@one-point.com>
|
||||
|
||||
* class.c (build_static_field_ref): Check FIELD_FINAL.
|
||||
|
||||
* constants.c (alloc_class_constant): Use TYPE_CPOOL_DATA_REF
|
||||
instead of current_constant_pool_data_ref.
|
||||
* java-tree.h (current_constant_pool_data_ref): Undefine.
|
||||
(JTI_CURRENT_CONSTANT_POOL_DATA_REF): Remove.
|
||||
* jcf-parse.c (init_outgoing_cpool): Don't initialize
|
||||
current_constant_pool_data_ref.
|
||||
|
||||
* except.c (prepare_eh_table_type ): Use DECL_NAME of class type,
|
||||
not build_internal_class_name.
|
||||
|
||||
* parse.y (patch_incomplete_class_ref): Always emit `class$' method.
|
||||
Use it when class ref isn't certain to be compiled.
|
||||
|
||||
2002-12-23 Joseph S. Myers <jsm@polyomino.org.uk>
|
||||
|
||||
* gcj.texi: Include gcc-common.texi.
|
||||
|
@ -1076,7 +1076,9 @@ build_static_field_ref (fdecl)
|
||||
{
|
||||
tree fclass = DECL_CONTEXT (fdecl);
|
||||
int is_compiled = is_compiled_class (fclass);
|
||||
if (is_compiled)
|
||||
|
||||
/* Allow static final fields to fold to a constant. */
|
||||
if (is_compiled || FIELD_FINAL (fdecl))
|
||||
{
|
||||
if (!DECL_RTL_SET_P (fdecl))
|
||||
{
|
||||
|
@ -388,10 +388,12 @@ alloc_class_constant (clas)
|
||||
static tree
|
||||
build_constant_data_ref ()
|
||||
{
|
||||
if (TYPE_CPOOL_DATA_REF (current_class))
|
||||
current_constant_pool_data_ref = TYPE_CPOOL_DATA_REF (current_class);
|
||||
tree cpool_data_ref = NULL_TREE;
|
||||
|
||||
else if (current_constant_pool_data_ref == NULL_TREE)
|
||||
if (TYPE_CPOOL_DATA_REF (current_class))
|
||||
cpool_data_ref = TYPE_CPOOL_DATA_REF (current_class);
|
||||
|
||||
if (cpool_data_ref == NULL_TREE)
|
||||
{
|
||||
tree decl;
|
||||
tree decl_name = mangled_classname ("_CD_", current_class);
|
||||
@ -400,10 +402,10 @@ build_constant_data_ref ()
|
||||
one_elt_array_domain_type));
|
||||
TREE_STATIC (decl) = 1;
|
||||
make_decl_rtl (decl, NULL);
|
||||
TYPE_CPOOL_DATA_REF (current_class) = current_constant_pool_data_ref
|
||||
TYPE_CPOOL_DATA_REF (current_class) = cpool_data_ref
|
||||
= build1 (ADDR_EXPR, ptr_type_node, decl);
|
||||
}
|
||||
return current_constant_pool_data_ref;
|
||||
return cpool_data_ref;
|
||||
}
|
||||
|
||||
/* Get the pointer value at the INDEX'th element of the constant pool. */
|
||||
|
@ -336,7 +336,7 @@ prepare_eh_table_type (type)
|
||||
else
|
||||
exp = fold (build
|
||||
(PLUS_EXPR, ptr_type_node,
|
||||
build_utf8_ref (build_internal_class_name (type)),
|
||||
build_utf8_ref (DECL_NAME (TYPE_NAME (type))),
|
||||
size_one_node));
|
||||
return exp;
|
||||
}
|
||||
|
@ -399,7 +399,6 @@ enum java_tree_index
|
||||
JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
|
||||
|
||||
JTI_WFL_OPERATOR,
|
||||
JTI_CURRENT_CONSTANT_POOL_DATA_REF,
|
||||
|
||||
JTI_MAIN_CLASS,
|
||||
JTI_CURRENT_CLASS,
|
||||
@ -685,10 +684,6 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
|
||||
|
||||
/* They need to be reset before processing each class */
|
||||
extern struct CPool *outgoing_cpool;
|
||||
/* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
|
||||
the constant data array for the current class. */
|
||||
#define current_constant_pool_data_ref \
|
||||
java_global_trees[JTI_CURRENT_CONSTANT_POOL_DATA_REF]
|
||||
|
||||
#define wfl_operator \
|
||||
java_global_trees[JTI_WFL_OPERATOR]
|
||||
|
@ -709,7 +709,6 @@ load_inner_classes (cur_class)
|
||||
void
|
||||
init_outgoing_cpool ()
|
||||
{
|
||||
current_constant_pool_data_ref = NULL_TREE;
|
||||
outgoing_cpool = xmalloc (sizeof (struct CPool));
|
||||
memset (outgoing_cpool, 0, sizeof (struct CPool));
|
||||
}
|
||||
|
@ -14073,7 +14073,16 @@ patch_incomplete_class_ref (node)
|
||||
if (!(ref_type = resolve_type_during_patch (type)))
|
||||
return error_mark_node;
|
||||
|
||||
if (!flag_emit_class_files || JPRIMITIVE_TYPE_P (ref_type)
|
||||
/* Generate the synthetic static method `class$'. (Previously we
|
||||
deferred this, causing different method tables to be emitted
|
||||
for native code and bytecode.) */
|
||||
if (!TYPE_DOT_CLASS (current_class))
|
||||
build_dot_class_method (current_class);
|
||||
|
||||
/* If we're not emitting class files and we know ref_type is a
|
||||
compiled class, build a direct reference. */
|
||||
if ((! flag_emit_class_files && is_compiled_class (ref_type))
|
||||
|| JPRIMITIVE_TYPE_P (ref_type)
|
||||
|| TREE_CODE (ref_type) == VOID_TYPE)
|
||||
{
|
||||
tree dot = build_class_ref (ref_type);
|
||||
@ -14084,10 +14093,7 @@ patch_incomplete_class_ref (node)
|
||||
}
|
||||
|
||||
/* If we're emitting class files and we have to deal with non
|
||||
primitive types, we invoke (and consider generating) the
|
||||
synthetic static method `class$'. */
|
||||
if (!TYPE_DOT_CLASS (current_class))
|
||||
build_dot_class_method (current_class);
|
||||
primitive types, we invoke the synthetic static method `class$'. */
|
||||
ref_type = build_dot_class_method_invocation (ref_type);
|
||||
return java_complete_tree (ref_type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user