summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-11-01 16:50:16 +0000
committerDavid Mitchell <davem@iabyn.com>2012-06-13 13:25:51 +0100
commit867940b89f1d3f001a6df1d888925b9ca246fe96 (patch)
tree991a8c53521998798452aa071aa5e20523bb6a6d /dump.c
parent188c19101137d65e1d1aa0bc4df26a0e6287f97d (diff)
downloadperl-867940b89f1d3f001a6df1d888925b9ca246fe96.tar.gz
add PMf_CODELIST_PRIVATE flag
This indicates that the op_code_list field in a PMOP is "private"; that is, it points to a list of DO blocks that we don't own, and shouldn't free, and whose pad may not match ours. This will allow us to use the op_code_list field in the runtime case of literal code, e.g. /$runtime(?{...})/ and qr/$runtime(?{...})/. Here, at compile-time, we need to make the pre-compiled (?{..}) blocks available to pp_regcomp, but the list containing those blocks is also the list that is executed in the lead-up to executing pp_regcomp (while skipping the DO blocks), so the code is already embedded, and doesn't need freeing. Furthermore, in the qr// case, the code blocks are actually within a different sub (an anon one) than the PMOP, so the pads won't match.
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index deebf23b0a..bda5172c28 100644
--- a/dump.c
+++ b/dump.c
@@ -614,8 +614,13 @@ Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
op_dump(pm->op_pmreplrootu.op_pmreplroot);
}
if (pm->op_code_list) {
- Perl_dump_indent(aTHX_ level, file, "CODE_LIST =\n");
- do_op_dump(level, file, pm->op_code_list);
+ if (pm->op_pmflags & PMf_CODELIST_PRIVATE) {
+ Perl_dump_indent(aTHX_ level, file, "CODE_LIST =\n");
+ do_op_dump(level, file, pm->op_code_list);
+ }
+ else
+ Perl_dump_indent(aTHX_ level, file, "CODE_LIST = 0x%"UVxf"\n",
+ PTR2UV(pm->op_code_list));
}
if (pm->op_pmflags || (PM_GETRE(pm) && RX_CHECK_SUBSTR(PM_GETRE(pm)))) {
SV * const tmpsv = pm_description(pm);
@@ -635,6 +640,7 @@ const struct flag_to_name pmflags_flags_names[] = {
{PMf_EVAL, ",EVAL"},
{PMf_NONDESTRUCT, ",NONDESTRUCT"},
{PMf_HAS_CV, ",HAS_CV"},
+ {PMf_CODELIST_PRIVATE, "PMf_CODELIST_PRIVATE"}
};
static SV *