This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add B::PMOP::pmregexp
There was no way to get from a PMOP to its regexp object under non-
threaded builds. The threaded pmoffset field was exposed, but not its
non-threaded counterpart.
I implemented pmregexp in terms of PM_GETRE (which uses op_pmoffset
with threads and op_pmregexp without), so it works under threads, too.
It’s easier than conditionally using the regex_padav to get at things
like this:
$ ./perl -Ilib -MB -e 'use O "Concise", B::regex_padav->ARRAYelt(B::svref_2object(sub {qr/(??{})/})->ROOT->first->first->sibling->pmoffset)->qr_anoncv->object_2svref'
B::Concise::compile(CODE(0x7f8e9185ba08))
2 <1> leavesub[1 ref] K/REFC,1 ->(end)
1 </> qr() P/RTIME ->2
- <@> list K ->-
- <0> pushmark s ->-
- <1> null sK*/1 ->-
- <1> ex-scope sK ->(end)
- <0> stub s ->(end)
- <$> const(PV "(\077?{})") s ->-
-e syntax OK
With pmregexp, it is ‘only’:
$ ./perl -Ilib -MB -e 'use O "Concise", B::svref_2object(sub {qr/(??{})/})->ROOT->first->first->sibling->pmregexp->qr_anoncv->object_2svref'