Commit 030cfa22 by Nathan Sidwell

Remove lang_type_ptrmem.

	cp/
	Remove lang_type_ptrmem.
	* cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
	into ...
	(lang_type_class): ... this.  Reorder bitfields.  Rename to ...
	(lang_type): ... this.  Delete old definition.
	(lang_type_ptrmem): Delete.
	(LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC.  Adjust
	uses.
	(LANG_TYPE_PTRMEM_CHECK): Delete.
	(TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
	(TYPE_PTRMEMFUNC_TYPE): New.  Use TYPE_LANG_SLOT_1.
	* decl.c (build_ptrmemfunc_type): Adjust.
	* lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
	(maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.

	objcp/
	* objcp-decl.h (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Use lang_type.
	(ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use it.  Don't set
	u.c.h.is_lang_type_class.

From-SVN: r248826
parent 9186a9d3
...@@ -6025,7 +6025,7 @@ check_bases_and_members (tree t) ...@@ -6025,7 +6025,7 @@ check_bases_and_members (tree t)
/* Figure out whether or not we will need a cookie when dynamically /* Figure out whether or not we will need a cookie when dynamically
allocating an array of this type. */ allocating an array of this type. */
TYPE_LANG_SPECIFIC (t)->u.c.vec_new_uses_cookie LANG_TYPE_CLASS_CHECK (t)->vec_new_uses_cookie
= type_requires_array_cookie (t); = type_requires_array_cookie (t);
} }
......
...@@ -460,6 +460,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; ...@@ -460,6 +460,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
TYPE_LANG_SLOT_1 TYPE_LANG_SLOT_1
For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
For a POINTER_TYPE (to a METHOD_TYPE), this is TYPE_PTRMEMFUNC_TYPE
BINFO_VIRTUALS BINFO_VIRTUALS
For a binfo, this is a TREE_LIST. There is an entry for each For a binfo, this is a TREE_LIST. There is an entry for each
...@@ -1849,22 +1850,6 @@ struct GTY (()) tree_pair_s { ...@@ -1849,22 +1850,6 @@ struct GTY (()) tree_pair_s {
}; };
typedef tree_pair_s *tree_pair_p; typedef tree_pair_s *tree_pair_p;
/* This is a few header flags for 'struct lang_type'. Actually,
all but the first are used only for lang_type_class; they
are put in this structure to save space. */
struct GTY(()) lang_type_header {
BOOL_BITFIELD is_lang_type_class : 1;
BOOL_BITFIELD has_type_conversion : 1;
BOOL_BITFIELD has_copy_ctor : 1;
BOOL_BITFIELD has_default_ctor : 1;
BOOL_BITFIELD const_needs_init : 1;
BOOL_BITFIELD ref_needs_init : 1;
BOOL_BITFIELD has_const_copy_assign : 1;
BOOL_BITFIELD spare : 1;
};
/* This structure provides additional information above and beyond /* This structure provides additional information above and beyond
what is provide in the ordinary tree_type. In the past, we used it what is provide in the ordinary tree_type. In the past, we used it
for the types of class types, template parameters types, typename for the types of class types, template parameters types, typename
...@@ -1878,11 +1863,17 @@ struct GTY(()) lang_type_header { ...@@ -1878,11 +1863,17 @@ struct GTY(()) lang_type_header {
many (i.e., thousands) of classes can easily be generated. many (i.e., thousands) of classes can easily be generated.
Therefore, we should endeavor to keep the size of this structure to Therefore, we should endeavor to keep the size of this structure to
a minimum. */ a minimum. */
struct GTY(()) lang_type_class { struct GTY(()) lang_type {
struct lang_type_header h;
unsigned char align; unsigned char align;
unsigned has_type_conversion : 1;
unsigned has_copy_ctor : 1;
unsigned has_default_ctor : 1;
unsigned const_needs_init : 1;
unsigned ref_needs_init : 1;
unsigned has_const_copy_assign : 1;
unsigned use_template : 2;
unsigned has_mutable : 1; unsigned has_mutable : 1;
unsigned com_interface : 1; unsigned com_interface : 1;
unsigned non_pod_class : 1; unsigned non_pod_class : 1;
...@@ -1899,6 +1890,7 @@ struct GTY(()) lang_type_class { ...@@ -1899,6 +1890,7 @@ struct GTY(()) lang_type_class {
unsigned anon_aggr : 1; unsigned anon_aggr : 1;
unsigned non_zero_init : 1; unsigned non_zero_init : 1;
unsigned empty_p : 1; unsigned empty_p : 1;
/* 32 bits allocated. */
unsigned vec_new_uses_cookie : 1; unsigned vec_new_uses_cookie : 1;
unsigned declared_class : 1; unsigned declared_class : 1;
...@@ -1909,25 +1901,24 @@ struct GTY(()) lang_type_class { ...@@ -1909,25 +1901,24 @@ struct GTY(()) lang_type_class {
unsigned fields_readonly : 1; unsigned fields_readonly : 1;
unsigned ptrmemfunc_flag : 1; unsigned ptrmemfunc_flag : 1;
unsigned use_template : 2;
unsigned was_anonymous : 1; unsigned was_anonymous : 1;
unsigned lazy_default_ctor : 1; unsigned lazy_default_ctor : 1;
unsigned lazy_copy_ctor : 1; unsigned lazy_copy_ctor : 1;
unsigned lazy_copy_assign : 1; unsigned lazy_copy_assign : 1;
unsigned lazy_destructor : 1; unsigned lazy_destructor : 1;
unsigned has_const_copy_ctor : 1; unsigned has_const_copy_ctor : 1;
unsigned has_complex_copy_ctor : 1; unsigned has_complex_copy_ctor : 1;
unsigned has_complex_copy_assign : 1; unsigned has_complex_copy_assign : 1;
unsigned non_aggregate : 1; unsigned non_aggregate : 1;
unsigned has_complex_dflt : 1; unsigned has_complex_dflt : 1;
unsigned has_list_ctor : 1; unsigned has_list_ctor : 1;
unsigned non_std_layout : 1; unsigned non_std_layout : 1;
unsigned is_literal : 1; unsigned is_literal : 1;
unsigned lazy_move_ctor : 1; unsigned lazy_move_ctor : 1;
unsigned lazy_move_assign : 1; unsigned lazy_move_assign : 1;
unsigned has_complex_move_ctor : 1; unsigned has_complex_move_ctor : 1;
unsigned has_complex_move_assign : 1; unsigned has_complex_move_assign : 1;
unsigned has_constexpr_ctor : 1; unsigned has_constexpr_ctor : 1;
unsigned unique_obj_representations : 1; unsigned unique_obj_representations : 1;
...@@ -1940,7 +1931,7 @@ struct GTY(()) lang_type_class { ...@@ -1940,7 +1931,7 @@ struct GTY(()) lang_type_class {
/* There are some bits left to fill out a 32-bit word. Keep track /* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or of this by updating the size of this bitfield whenever you add or
remove a flag. */ remove a flag. */
unsigned dummy : 2; unsigned dummy : 4;
tree primary_base; tree primary_base;
vec<tree_pair_s, va_gc> *vcall_indices; vec<tree_pair_s, va_gc> *vcall_indices;
...@@ -1968,40 +1959,9 @@ struct GTY(()) lang_type_class { ...@@ -1968,40 +1959,9 @@ struct GTY(()) lang_type_class {
tree lambda_expr; tree lambda_expr;
}; };
struct GTY(()) lang_type_ptrmem { /* We used to have a variant type for lang_type. Keep the name of the
struct lang_type_header h; checking accessor for the sole survivor. */
tree record; #define LANG_TYPE_CLASS_CHECK(NODE) (TYPE_LANG_SPECIFIC (NODE))
};
struct GTY(()) lang_type {
union lang_type_u
{
struct lang_type_header GTY((skip (""))) h;
struct lang_type_class GTY((tag ("1"))) c;
struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
} GTY((desc ("%h.h.is_lang_type_class"))) u;
};
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (! lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.c; })
#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.ptrmem; })
#else
#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
#endif /* ENABLE_TREE_CHECKING */
/* Nonzero for _CLASSTYPE means that operator delete is defined. */ /* Nonzero for _CLASSTYPE means that operator delete is defined. */
#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete) #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
...@@ -2016,7 +1976,7 @@ struct GTY(()) lang_type { ...@@ -2016,7 +1976,7 @@ struct GTY(()) lang_type {
/* Nonzero means that this _CLASSTYPE node defines ways of converting /* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */ itself to other types. */
#define TYPE_HAS_CONVERSION(NODE) \ #define TYPE_HAS_CONVERSION(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion) (LANG_TYPE_CLASS_CHECK (NODE)->has_type_conversion)
/* Nonzero means that NODE (a class type) has a default constructor -- /* Nonzero means that NODE (a class type) has a default constructor --
but that it has not yet been declared. */ but that it has not yet been declared. */
...@@ -2059,10 +2019,10 @@ struct GTY(()) lang_type { ...@@ -2059,10 +2019,10 @@ struct GTY(()) lang_type {
/* True iff the class type NODE has an "operator =" whose parameter /* True iff the class type NODE has an "operator =" whose parameter
has a parameter of type "const X&". */ has a parameter of type "const X&". */
#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \ #define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign) (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_assign)
/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor) #define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_ctor)
#define TYPE_HAS_CONST_COPY_CTOR(NODE) \ #define TYPE_HAS_CONST_COPY_CTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor) (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor)
...@@ -2214,7 +2174,7 @@ struct GTY(()) lang_type { ...@@ -2214,7 +2174,7 @@ struct GTY(()) lang_type {
/* Nonzero means that this type has an X() constructor. */ /* Nonzero means that this type has an X() constructor. */
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \ #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor) (LANG_TYPE_CLASS_CHECK (NODE)->has_default_ctor)
/* Nonzero means that this type contains a mutable member. */ /* Nonzero means that this type contains a mutable member. */
#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable) #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
...@@ -2283,17 +2243,17 @@ struct GTY(()) lang_type { ...@@ -2283,17 +2243,17 @@ struct GTY(()) lang_type {
which have no specified initialization. */ which have no specified initialization. */
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \ #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
(TYPE_LANG_SPECIFIC (NODE) \ (TYPE_LANG_SPECIFIC (NODE) \
? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0) ? LANG_TYPE_CLASS_CHECK (NODE)->const_needs_init : 0)
#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \ #define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE)) (LANG_TYPE_CLASS_CHECK (NODE)->const_needs_init = (VALUE))
/* Nonzero if this class has ref members /* Nonzero if this class has ref members
which have no specified initialization. */ which have no specified initialization. */
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \ #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
(TYPE_LANG_SPECIFIC (NODE) \ (TYPE_LANG_SPECIFIC (NODE) \
? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0) ? LANG_TYPE_CLASS_CHECK (NODE)->ref_needs_init : 0)
#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \ #define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE)) (LANG_TYPE_CLASS_CHECK (NODE)->ref_needs_init = (VALUE))
/* Nonzero if this class is included from a header file which employs /* Nonzero if this class is included from a header file which employs
`#pragma interface', and it is not included in its implementation file. */ `#pragma interface', and it is not included in its implementation file. */
...@@ -4296,21 +4256,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) ...@@ -4296,21 +4256,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \ #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
/* These are use to manipulate the canonical RECORD_TYPE from the /* The canonical internal RECORD_TYPE from the POINTER_TYPE to
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ METHOD_TYPE. */
#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \ #define TYPE_PTRMEMFUNC_TYPE(NODE) \
(TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL) TYPE_LANG_SLOT_1 (NODE)
#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
do { \
if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
{ \
TYPE_LANG_SPECIFIC (NODE) \
= (struct lang_type *) ggc_internal_cleared_alloc \
(sizeof (struct lang_type_ptrmem)); \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
} \
TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
} while (0)
/* For a pointer-to-member type of the form `T X::*', this is `X'. /* For a pointer-to-member type of the form `T X::*', this is `X'.
For a type like `void (X::*)() const', this type is `X', not `const For a type like `void (X::*)() const', this type is `X', not `const
......
...@@ -9154,7 +9154,9 @@ build_ptrmemfunc_type (tree type) ...@@ -9154,7 +9154,9 @@ build_ptrmemfunc_type (tree type)
this method instead of type_hash_canon, because it only does a this method instead of type_hash_canon, because it only does a
simple equality check on the list of field members. */ simple equality check on the list of field members. */
if ((t = TYPE_GET_PTRMEMFUNC_TYPE (type)))
t = TYPE_PTRMEMFUNC_TYPE (type);
if (t)
return t; return t;
t = make_node (RECORD_TYPE); t = make_node (RECORD_TYPE);
...@@ -9178,7 +9180,7 @@ build_ptrmemfunc_type (tree type) ...@@ -9178,7 +9180,7 @@ build_ptrmemfunc_type (tree type)
/* Cache this pointer-to-member type so that we can find it again /* Cache this pointer-to-member type so that we can find it again
later. */ later. */
TYPE_SET_PTRMEMFUNC_TYPE (type, t); TYPE_PTRMEMFUNC_TYPE (type) = t;
if (TYPE_STRUCTURAL_EQUALITY_P (type)) if (TYPE_STRUCTURAL_EQUALITY_P (type))
SET_TYPE_STRUCTURAL_EQUALITY (t); SET_TYPE_STRUCTURAL_EQUALITY (t);
......
...@@ -678,24 +678,19 @@ copy_decl (tree decl MEM_STAT_DECL) ...@@ -678,24 +678,19 @@ copy_decl (tree decl MEM_STAT_DECL)
static void static void
copy_lang_type (tree node) copy_lang_type (tree node)
{ {
int size;
struct lang_type *lt;
if (! TYPE_LANG_SPECIFIC (node)) if (! TYPE_LANG_SPECIFIC (node))
return; return;
if (TYPE_LANG_SPECIFIC (node)->u.h.is_lang_type_class) struct lang_type *lt
size = sizeof (struct lang_type); = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type));
else
size = sizeof (struct lang_type_ptrmem); memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type)));
lt = (struct lang_type *) ggc_internal_alloc (size);
memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
TYPE_LANG_SPECIFIC (node) = lt; TYPE_LANG_SPECIFIC (node) = lt;
if (GATHER_STATISTICS) if (GATHER_STATISTICS)
{ {
tree_node_counts[(int)lang_type] += 1; tree_node_counts[(int)lang_type] += 1;
tree_node_sizes[(int)lang_type] += size; tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
} }
} }
...@@ -720,12 +715,9 @@ maybe_add_lang_type_raw (tree t) ...@@ -720,12 +715,9 @@ maybe_add_lang_type_raw (tree t)
|| TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM); || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM);
if (add) if (add)
{ {
struct lang_type *pi TYPE_LANG_SPECIFIC (t)
= (struct lang_type *) ggc_internal_cleared_alloc = (struct lang_type *) (ggc_internal_cleared_alloc
(sizeof (struct lang_type)); (sizeof (struct lang_type)));
TYPE_LANG_SPECIFIC (t) = pi;
pi->u.c.h.is_lang_type_class = 1;
if (GATHER_STATISTICS) if (GATHER_STATISTICS)
{ {
......
...@@ -62,14 +62,11 @@ extern tree objcp_end_compound_stmt (tree, int); ...@@ -62,14 +62,11 @@ extern tree objcp_end_compound_stmt (tree, int);
#undef TYPE_OBJC_INFO #undef TYPE_OBJC_INFO
#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info #define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
#undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC #undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC
#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type_class) #define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type)
#undef ALLOC_OBJC_TYPE_LANG_SPECIFIC #undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \ #define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \
do { \ (TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *) \
TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *) \ ggc_internal_cleared_alloc (SIZEOF_OBJC_TYPE_LANG_SPECIFIC))
ggc_internal_cleared_alloc (sizeof (struct lang_type_class)); \
TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1; \
} while (0)
#define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args #define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args
......
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