Handle the new METHOP.
Zefram [Fri, 20 Mar 2015 17:21:11 +0000 (17:21 +0000)]
[CPAN #101071]

CHANGES
Size.xs

diff --git a/CHANGES b/CHANGES
index 2b1ad20..66a0932 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
 Revision history for Perl extension Devel::Size.
 
 0.79_52 2015-02-28 nicholas
+    patches from Zefram:
+  * handle the new METHOP. [CPAN #101071]
 
 0.79_51 2015-02-28 nicholas
   * as of 5.20.0, s/// is no longer a reliable test for OOK [CPAN #95493]
diff --git a/Size.xs b/Size.xs
index 109dd15..c66f1c6 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -215,6 +215,9 @@ typedef enum {
 #ifdef OA_GVOP
     , OPc_GVOP /* 13 */
 #endif
+#ifdef OA_METHOP
+    , OPc_METHOP
+#endif
 
 } opclass;
 
@@ -337,6 +340,11 @@ cc_opclass(const OP * const o)
         case OA_CONDOP: TAG;
            return OPc_CONDOP;
 #endif
+
+#ifdef OA_METHOP
+       case OA_METHOP: TAG;
+           return OPc_METHOP;
+#endif
         }
         warn("Devel::Size: Can't determine class of operator %s, assuming BASEOP\n",
          PL_op_name[o->op_type]);
@@ -533,6 +541,20 @@ op_size(pTHX_ const OP * const baseop, struct state *st)
 
         }
         TAG;break;
+#ifdef OA_METHOP
+       case OPc_METHOP: TAG;
+           st->total_size += sizeof(struct methop);
+           if (baseop->op_type != OP_METHOD)
+               sv_size(aTHX_ st, cMETHOPx_meth(baseop), SOME_RECURSION);
+#if PERL_VERSION*1000+PERL_SUBVERSION >= 21007
+           if (baseop->op_type == OP_METHOD_REDIR || baseop->op_type == OP_METHOD_REDIR_SUPER) {
+               SV *rclass = cMETHOPx_rclass(baseop);
+               if(SvTYPE(rclass) != SVt_PVHV)
+                   sv_size(aTHX_ st, rclass, SOME_RECURSION);
+           }
+#endif
+           TAG;break;
+#endif
       default:
         TAG;break;
       }