Skip Menu |

This queue is for tickets about the Method-Lexical CPAN distribution.

Report information
The Basics
Id: 100710
Status: open
Priority: 0/
Queue: Method-Lexical

People
Owner: CHOCOLATE [...] cpan.org
Requestors: syber [...] crazypanda.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Method::Lexical no longer works correctly on perl 5.21.7
Since perl 5.21.7 there are 3 more method ops: 1) OP_METHOD_SUPER for ->SUPER::method() calls 2) OP_METHOD_REDIR for ->OtherClass::method() calls 3) OP_METHOD_REDIR_SUPER for ->OtherClass::SUPER::method() calls Now the only case for OP_METHOD is really dynamic method name call ->$method_name This was done to significantly increase method call perfomance. Please make changes to your module to meet new changes. Something like #if PERL_VERSION >= 5.21.7 else if (o->op_type == OP_METHOD_SUPER) { ... } else if (.... Keep in mind additional changes: 1) All method ops are now not UNOP or SVOP. They are now all METHOP (although METHOP is binary compatible with them both) 2) when OP_METHOD_SUPER, op_sv (meth_sv) contains only method name without "SUPER::" 3) when OP_METHOD_REDIR, op_sv(meth_sv) contains only method name without "OtherClass::", class name is in cMETHOPx_rclass(op) 4) when OP_METHOD_REDIR_SUPER, op_sv(meth_sv) contains only method name without "OtherClass::SUPER::", class name is in cMETHOPx_rclass(op) (without "SUPER::") P.S. when i was looking at the Lexical.xs code i wondered why did you make things so complicated? why did you copy-paste contents of S_method_common, gv_fetchmeth_pvn and even mro_get_linear_isa ? You could at least use gv_fetchmeth_pvn call. Because things change and speed up in perl's core. When you hardcode it, they are not speeded up... And may break :(
Thanks for the detailed heads-up and helpful advice! This will probably affect other modules of mine as well... Show quoted text
> when i was looking at the Lexical.xs code i wondered why did you make > things so complicated? why did you copy-paste contents of > S_method_common, gv_fetchmeth_pvn and even mro_get_linear_isa ?
I can't remember, but I assume there were good reasons. Bear in mind, it supports perls back to 5.8.1. I can't remember why I bundled mro.h, but I do remember trying -- with whatever was available at the time (MRO::Compat?) -- and failing to implement the required functionality without it. It might have had something to do with the generation counting... I doubt I'll have the time or inclination to maintain this, but thanks again for your comments and suggestions. On Thu Dec 04 18:10:01 2014, SYBER wrote: Show quoted text
> Since perl 5.21.7 there are 3 more method ops: > > 1) OP_METHOD_SUPER for ->SUPER::method() calls > 2) OP_METHOD_REDIR for ->OtherClass::method() calls > 3) OP_METHOD_REDIR_SUPER for ->OtherClass::SUPER::method() calls > > Now the only case for OP_METHOD is really dynamic method name call > ->$method_name > > This was done to significantly increase method call perfomance. > > Please make changes to your module to meet new changes. > > Something like > > #if PERL_VERSION >= 5.21.7 > else if (o->op_type == OP_METHOD_SUPER) { > ... > } > else if (.... > > Keep in mind additional changes: > > 1) All method ops are now not UNOP or SVOP. They are now all METHOP > (although METHOP is binary compatible with them both) > 2) when OP_METHOD_SUPER, op_sv (meth_sv) contains only method name > without "SUPER::" > 3) when OP_METHOD_REDIR, op_sv(meth_sv) contains only method name > without "OtherClass::", class name is in cMETHOPx_rclass(op) > 4) when OP_METHOD_REDIR_SUPER, op_sv(meth_sv) contains only method > name without "OtherClass::SUPER::", class name is in > cMETHOPx_rclass(op) (without "SUPER::") > > P.S. > when i was looking at the Lexical.xs code i wondered why did you make > things so complicated? why did you copy-paste contents of > S_method_common, gv_fetchmeth_pvn and even mro_get_linear_isa ? > > You could at least use gv_fetchmeth_pvn call. Because things change > and speed up in perl's core. When you hardcode it, they are not > speeded up... And may break :(
Чтв Дек 04 18:49:00 2014, CHOCOLATE писал: Show quoted text
> Thanks for the detailed heads-up and helpful advice! This will > probably affect other modules of mine as well... >
> > when i was looking at the Lexical.xs code i wondered why did you make > > things so complicated? why did you copy-paste contents of > > S_method_common, gv_fetchmeth_pvn and even mro_get_linear_isa ?
> > I can't remember, but I assume there were good reasons. Bear in mind, > it supports perls back to 5.8.1. I can't remember why I bundled mro.h, > but I do remember trying -- with whatever was available at the time > (MRO::Compat?) -- and failing to implement the required functionality > without it. It might have had something to do with the generation > counting... > > I doubt I'll have the time or inclination to maintain this, but thanks > again for your comments and suggestions. > > On Thu Dec 04 18:10:01 2014, SYBER wrote:
> > Since perl 5.21.7 there are 3 more method ops: > > > > 1) OP_METHOD_SUPER for ->SUPER::method() calls > > 2) OP_METHOD_REDIR for ->OtherClass::method() calls > > 3) OP_METHOD_REDIR_SUPER for ->OtherClass::SUPER::method() calls > > > > Now the only case for OP_METHOD is really dynamic method name call > > ->$method_name > > > > This was done to significantly increase method call perfomance. > > > > Please make changes to your module to meet new changes. > > > > Something like > > > > #if PERL_VERSION >= 5.21.7 > > else if (o->op_type == OP_METHOD_SUPER) { > > ... > > } > > else if (.... > > > > Keep in mind additional changes: > > > > 1) All method ops are now not UNOP or SVOP. They are now all METHOP > > (although METHOP is binary compatible with them both) > > 2) when OP_METHOD_SUPER, op_sv (meth_sv) contains only method name > > without "SUPER::" > > 3) when OP_METHOD_REDIR, op_sv(meth_sv) contains only method name > > without "OtherClass::", class name is in cMETHOPx_rclass(op) > > 4) when OP_METHOD_REDIR_SUPER, op_sv(meth_sv) contains only method > > name without "OtherClass::SUPER::", class name is in > > cMETHOPx_rclass(op) (without "SUPER::") > > > > P.S. > > when i was looking at the Lexical.xs code i wondered why did you make > > things so complicated? why did you copy-paste contents of > > S_method_common, gv_fetchmeth_pvn and even mro_get_linear_isa ? > > > > You could at least use gv_fetchmeth_pvn call. Because things change > > and speed up in perl's core. When you hardcode it, they are not > > speeded up... And may break :(
I'd advice you not to support old perls. It's very painful and leads to complex C code with many #ifdef For example i support only perl >= 5.18 in my XS modules If someone using very old perl, let them using very old CPAN modules as well ;)