This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unify GOSTART and GOSUB
authorYves Orton <demerphq@gmail.com>
Sat, 5 Mar 2016 21:04:28 +0000 (22:04 +0100)
committerYves Orton <demerphq@gmail.com>
Sun, 6 Mar 2016 13:06:08 +0000 (14:06 +0100)
commitd5a00e4af6b155495be31a35728b8fef8e671ebe
tree562a578c47ebca3abd0f26130e8e9e75cb6702f6
parent5bd2d46ea3f06ba4e06c713635d5f83a331c4af0
Unify GOSTART and GOSUB

GOSTART is a special case of GOSUB, we can remove a lot of offset twiddling,
and other special casing by unifying them, at pretty much no cost.

GOSUB has 2 arguments, ARG() and ARG2L(), which are interpreted as
a U32 and an I32 respectively. ARG() holds the "parno" we will recurse
into. ARG2L() holds a signed offset to the relevant start node for the
recursion.

Prior to this patch the argument to GOSUB would always be >=, and unlike
other parts of our logic we would not use 0 to represent "start/end" of
pattern, as GOSTART would be used for "recurse to beginning of pattern",
after this patch we use 0 to represent "start/end", and a lot of
complexity "goes away" along with GOSTART regops.
pod/perldebguts.pod
regcomp.c
regcomp.h
regcomp.sym
regexec.c
regexp.h
regnodes.h