[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: Regex backreference bug in recursion/thread (status &questions)
At 11:11 AM -0500 1/31/00, Harry Wolfson wrote:
> ...
> Possible Solution:
> ...
> Therefore, use of a scratchpad array could provide dynamically
> allocated, independent SV instances to hold the stuff we care about.
> ...
> Questions I have:
> * Is it ok to have invocations/calls to an OPcode from _within_ another
> Opcode node?
> ...
> * Would it make sense to do the actual memory allocation for the pad
> values for startp[], etc at the very beginning of the regex execution
Here is another possible solution. Please let me know if this sounds
reasonable.
Instead of using the scratchpad to store various bits and pieces of the
regexp struct, completely regexp-specific memory could be allocated
_each_ time the MATCH OPcode is entered (no scratchpads involved).
Instead of allocating memory for:
I32 *startp;
I32 *endp;
inside regcomp.c:Perl_pregcomp() using calls to Newz(), it would be put
off until the MATCH OPcode is entered during runtime. That way
independent, newly allocated chunks of memory would be used for each
recursive or thread invocation. Obviously, great care would be required
to free that memory however the regex happens to exit. The data members
subbeg and sublen would also need to be modified slightly so that they
could use this dynamically allocated memory.
--
Harry Wolfson
HarryWolfson@LL.MIT.EDU
- Follow-Ups from:
-
Gurusamy Sarathy <gsar@ActiveState.com>
- References to:
-
Harry Wolfson <HarryWolfson@LL.MIT.EDU>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]