Re: [patch] fix memory corruption bug in tm_region_init

2012-03-06 Thread Aldy Hernandez
On 03/06/12 10:20, Jakub Jelinek wrote: On Tue, Mar 06, 2012 at 08:04:12AM -0800, Richard Henderson wrote: On 03/06/12 07:55, Aldy Hernandez wrote: + bb_regions = VEC_alloc (tm_region_p, heap, last_basic_block); + VEC_reserve (tm_region_p, heap, bb_regions, last_basic_block); + for (i = 0; i

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-06 Thread Jakub Jelinek
On Tue, Mar 06, 2012 at 08:04:12AM -0800, Richard Henderson wrote: > On 03/06/12 07:55, Aldy Hernandez wrote: > > + bb_regions = VEC_alloc (tm_region_p, heap, last_basic_block); > > + VEC_reserve (tm_region_p, heap, bb_regions, last_basic_block); > > + for (i = 0; i < last_basic_block; ++i) > >

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-06 Thread Richard Henderson
On 03/06/12 07:55, Aldy Hernandez wrote: > + bb_regions = VEC_alloc (tm_region_p, heap, last_basic_block); > + VEC_reserve (tm_region_p, heap, bb_regions, last_basic_block); > + for (i = 0; i < last_basic_block; ++i) > +VEC_quick_insert (tm_region_p, bb_regions, i, NULL); The reserve is red

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-06 Thread Aldy Hernandez
On 03/05/12 12:47, Richard Henderson wrote: On 03/05/2012 10:37 AM, Aldy Hernandez wrote: I thought there'd be a lot less overhead by callocing the value myself. Is the overhead negligible? Yes, it's negligible. I can certainly make it a VEC in a follow up patch if you want, though I'll c

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Richard Henderson
On 03/05/2012 10:37 AM, Aldy Hernandez wrote: > I thought there'd be a lot less overhead by callocing the value myself. Is > the overhead negligible? Yes, it's negligible. > I can certainly make it a VEC in a follow up patch if you want, though I'll > commit this now so I can at get Rainer and

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Aldy Hernandez
On 03/05/12 11:08, Rainer Orth wrote: Aldy Hernandez writes: Torvald has a testcase from the STAMP benchmark that is showing a memory corruption error after my fix to publication safety problems. The problem is we're allocating a chunk of worklist memory of size n_basic_blocks which changes w

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Aldy Hernandez
On 03/05/12 11:16, Richard Henderson wrote: On 03/05/2012 08:54 AM, Aldy Hernandez wrote: region_worklist = (struct tm_region **) xcalloc (sizeof (struct tm_region *), - n_basic_blocks + NUM_FIXED_BLOCKS + 2); + last_basic

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Richard Henderson
On 03/05/2012 08:54 AM, Aldy Hernandez wrote: >region_worklist = > (struct tm_region **) xcalloc (sizeof (struct tm_region *), > - n_basic_blocks + NUM_FIXED_BLOCKS + 2); > + last_basic_block + NUM_FIXED_BLOCKS); This is ok. I w

Re: [patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Rainer Orth
Aldy Hernandez writes: > Torvald has a testcase from the STAMP benchmark that is showing a memory > corruption error after my fix to publication safety problems. > > The problem is we're allocating a chunk of worklist memory of size > n_basic_blocks which changes with tail merge optimization and

[patch] fix memory corruption bug in tm_region_init

2012-03-05 Thread Aldy Hernandez
Hi folks. Torvald has a testcase from the STAMP benchmark that is showing a memory corruption error after my fix to publication safety problems. The problem is we're allocating a chunk of worklist memory of size n_basic_blocks which changes with tail merge optimization and such. We end up w