re PR java/11533 (Inlining drops static initialization of inner class)
2003-11-12 Andrew Haley <aph@redhat.com> PR java/11533 * lang.c (merge_init_test_initialization): Clear DECL_INITIAL for init_test_decls being inlined. PR java/12890: * parse.y (do_resolve_class): Check return value from breakdown_qualified(). From-SVN: r73494
This commit is contained in:
parent
88f08cca28
commit
7304c6cfe9
|
@ -1,3 +1,13 @@
|
|||
2003-11-12 Andrew Haley <aph@redhat.com>
|
||||
|
||||
PR java/11533
|
||||
* lang.c (merge_init_test_initialization): Clear DECL_INITIAL for
|
||||
init_test_decls being inlined.
|
||||
|
||||
PR java/12890:
|
||||
* parse.y (do_resolve_class): Check return value from
|
||||
breakdown_qualified().
|
||||
|
||||
2003-11-11 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
PR java/12915:
|
||||
|
|
|
@ -926,6 +926,24 @@ merge_init_test_initialization (void **entry, void *x)
|
|||
if (!*init_test_decl)
|
||||
*init_test_decl = (tree)n->value;
|
||||
|
||||
/* This fixes a weird case.
|
||||
|
||||
The front end assumes that once we have called a method that
|
||||
initializes some class, we can assume the class is initialized. It
|
||||
does this by setting the DECL_INITIAL of the init_test_decl for that
|
||||
class, and no initializations are emitted for that class.
|
||||
|
||||
However, what if the method that is suppoed to do the initialization
|
||||
is itself inlined in the caller? When expanding the called method
|
||||
we'll assume that the class initalization has already been done,
|
||||
because the DECL_INITIAL of the init_test_decl is set.
|
||||
|
||||
To fix this we remove the DECL_INITIAL (in the caller scope) of all
|
||||
the init_test_decls corresponding to classes initialized by the
|
||||
inlined method. This makes the caller no longer assume that the
|
||||
method being inlined does any class initializations. */
|
||||
DECL_INITIAL (*init_test_decl) = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5718,14 +5718,16 @@ do_resolve_class (tree enclosing, tree class_type, tree decl, tree cl)
|
|||
class and then treat Id as a member type. If we can't find Q
|
||||
as a class then we fall through. */
|
||||
tree q, left, left_type, right;
|
||||
breakdown_qualified (&left, &right, TYPE_NAME (class_type));
|
||||
BUILD_PTR_FROM_NAME (left_type, left);
|
||||
q = do_resolve_class (enclosing, left_type, decl, cl);
|
||||
if (q)
|
||||
if (breakdown_qualified (&left, &right, TYPE_NAME (class_type)) == 0)
|
||||
{
|
||||
enclosing = q;
|
||||
saved_enclosing_type = TREE_TYPE (q);
|
||||
BUILD_PTR_FROM_NAME (class_type, right);
|
||||
BUILD_PTR_FROM_NAME (left_type, left);
|
||||
q = do_resolve_class (enclosing, left_type, decl, cl);
|
||||
if (q)
|
||||
{
|
||||
enclosing = q;
|
||||
saved_enclosing_type = TREE_TYPE (q);
|
||||
BUILD_PTR_FROM_NAME (class_type, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16218,8 +16220,8 @@ attach_init_test_initialization_flags (void **entry, void *ptr)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* This function is called for each classes that is known definitely
|
||||
assigned when a given static method was called. This function
|
||||
/* This function is called for each class that is known definitely
|
||||
initialized when a given static method was called. This function
|
||||
augments a compound expression (INFO) storing all assignment to
|
||||
initialized static class flags if a flag already existed, otherwise
|
||||
a new one is created. */
|
||||
|
|
Loading…
Reference in New Issue