Commit c1fffdf1 by Christian Bruel Committed by Christian Bruel

function.h (MINIMUM_METHOD_BOUNDARY): New macro.

2015-10-26  Christian Bruel  <christian.bruel@st.com>

	* function.h (MINIMUM_METHOD_BOUNDARY): New macro.
	* cp/decl.c (grokfndecl): Set DECL_ALIGN with MINIMUM_METHOD_BOUNDARY.
	* cp/method.c (implicitly_declare_fn): Likewise.
	* cp/lambda.c (maybe_add_lambda_conv_op): Likewise. Remove VBIT setting.
	* java/class.c (add_method_1): Likewise.

From-SVN: r229313
parent 5929c659
2015-10-26 Christian Bruel <christian.bruel@st.com>
* function.h (MINIMUM_METHOD_BOUNDARY): New macro.
* cp/decl.c (grokfndecl): Set DECL_ALIGN with MINIMUM_METHOD_BOUNDARY.
* cp/method.c (implicitly_declare_fn): Likewise.
* cp/lambda.c (maybe_add_lambda_conv_op): Likewise. Remove VBIT setting.
* java/class.c (add_method_1): Likewise.
2015-10-26 Richard Biener <rguenther@suse.de> 2015-10-26 Richard Biener <rguenther@suse.de>
* alloc-pool.h (base_pool_allocator): Use placement new. * alloc-pool.h (base_pool_allocator): Use placement new.
...@@ -7829,6 +7829,9 @@ grokfndecl (tree ctype, ...@@ -7829,6 +7829,9 @@ grokfndecl (tree ctype,
parm = build_this_parm (type, quals); parm = build_this_parm (type, quals);
DECL_CHAIN (parm) = parms; DECL_CHAIN (parm) = parms;
parms = parm; parms = parm;
/* Allocate space to hold the vptr bit if needed. */
DECL_ALIGN (decl) = MINIMUM_METHOD_BOUNDARY;
} }
DECL_ARGUMENTS (decl) = parms; DECL_ARGUMENTS (decl) = parms;
for (t = parms; t; t = DECL_CHAIN (t)) for (t = parms; t; t = DECL_CHAIN (t))
...@@ -7852,14 +7855,6 @@ grokfndecl (tree ctype, ...@@ -7852,14 +7855,6 @@ grokfndecl (tree ctype,
break; break;
} }
/* If pointers to member functions use the least significant bit to
indicate whether a function is virtual, ensure a pointer
to this function will have that bit clear. */
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& TREE_CODE (type) == METHOD_TYPE
&& DECL_ALIGN (decl) < 2 * BITS_PER_UNIT)
DECL_ALIGN (decl) = 2 * BITS_PER_UNIT;
if (friendp if (friendp
&& TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{ {
......
...@@ -1006,11 +1006,7 @@ maybe_add_lambda_conv_op (tree type) ...@@ -1006,11 +1006,7 @@ maybe_add_lambda_conv_op (tree type)
tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype); tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype);
tree fn = convfn; tree fn = convfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop); DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
DECL_ALIGN (fn) = MINIMUM_METHOD_BOUNDARY;
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& DECL_ALIGN (fn) < 2 * BITS_PER_UNIT)
DECL_ALIGN (fn) = 2 * BITS_PER_UNIT;
SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR); SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR);
grokclassfn (type, fn, NO_SPECIAL); grokclassfn (type, fn, NO_SPECIAL);
set_linkage_according_to_type (type, fn); set_linkage_according_to_type (type, fn);
...@@ -1042,9 +1038,6 @@ maybe_add_lambda_conv_op (tree type) ...@@ -1042,9 +1038,6 @@ maybe_add_lambda_conv_op (tree type)
tree statfn = build_lang_decl (FUNCTION_DECL, name, stattype); tree statfn = build_lang_decl (FUNCTION_DECL, name, stattype);
fn = statfn; fn = statfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop); DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& DECL_ALIGN (fn) < 2 * BITS_PER_UNIT)
DECL_ALIGN (fn) = 2 * BITS_PER_UNIT;
grokclassfn (type, fn, NO_SPECIAL); grokclassfn (type, fn, NO_SPECIAL);
set_linkage_according_to_type (type, fn); set_linkage_according_to_type (type, fn);
rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof); rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
......
...@@ -1849,13 +1849,8 @@ implicitly_declare_fn (special_function_kind kind, tree type, ...@@ -1849,13 +1849,8 @@ implicitly_declare_fn (special_function_kind kind, tree type,
DECL_ASSIGNMENT_OPERATOR_P (fn) = 1; DECL_ASSIGNMENT_OPERATOR_P (fn) = 1;
SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR); SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR);
} }
/* If pointers to member functions use the least significant bit to DECL_ALIGN (fn) = MINIMUM_METHOD_BOUNDARY;
indicate whether a function is virtual, ensure a pointer
to this function will have that bit clear. */
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& DECL_ALIGN (fn) < 2 * BITS_PER_UNIT)
DECL_ALIGN (fn) = 2 * BITS_PER_UNIT;
/* Create the explicit arguments. */ /* Create the explicit arguments. */
if (rhs_parm_type) if (rhs_parm_type)
......
...@@ -537,6 +537,13 @@ do { \ ...@@ -537,6 +537,13 @@ do { \
#define ASLK_REDUCE_ALIGN 1 #define ASLK_REDUCE_ALIGN 1
#define ASLK_RECORD_PAD 2 #define ASLK_RECORD_PAD 2
/* If pointers to member functions use the least significant bit to
indicate whether a function is virtual, ensure a pointer
to this function will have that bit clear. */
#define MINIMUM_METHOD_BOUNDARY \
((TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn) \
? MAX (FUNCTION_BOUNDARY, 2 * BITS_PER_UNIT) : FUNCTION_BOUNDARY)
extern void push_function_context (void); extern void push_function_context (void);
......
...@@ -779,13 +779,8 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type) ...@@ -779,13 +779,8 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
DECL_CHAIN (fndecl) = TYPE_METHODS (this_class); DECL_CHAIN (fndecl) = TYPE_METHODS (this_class);
TYPE_METHODS (this_class) = fndecl; TYPE_METHODS (this_class) = fndecl;
/* If pointers to member functions use the least significant bit to if (!(access_flags & ACC_STATIC))
indicate whether a function is virtual, ensure a pointer DECL_ALIGN (fndecl) = MINIMUM_METHOD_BOUNDARY;
to this function will have that bit clear. */
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& !(access_flags & ACC_STATIC)
&& DECL_ALIGN (fndecl) < 2 * BITS_PER_UNIT)
DECL_ALIGN (fndecl) = 2 * BITS_PER_UNIT;
/* Notice that this is a finalizer and update the class type /* Notice that this is a finalizer and update the class type
accordingly. This is used to optimize instance allocation. */ accordingly. This is used to optimize instance allocation. */
......
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