This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re-enable static op allocation with obslab
authorReini Urban <rurban@x-ray.at>
Sun, 21 Oct 2012 23:56:11 +0000 (18:56 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 26 Oct 2012 03:02:56 +0000 (20:02 -0700)
obslab and the removal of the op_latefree logic, which allowed static
ops, removed support for the compiler modules, which allocates ops statically.
Add an op_static flag to replace the old latefree(d) op_free logic.

op.c
op.h

diff --git a/op.c b/op.c
index 8fccf71..df5c050 100644 (file)
--- a/op.c
+++ b/op.c
@@ -303,7 +303,8 @@ Perl_Slab_Free(pTHX_ void *op)
     PERL_ARGS_ASSERT_SLAB_FREE;
 
     if (!o->op_slabbed) {
-       PerlMemShared_free(op);
+        if (!o->op_static)
+           PerlMemShared_free(op);
        return;
     }
 
diff --git a/op.h b/op.h
index 399c02e..9182b4d 100644 (file)
--- a/op.h
+++ b/op.h
  *     op_opt          Whether or not the op has been optimised by the
  *                     peephole optimiser.
  *     op_slabbed      allocated via opslab
+ *     op_static       tell op_free() to skip PerlMemShared_free(), when
+ *                      !op_slabbed.
  *     op_savefree     on savestack via SAVEFREEOP
- *     op_spare        Four spare bits!
+ *     op_spare        Three spare bits
  *     op_flags        Flags common to all operations.  See OPf_* below.
  *     op_private      Flags peculiar to a particular operation (BUT,
  *                     by default, set to the number of children until
@@ -53,7 +55,8 @@ typedef PERL_BITFIELD16 Optype;
     PERL_BITFIELD16 op_opt:1;          \
     PERL_BITFIELD16 op_slabbed:1;      \
     PERL_BITFIELD16 op_savefree:1;     \
-    PERL_BITFIELD16 op_spare:4;                \
+    PERL_BITFIELD16 op_static:1;       \
+    PERL_BITFIELD16 op_spare:3;                \
     U8         op_flags;               \
     U8         op_private;
 #endif