qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit


From: li guang
Subject: Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit
Date: Mon, 10 Jun 2013 08:56:18 +0800

在 2013-06-06四的 05:48 -0700,Richard Henderson写道:
> On 06/05/2013 05:28 PM, li guang wrote:
> > 在 2013-06-05三的 05:49 -0700,Richard Henderson写道:
> >> On 06/04/2013 06:56 PM, li guang wrote:
> >>>>> +typedef struct {
> >>>>> +    uint32_t len __attribute__((aligned((sizeof(void *)))));
> >>>>> +    uint32_t cie_offset;
> >>>>> +    tcg_target_long func_start __attribute__((packed));
> >>>>> +    tcg_target_long func_len __attribute__((packed));
> >>> suspicious usage of packed attribute here,
> >>> since tcg_targe_long is either 32 or 64 bits,
> >>> not a struct or union.
> >>>
> >>> Thanks!
> >>>
> >>
> >> Your question is worded poorly -- what has struct/union got to do with it? 
> >>  One
> >> can adjust the alignment of any type.  Perhaps you don't know what it is 
> >> that
> >> __attribute__((packed)) actually does?
> > 
> > referred from gcc manual:
> > "This attribute, attached to struct or union type definition, specifies
> > that each member (other than zero-width bitfields) of the structure or
> > union is placed to minimize the memory required."
> > 
> > so, what I mean is as the manual said, this attribute mostly applies to
> > struct or union.
> 
> >From the gcc manual:
> 
> @cindex @code{packed} attribute
> The @code{packed} attribute specifies that a variable or structure field
> should have the smallest possible alignment---one byte for a variable,
> and one bit for a field, unless you specify a larger value with the
> @code{aligned} attribute.
> 
> Notice "or structure field", which is exactly what I have above.
> 
> > forgive me if the question is fool,
> > packed means seize minimal memory size, right?
> 
> It really means minimal alignment.  Which means that no padding will be added
> to ensure alignment.  Which can lead to a reduction in memory size, but that's
> not the major point.
> 
> 

right, Thanks!






reply via email to

[Prev in Thread] Current Thread [Next in Thread]