develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [patch] Re: [perl #21728] regexp SEGV

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 30, 2003 12:38
Subject:
Re: [patch] Re: [perl #21728] regexp SEGV
Message ID:
20030330213841.A5241@fdgroup.com
On Sun, Mar 30, 2003 at 11:17:05PM +0300, Enache Adrian wrote:
> On Sun, Mar 30, 2003 at 08:15:26PM +0100, Dave Mitchell wrote:
> > On Fri, Mar 28, 2003 at 11:53:09PM +0200, Enache Adrian wrote:
> > > The SSCHECK macro seems to be inappropriately used in regexp.c:174 -
> > > afaics from scope.[ch], it is designed to grow the savestack by little
> > > bits. ( 5 items ? - see the definitions of SSCHECK(), savestack_grow(),
> > > GROW() ).
> > > 
> > 
> > Wouldn't it be better to to just make SSCHECK call savestack_grow_cnt(),
> > and have that function grow by the maximum of GROW() and need?
> 
> Why changing SSCHECK ? - it's actually called only inside scope.c,
> (35 times) and each time with an argument of 2,3 or 4. The idea behind
> its trick was probably to make things as fast as possible. Why
> mess with that ? Think of the general impact of adding a supplementary
> computation inside critical code ( SSPUSH* and friends ) vs.
> the bloat of a ~ 50 bytes worth function. 

Well, there wouldnt normally be any extra compuation, ie something along
the lines of

- #define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow()
+ #define SSCHECK(need) if (PL_savestack_ix + (need) > PL_savestack_max)
savestack_grow_cnt(need)

But I suppose you'd still get poorer cache performance by all those extra
arg pushing intructions, even though they're not usally called.

So, fair enough.

My only other two comments would be:

you need () round the (need) in the SSGROW macro,
I still think savestack_grow_cnt(need) should grow by the max of
need and GROW(PL_savestack_max) rather than just by need.

-- 
A walk of a thousand miles begins with a single step...
then continues for another 1,999,999 or so.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About