From: Jason Merrill <jason@redhat.com>
To: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
Cc: Mark Mitchell <mark@codesourcery.com>,
gcc@gcc.gnu.org,
"Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>,
Jakub Jelinek <jakub@redhat.com>,
gcc-patches@gcc.gnu.org
Subject: Re: GCC 3.2
Date: Wed, 31 Jul 2002 02:11:00 -0000 [thread overview]
Message-ID: <wvly9bsk9gg.fsf@prospero.cambridge.redhat.com> (raw)
In-Reply-To: <wvlptx6m7pd.fsf@prospero.cambridge.redhat.com> (Jason Merrill's message of "Tue, 30 Jul 2002 00:32:14 +0100")
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
On Tue, 30 Jul 2002 00:32:14 +0100, Jason Merrill <jason@redhat.com> wrote:
> It's possible that we are copying the tail padding when assigning a C3; I'm
> not seeing that, but am continuing to investigate.
Indeed we are; I needed to specify -malign-double so there would be tail
padding on the x86 for us to handle wrong. :)
> If so, that's a serious bug, but fixing it will not impact the ABI. In
> other words, it can wait for 3.2.1.
This is still true, but I have a preliminary patch for which testing is not
yet complete, which adds a langhook to expr_size. I believe that returning
the unpadded size from expr_size is correct, as expr_size is interested in
the value, not the allocated space. Comments welcome. The other option
was to add another size field to types; a langhook seemed more
space-efficient.
With this patch, the empty class passing hackery can go away, hurrah.
BTW, why do we use stubs for langhook defaults? I would think leaving the
hook entry NULL would be more efficient for languages that are happy with
the default, as a comparison to zero is much cheaper than an indirect
jump...
2002-07-31 Jason Merrill <jason@redhat.com>
* langhooks-def.h (LANG_HOOKS_EXPR_SIZE): New macro.
* langhooks.c (lhd_expr_size): Define default.
* langhooks.h (struct lang_hooks): Add expr_size.
* explow.c (expr_size): Call it.
2002-07-31 Jason Merrill <jason@redhat.com>
* class.c (cp_expr_size): New fn.
* cp-tree.h: Declare it.
* cp-lang.c (LANG_HOOKS_EXPR_SIZE): Define.
* call.c (build_over_call): Lose empty class hackery.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 7470 bytes --]
*** ./cp/class.c.~1~ Tue Jul 30 00:43:54 2002
--- ./cp/class.c Tue Jul 30 17:49:25 2002
*************** build_vtable_entry (delta, vcall_index,
*** 8048,8050 ****
--- 8048,8065 ----
#endif
return entry;
}
+
+ /* Langhook for expr_size: Tell the backend that the value of an expression
+ of non-POD class type does not include any tail padding; a derived class
+ might have allocated something there. */
+
+ tree
+ cp_expr_size (exp)
+ tree exp;
+ {
+ if (CLASS_TYPE_P (TREE_TYPE (exp)))
+ return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
+ else
+ /* Use the default code. */
+ return NULL_TREE;
+ }
*** ./cp/cp-lang.c.~1~ Sun May 26 17:23:43 2002
--- ./cp/cp-lang.c Tue Jul 30 15:41:20 2002
*************** static HOST_WIDE_INT cxx_get_alias_set P
*** 91,96 ****
--- 91,98 ----
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
#undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals
+ #undef LANG_HOOKS_EXPR_SIZE
+ #define LANG_HOOKS_EXPR_SIZE cp_expr_size
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
*** ./cp/cp-tree.h.~1~ Tue Jul 30 00:43:55 2002
--- ./cp/cp-tree.h Tue Jul 30 15:52:07 2002
*************** extern tree get_vtbl_decl_for_binfo
*** 3628,3633 ****
--- 3628,3634 ----
extern tree in_charge_arg_for_name PARAMS ((tree));
extern tree get_vtt_name PARAMS ((tree));
extern tree get_primary_binfo PARAMS ((tree));
+ extern tree cp_expr_size PARAMS ((tree));
/* in cvt.c */
extern tree convert_to_reference PARAMS ((tree, tree, int, int, tree));
*** ./cp/call.c.~1~ Thu May 9 16:55:25 2002
--- ./cp/call.c Tue Jul 30 17:42:58 2002
*************** build_over_call (cand, args, flags)
*** 4298,4312 ****
else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
}
! else if ((!real_lvalue_p (arg)
! || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
! /* Empty classes have padding which can be hidden
! inside an (empty) base of the class. This must not
! be touched as it might overlay things. When the
! gcc core learns about empty classes, we can treat it
! like other classes. */
! && !(is_empty_class (DECL_CONTEXT (fn))
! && TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))))
{
tree address;
tree to = stabilize_reference
--- 4298,4305 ----
else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
}
! else if (!real_lvalue_p (arg)
! || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
{
tree address;
tree to = stabilize_reference
*************** build_over_call (cand, args, flags)
*** 4328,4351 ****
(build_indirect_ref (TREE_VALUE (converted_args), 0));
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
! if (is_empty_class (TREE_TYPE (to)))
! {
! TREE_USED (arg) = 1;
!
! val = build (COMPOUND_EXPR, DECL_CONTEXT (fn), arg, to);
! /* Even though the assignment may not actually result in any
! code being generated, we do not want to warn about the
! assignment having no effect. That would be confusing to
! users who may be performing the assignment as part of a
! generic algorithm, for example.
!
! Ideally, the notions of having side-effects and of being
! useless would be orthogonal. */
! TREE_SIDE_EFFECTS (val) = 1;
! TREE_NO_UNUSED_WARNING (val) = 1;
! }
! else
! val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
return val;
}
--- 4321,4327 ----
(build_indirect_ref (TREE_VALUE (converted_args), 0));
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
! val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
return val;
}
*** ./explow.c.~1~ Sun Mar 17 17:48:49 2002
--- ./explow.c Tue Jul 30 17:36:43 2002
*************** Software Foundation, 59 Temple Place - S
*** 34,39 ****
--- 34,40 ----
#include "insn-config.h"
#include "ggc.h"
#include "recog.h"
+ #include "langhooks.h"
static rtx break_out_memory_refs PARAMS ((rtx));
static void emit_stack_probe PARAMS ((rtx));
*************** rtx
*** 285,294 ****
expr_size (exp)
tree exp;
{
! tree size;
! if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
! && DECL_SIZE_UNIT (exp) != 0)
size = DECL_SIZE_UNIT (exp);
else
size = size_in_bytes (TREE_TYPE (exp));
--- 286,297 ----
expr_size (exp)
tree exp;
{
! tree size = (*lang_hooks.expr_size) (exp);
! if (size)
! /* The frontend specified a size. */;
! else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
! && DECL_SIZE_UNIT (exp) != 0)
size = DECL_SIZE_UNIT (exp);
else
size = size_in_bytes (TREE_TYPE (exp));
*************** expr_size (exp)
*** 298,304 ****
size = build (WITH_RECORD_EXPR, sizetype, size, exp);
return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
-
}
\f
/* Return a copy of X in which all memory references
--- 301,306 ----
*** ./langhooks.h.~1~ Sun May 26 17:22:52 2002
--- ./langhooks.h Tue Jul 30 17:41:11 2002
*************** struct lang_hooks
*** 156,161 ****
--- 156,165 ----
warning that the front end does not use such a parser. */
void (*set_yydebug) PARAMS ((int));
+ /* Called from expr_size to calculate the size of the value of an
+ expression in a language-dependent way. */
+ tree (*expr_size) PARAMS ((tree));
+
struct lang_hooks_for_tree_inlining tree_inlining;
struct lang_hooks_for_tree_dump tree_dump;
*** ./langhooks-def.h.~1~ Sun May 26 17:22:51 2002
--- ./langhooks-def.h Tue Jul 30 16:02:44 2002
*************** extern int lhd_staticp PARAMS ((tree));
*** 48,53 ****
--- 48,54 ----
extern void lhd_clear_binding_stack PARAMS ((void));
extern void lhd_print_tree_nothing PARAMS ((FILE *, tree, int));
extern void lhd_set_yydebug PARAMS ((int));
+ extern tree lhd_expr_size PARAMS ((tree));
/* Declarations of default tree inlining hooks. */
tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *,
*************** tree lhd_tree_inlining_convert_parm_for_
*** 85,90 ****
--- 86,92 ----
#define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing
#define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing
#define LANG_HOOKS_SET_YYDEBUG lhd_set_yydebug
+ #define LANG_HOOKS_EXPR_SIZE lhd_expr_size
/* Tree inlining hooks. */
#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
*************** int lhd_tree_dump_type_quals PARAMS ((
*** 156,161 ****
--- 158,164 ----
LANG_HOOKS_PRINT_TYPE, \
LANG_HOOKS_PRINT_IDENTIFIER, \
LANG_HOOKS_SET_YYDEBUG, \
+ LANG_HOOKS_EXPR_SIZE, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_TREE_DUMP_INITIALIZER \
}
*** ./langhooks.c.~1~ Wed Apr 3 20:59:05 2002
--- ./langhooks.c Tue Jul 30 17:40:03 2002
*************** lhd_tree_dump_type_quals (t)
*** 303,305 ****
--- 303,314 ----
return TYPE_QUALS (t);
}
+ /* lang_hooks.expr_size: Determine the size of the value of an expression T
+ in a language-specific way. */
+
+ tree
+ lhd_expr_size (t)
+ tree t ATTRIBUTE_UNUSED;
+ {
+ return NULL_TREE;
+ }
next prev parent reply other threads:[~2002-07-31 0:49 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-27 1:01 Mark Mitchell
2002-07-27 1:28 ` Joe Buck
2002-07-27 1:30 ` Mark Mitchell
2002-07-27 3:30 ` Zack Weinberg
2002-07-29 4:26 ` Mark Mitchell
2002-07-29 5:00 ` Toon Moene
2002-07-27 16:26 ` Franz Sirl
2002-07-27 18:32 ` Jakub Jelinek
2002-07-30 6:49 ` Jason Merrill
2002-07-31 2:11 ` Jason Merrill [this message]
2002-07-31 5:05 ` Jason Merrill
2002-07-31 6:35 ` Neil Booth
2002-07-31 7:14 ` Neil Booth
2002-08-04 10:08 ` Joseph S. Myers
2002-07-31 10:45 ` Mark Mitchell
2002-08-01 14:42 ` Jason Merrill
2002-08-02 4:58 ` PATCH to avoid copying tail padding (was: GCC 3.2) Jason Merrill
2002-08-12 8:47 ` GCC 3.2 Jeff Law
2002-08-12 11:52 ` Jakub Jelinek
2002-08-12 13:14 ` Vladimir Makarov
2002-08-12 13:28 ` Jeff Law
2002-08-12 13:30 ` Jakub Jelinek
2002-08-12 16:42 ` Janis Johnson
2002-08-13 9:46 ` Jeff Law
2002-08-19 11:41 ` Phil Edwards
2002-08-20 21:38 ` Benjamin Kosnik
2002-08-21 4:31 ` Kevin B. Hendricks
2002-08-21 9:56 ` Benjamin Kosnik
2002-08-21 10:24 ` Kevin B. Hendricks
2002-08-21 11:24 ` Janis Johnson
2002-08-21 12:02 ` Phil Edwards
2002-08-21 14:53 ` Janis Johnson
2002-08-21 20:03 ` Benjamin Kosnik
2002-07-27 22:19 Benjamin Kosnik
2002-07-28 9:40 ` Jakub Jelinek
[not found] <Pine.LNX.4.33.0208041756450.30248-100000@kern.srcf.societies.cam.ac.uk>
2002-08-04 10:24 ` Gerald Pfeifer
2002-08-12 19:05 Benjamin Kosnik
2002-10-18 17:23 gcc 3.2 Udo Tremel
2002-10-18 18:08 ` Mike Stump
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wvly9bsk9gg.fsf@prospero.cambridge.redhat.com \
--to=jason@redhat.com \
--cc=Franz.Sirl-kernel@lauterbach.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=kevin.hendricks@sympatico.ca \
--cc=mark@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).