Re: ggc_alloc_rtvec_sized allocates spaces more than necessary?
On Tue, Aug 16, 2011 at 1:51 PM, Laurynas Biveinis wrote: >> On Mon, Aug 15, 2011 at 2:16 PM, 王亮 wrote: >>> The size it allocates is >>> >>> (sizeof (struct rtvec_def) + ((NELT) - 1)) * sizeof (rtx) > >>> Originally, the allocated size is >>> >>> sizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx) > > Yes, this is correct, good catch. > >>> (sizeof (struct rtvec_def) + sizeof (rtx) - 1) / sizeof (rtx) + >>> ((NELT) - 1) // (3) > > Due to the way those macros expand, right now replacing the first arg > with "1" and the second one with straightforward "sizeof (struct > rtvec_def) + ((NELT) - 1) * sizeof (rtx)" will work and will be easier > to read than division. Liang, would you submit such patch? Yes, I have sent patch to gcc-patches. > > Thanks again, > -- > Laurynas >
misleading description in vec.h?
Hi, Here is comment from line 36, gcc/vec.h Both the structure object and pointer variants pass pointers to objects around -- in the former case the pointers are stored into the vector and in the latter case the pointers are dereferenced and the objects copied into the vector. But by reading implementation, it seems that this description is reverse. I think that it should be something like in the *latter* case the pointers are stored into the vector and in the *former* case the pointers are dereferenced and the objects copied into the vector. That is, the pointers in structure object variant are dereferenced and the objects copied into the vector. Am I missing something? Thanks, Liang.
Re: misleading description in vec.h?
On Tue, Sep 27, 2011 at 12:27 AM, Ian Lance Taylor wrote: > Liang Wang writes: > >> Here is comment from line 36, gcc/vec.h >> >> Both the structure object and pointer variants >> pass pointers to objects around -- in the former case the pointers >> are stored into the vector and in the latter case the pointers are >> dereferenced and the objects copied into the vector. >> >> But by reading implementation, it seems that this description is reverse. >> I think that it should be something like >> >> in the *latter* case the pointers >> are stored into the vector and in the *former* case the pointers are >> dereferenced and the objects copied into the vector. >> >> That is, the pointers in structure object variant are dereferenced and >> the objects copied into the vector. > > I think you are correct and the comment is wrong. Thanks. Patch is sent to gcc-patches. Liang > > Ian >