Commit 1be0e58d by Jan Hubicka Committed by Jan Hubicka

tree.c (free_lang_data_in_type): If BINFO has no important information in it, set it to NULL.


	* tree.c (free_lang_data_in_type): If BINFO has no important
	information in it, set it to NULL.
	(get_binfo_at_offset): Do not walk fields, only bases.
	* ipa-utils.h (polymorphic_type_binfo_p): Be ready for BINFO_TYPE
	to be NULL.
	* ipa-polymorphic-call.c (record_known_type): Likewise.

From-SVN: r217824
parent 1b5695e6
2014-11-19 Jan Hubicka <hubicka@ucw.cz>
* tree.c (free_lang_data_in_type): If BINFO has no important
information in it, set it to NULL.
(get_binfo_at_offset): Do not walk fields, only bases.
* ipa-utils.h (polymorphic_type_binfo_p): Be ready for BINFO_TYPE
to be NULL.
* ipa-polymorphic-call.c (record_known_type): Likewise.
2014-11-19 David Malcolm <dmalcolm@redhat.com> 2014-11-19 David Malcolm <dmalcolm@redhat.com>
PR jit/63854 PR jit/63854
...@@ -1849,7 +1849,7 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes, ...@@ -1849,7 +1849,7 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes,
{ {
tree binfo = TYPE_BINFO (type->type); tree binfo = TYPE_BINFO (type->type);
unsigned int i; unsigned int i;
vec <tree> type_binfos = vNULL; auto_vec <tree, 8> type_binfos;
bool possibly_instantiated = type_possibly_instantiated_p (type->type); bool possibly_instantiated = type_possibly_instantiated_p (type->type);
/* We may need to consider types w/o instances because of possible derived /* We may need to consider types w/o instances because of possible derived
...@@ -1868,7 +1868,6 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes, ...@@ -1868,7 +1868,6 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes,
inserted, matched_vtables, inserted, matched_vtables,
type->anonymous_namespace, completep); type->anonymous_namespace, completep);
} }
type_binfos.release ();
for (i = 0; i < type->derived_types.length (); i++) for (i = 0; i < type->derived_types.length (); i++)
possible_polymorphic_call_targets_1 (nodes, inserted, possible_polymorphic_call_targets_1 (nodes, inserted,
matched_vtables, matched_vtables,
...@@ -2226,7 +2225,7 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -2226,7 +2225,7 @@ possible_polymorphic_call_targets (tree otr_type,
{ {
static struct cgraph_node_hook_list *node_removal_hook_holder; static struct cgraph_node_hook_list *node_removal_hook_holder;
vec <cgraph_node *> nodes = vNULL; vec <cgraph_node *> nodes = vNULL;
vec <tree> bases_to_consider = vNULL; auto_vec <tree, 8> bases_to_consider;
odr_type type, outer_type; odr_type type, outer_type;
polymorphic_call_target_d key; polymorphic_call_target_d key;
polymorphic_call_target_d **slot; polymorphic_call_target_d **slot;
...@@ -2521,7 +2520,6 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -2521,7 +2520,6 @@ possible_polymorphic_call_targets (tree otr_type,
} }
} }
bases_to_consider.release();
(*slot)->targets = nodes; (*slot)->targets = nodes;
(*slot)->complete = complete; (*slot)->complete = complete;
if (completep) if (completep)
......
...@@ -1307,6 +1307,7 @@ record_known_type (struct type_change_info *tci, tree type, HOST_WIDE_INT offset ...@@ -1307,6 +1307,7 @@ record_known_type (struct type_change_info *tci, tree type, HOST_WIDE_INT offset
if (type if (type
&& (offset && (offset
|| (TREE_CODE (type) != RECORD_TYPE || (TREE_CODE (type) != RECORD_TYPE
|| !TYPE_BINFO (type)
|| !polymorphic_type_binfo_p (TYPE_BINFO (type))))) || !polymorphic_type_binfo_p (TYPE_BINFO (type)))))
{ {
ipa_polymorphic_call_context context; ipa_polymorphic_call_context context;
......
...@@ -183,7 +183,8 @@ polymorphic_type_binfo_p (const_tree binfo) ...@@ -183,7 +183,8 @@ polymorphic_type_binfo_p (const_tree binfo)
/* See if BINFO's type has an virtual table associtated with it. /* See if BINFO's type has an virtual table associtated with it.
Check is defensive because of Java FE produces BINFOs Check is defensive because of Java FE produces BINFOs
without BINFO_TYPE set. */ without BINFO_TYPE set. */
return BINFO_TYPE (binfo) && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo))); return (BINFO_TYPE (binfo) && TYPE_BINFO (BINFO_TYPE (binfo))
&& BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo))));
} }
#endif /* GCC_IPA_UTILS_H */ #endif /* GCC_IPA_UTILS_H */
......
...@@ -4976,7 +4976,14 @@ free_lang_data_in_type (tree type) ...@@ -4976,7 +4976,14 @@ free_lang_data_in_type (tree type)
TYPE_METHODS (type) = NULL_TREE; TYPE_METHODS (type) = NULL_TREE;
if (TYPE_BINFO (type)) if (TYPE_BINFO (type))
free_lang_data_in_binfo (TYPE_BINFO (type)); {
free_lang_data_in_binfo (TYPE_BINFO (type));
if ((!BINFO_VTABLE (TYPE_BINFO (type))
|| !flag_devirtualize)
&& (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type))
|| debug_info_level != DINFO_LEVEL_NONE))
TYPE_BINFO (type) = NULL;
}
} }
else else
{ {
...@@ -11926,7 +11933,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) ...@@ -11926,7 +11933,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
{ {
if (TREE_CODE (fld) != FIELD_DECL) if (TREE_CODE (fld) != FIELD_DECL || !DECL_ARTIFICIAL (fld))
continue; continue;
pos = int_bit_position (fld); pos = int_bit_position (fld);
...@@ -11937,12 +11944,6 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) ...@@ -11937,12 +11944,6 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
if (!fld || TREE_CODE (TREE_TYPE (fld)) != RECORD_TYPE) if (!fld || TREE_CODE (TREE_TYPE (fld)) != RECORD_TYPE)
return NULL_TREE; return NULL_TREE;
if (!DECL_ARTIFICIAL (fld))
{
binfo = TYPE_BINFO (TREE_TYPE (fld));
if (!binfo)
return NULL_TREE;
}
/* Offset 0 indicates the primary base, whose vtable contents are /* Offset 0 indicates the primary base, whose vtable contents are
represented in the binfo for the derived class. */ represented in the binfo for the derived class. */
else if (offset != 0) else if (offset != 0)
...@@ -11967,6 +11968,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) ...@@ -11967,6 +11968,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
* BITS_PER_UNIT < pos * BITS_PER_UNIT < pos
/* Rule out types with no virtual methods or we can get confused /* Rule out types with no virtual methods or we can get confused
here by zero sized bases. */ here by zero sized bases. */
&& TYPE_BINFO (BINFO_TYPE (base_binfo))
&& BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (base_binfo))) && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (base_binfo)))
&& (!containing_binfo && (!containing_binfo
|| (tree_to_shwi (BINFO_OFFSET (containing_binfo)) || (tree_to_shwi (BINFO_OFFSET (containing_binfo))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment