Why is REG_INFTY I16_MAX

It is possible to increase this number with a Configure option, but I 
was surprised to learn that the default is INT16_MAX.  This seems low to 
me.  What are the reasons for it being this value?
0
public
7/6/2018 4:32:03 AM
perl.perl5.porters 47254 articles. 0 followers. Follow

3 Replies
6 Views

Similar Articles

[PageSpeed] 23

On Thu, Jul 05, 2018 at 10:32:03PM -0600, Karl Williamson wrote:
> It is possible to increase this number with a Configure option, but I was
> surprised to learn that the default is INT16_MAX.  This seems low to me.
> What are the reasons for it being this value?

Historically I think it used to be like that because when the regex engine
used to be recursive, /Something_Complex{1,large_number}/ would blow the
stack.

The thing that put me off changing it myself was that it would presumably
increase the size of certain reg node types, and I'm not clear how reg
node sizes are handled (all that NODE_STEP_REGNODE stuff).

But it definitely needs increasing.


-- 
"Procrastination grows to fill the available time"
    -- Mitchell's corollary to Parkinson's Law
0
davem
7/6/2018 8:05:16 AM
On 07/06/2018 02:05 AM, Dave Mitchell wrote:
> On Thu, Jul 05, 2018 at 10:32:03PM -0600, Karl Williamson wrote:
>> It is possible to increase this number with a Configure option, but I was
>> surprised to learn that the default is INT16_MAX.  This seems low to me.
>> What are the reasons for it being this value?
> 
> Historically I think it used to be like that because when the regex engine
> used to be recursive, /Something_Complex{1,large_number}/ would blow the
> stack.
> 
> The thing that put me off changing it myself was that it would presumably
> increase the size of certain reg node types, and I'm not clear how reg
> node sizes are handled (all that NODE_STEP_REGNODE stuff).
> 
> But it definitely needs increasing.
> 
> 

We could change it to U16, doubling the size, without having to change 
any regnodes.
0
public
7/6/2018 5:11:28 PM
On 07/06/2018 11:11 AM, Karl Williamson wrote:
> On 07/06/2018 02:05 AM, Dave Mitchell wrote:
>> On Thu, Jul 05, 2018 at 10:32:03PM -0600, Karl Williamson wrote:
>>> It is possible to increase this number with a Configure option, but I=
=20
>>> was
>>> surprised to learn that the default is INT16_MAX.=C2=A0 This seems lo=
w to me.
>>> What are the reasons for it being this value?
>>
>> Historically I think it used to be like that because when the regex=20
>> engine
>> used to be recursive, /Something_Complex{1,large_number}/ would blow t=
he
>> stack.
>>
>> The thing that put me off changing it myself was that it would presuma=
bly
>> increase the size of certain reg node types, and I'm not clear how reg
>> node sizes are handled (all that NODE_STEP_REGNODE stuff).
>>
>> But it definitely needs increasing.
>>
>>
>=20
> We could change it to U16, doubling the size, without having to change=20
> any regnodes.

I tried this, and there were a few test failures that assumed the=20
existing size, but no real problems.

Currently, the regnodes that contain this use the regnode_2 structure,=20
which has room for two U16 args (min and max).  But there is a=20
regnode_2L that has a U32 arg and an I32 arg, which we could use=20
instead.  Or we could trivially create a regnode_2UL with two U32s, to=20
avoid casting

If there is agreement to do so, I can go ahead and do it.
0
public
7/6/2018 6:46:38 PM
Reply: