This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge B::PMOP::pmflags into the common B::OP accessor XS code.
authorNicholas Clark <nick@ccl4.org>
Thu, 28 Oct 2010 16:34:01 +0000 (17:34 +0100)
committerNicholas Clark <nick@ccl4.org>
Fri, 29 Oct 2010 14:28:08 +0000 (15:28 +0100)
This saves about 800 bytes on this platform.

ext/B/B.xs

index 3faf596..87896e5 100644 (file)
@@ -834,6 +834,7 @@ threadsv_names()
 #define OPp            0x00000
 #define PADOFFSETp     0x10000
 #define U8p            0x20000
+#define U32p           0x30000
 
 #define OP_next_ix             OPp | offsetof(struct op, op_next)
 #define OP_sibling_ix          OPp | offsetof(struct op, op_sibling)
@@ -854,6 +855,8 @@ threadsv_names()
 #define OP_flags_ix            U8p | offsetof(struct op, op_flags)
 #define OP_private_ix          U8p | offsetof(struct op, op_private)
 
+#define PMOP_pmflags_ix                U32p | offsetof(struct pmop, op_pmflags)
+
 MODULE = B     PACKAGE = B::OP         PREFIX = OP_
 
 size_t
@@ -883,6 +886,7 @@ next(o)
        B::LOOP::redoop = LOOP_redoop_ix
        B::LOOP::nextop = LOOP_nextop_ix
        B::LOOP::lastop = LOOP_lastop_ix
+       B::PMOP::pmflags = PMOP_pmflags_ix
     PREINIT:
        char *ptr;
        SV *ret;
@@ -902,6 +906,9 @@ next(o)
        case (U8)(U8p >> 16):
            ret = sv_2mortal(newSVuv(*((U8*)ptr)));
            break;
+       case (U8)(U32p >> 16):
+           ret = sv_2mortal(newSVuv(*((U32*)ptr)));
+           break;
        }
        ST(0) = ret;
        XSRETURN(1);
@@ -1077,10 +1084,6 @@ PMOP_pmstash(o)
 
 #endif
 
-U32
-PMOP_pmflags(o)
-       B::PMOP         o
-
 #if PERL_VERSION < 9
 
 U32