public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re:  rli->unpadded_align
@ 2003-03-26 15:29 Richard Kenner
  2003-03-26 17:52 ` rli->unpadded_align Jason Merrill
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Kenner @ 2003-03-26 15:29 UTC (permalink / raw)
  To: jason; +Cc: gcc

    I don't understand the purpose of this field.  It seems to be the same as
    rli->record_align, except that it skips the effects of
    BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN.  Is that actually the
    intention?  If so, why?

Yes, because of desires to be able to lay out records differently for Ada.

    gnat_adjust_rli seems to only use it for TYPE_PACKED records, for which
    field alignments will pretty much all be 1 anyway, right?

No.  stor-layout.c will use the natural alignment if it won't cost anything
in size, for example.

    Hmm, looking at the ada frontend, it seems that you always set
    DECL_ALIGN to TYPE_ALIGN, and rely on layout_decl to reduce the
    alignment as appropriate.  But that shouldn't make any difference to
    rli->unpadded_align; it will still be reflected in DECL_ALIGN.

I'm not 100% certain at this time that this field is actually still used:
that code has changed around a number of times.  I need to spend some time
in the next month or so taking another look at various alignment issues
here and will be reviewing this code at that time.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rli->unpadded_align
  2003-03-26 15:29 rli->unpadded_align Richard Kenner
@ 2003-03-26 17:52 ` Jason Merrill
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2003-03-26 17:52 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc, Jason Merrill

On Wed, 26 Mar 03 10:02:07 EST, kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote:

>     I don't understand the purpose of this field.  It seems to be the same as
>     rli->record_align, except that it skips the effects of
>     BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN.  Is that actually the
>     intention?  If so, why?
>
> Yes, because of desires to be able to lay out records differently for Ada.

Differently how?

>     Hmm, looking at the ada frontend, it seems that you always set
>     DECL_ALIGN to TYPE_ALIGN, and rely on layout_decl to reduce the
>     alignment as appropriate.  But that shouldn't make any difference to
>     rli->unpadded_align; it will still be reflected in DECL_ALIGN.
>
> I'm not 100% certain at this time that this field is actually still used:
> that code has changed around a number of times.  I need to spend some time
> in the next month or so taking another look at various alignment issues
> here and will be reviewing this code at that time.

I'm reviewing it right now; I'm trying to move all the code for determining
the alignment of a field into layout_decl so that the value of DECL_ALIGN
actually reflects the field alignment.  But that looks like it will change
the value of rli->unpadded_align, and I'd like to know how (if) I need to
adjust the code to accomodate Ada.

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rli->unpadded_align
  2003-03-26 18:52 rli->unpadded_align Richard Kenner
@ 2003-03-26 19:00 ` Jason Merrill
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2003-03-26 19:00 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

On Wed, 26 Mar 03 12:29:50 EST, kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote:

>     > Yes, because of desires to be able to lay out records differently for
>     > Ada.
>
>     Differently how?
>
> I *believe*, but am not 100% certain, that the issue is that C will round a
> record's size up to a multiple of its alignment, but Ada can know the actual
> "size" of the record, but it's been a while.

OK.  It seems like that rounding is done in finalize_record_size, which is
called after lang_adjust_rli.  So to avoid that rounding you need to reduce
TYPE_ALIGN for the record.  It doesn't seem to me that rli->unpadded_align
as currently set would be any more useful for this purpose than
rli->record_align.

> Right now, I'd say to do whatever is simplest.  I'm not sure that the
> current code for Ada is either needed or correct.

I'll go ahead and remove unpadded_align for now, thanks.

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rli->unpadded_align
@ 2003-03-26 18:52 Richard Kenner
  2003-03-26 19:00 ` rli->unpadded_align Jason Merrill
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Kenner @ 2003-03-26 18:52 UTC (permalink / raw)
  To: jason; +Cc: gcc

    > Yes, because of desires to be able to lay out records differently for
    > Ada.

    Differently how?

I *believe*, but am not 100% certain, that the issue is that C will round a
record's size up to a multiple of its alignment, but Ada can know the actual
"size" of the record, but it's been a while.

    I'm reviewing it right now; I'm trying to move all the code for
    determining the alignment of a field into layout_decl so that the
    value of DECL_ALIGN actually reflects the field alignment.  But that
    looks like it will change the value of rli->unpadded_align, and I'd
    like to know how (if) I need to adjust the code to accomodate Ada.

Right now, I'd say to do whatever is simplest.  I'm not sure that the
current code for Ada is either needed or correct.  We're starting to
set up to run Ada tests on the HEAD branch and we'll see from those runs
if anything is broken.  If it is, we'll know what it was for!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* rli->unpadded_align
@ 2003-03-26  7:05 Jason Merrill
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2003-03-26  7:05 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc, Jason Merrill

I don't understand the purpose of this field.  It seems to be the same as
rli->record_align, except that it skips the effects of
BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN.  Is that actually the
intention?  If so, why?

gnat_adjust_rli seems to only use it for TYPE_PACKED records, for which
field alignments will pretty much all be 1 anyway, right?  Hmm, looking at
the ada frontend, it seems that you always set DECL_ALIGN to TYPE_ALIGN,
and rely on layout_decl to reduce the alignment as appropriate.  But that
shouldn't make any difference to rli->unpadded_align; it will still be
reflected in DECL_ALIGN.

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-26 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-26 15:29 rli->unpadded_align Richard Kenner
2003-03-26 17:52 ` rli->unpadded_align Jason Merrill
  -- strict thread matches above, loose matches on Subject: below --
2003-03-26 18:52 rli->unpadded_align Richard Kenner
2003-03-26 19:00 ` rli->unpadded_align Jason Merrill
2003-03-26  7:05 rli->unpadded_align Jason Merrill

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).