This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [pph] Allocate string tables separately. (issue4843044)
- From: Diego Novillo <dnovillo at google dot com>
- To: dnovillo at google dot com, gchare at google dot com, crowl at google dot com, gcc-patches at gcc dot gnu dot org, reply at codereview dot appspotmail dot com
- Date: Fri, 5 Aug 2011 13:51:09 -0400
- Subject: Re: [pph] Allocate string tables separately. (issue4843044)
- References: <bcaec539651003f05504a9c59edc@google.com>
On Fri, Aug 5, 2011 at 13:42, <gchare@google.com> wrote:
> Yep this fixes the problem I had with the strings being freed early.
Great.
> http://codereview.appspot.com/4843044/diff/1/gcc/cp/pph-streamer-in.c#newcode157
> gcc/cp/pph-streamer-in.c:157: memcpy (new_strtab, strtab, strtab_size);
> I don't think we need to memcpy, to be more efficient instead we can
> just change the way stream->encoder.r.file_data is read to only read the
> pph_file_header + body into it, and fread the strtab straight into
> new_strtab.
>
> This implies more logic when reading, but is potentially more efficient.
Yeah, I thought about that, but I didn't want to make the file reading
logic more convoluted than it already is. Maybe we can do that at
some later point. And I think that the multiple read operations may
in fact be slower than memcpy'ing, but I didn't really try that.
Diego.