summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-04-26 12:12:34 +0100
committerNicholas Clark <nick@ccl4.org>2011-05-18 19:11:03 +0100
commit74e0ddf711449aba3fac400d9102bd461ee7265b (patch)
treef6b7d2f148790a56598095c857b3385db5b79c14 /proto.h
parent75f63940310204509f2935729c2b989e3be7c00d (diff)
downloadperl-74e0ddf711449aba3fac400d9102bd461ee7265b.tar.gz
Store the compiled format in mg_ptr instead of after SvCUR() - fixes RT #89218
Formats are compiled down to a sequence of U32 opcodes in doparseform(). Previously the block of opcodes was stored in the buffer of SvPVX() after the raw string by extending the buffer, and calculating the first U32 aligned address after SvCUR(). A flag bit on the scalar was set to signal this hackery, tested with SvCOMPILED() The flag bit used happened to be the same as one of the two used by to signal Boyer-Moore compiled scalars. The assumption was that no scalar can be used for both. Unfortunately, this isn't quite true. Given that the scalar is alway upgraded to PVMG to add PERL_MAGIC_fm magic, to clear the cached compiled version, there's no extra memory cost in using mg_ptr in the MAGIC struct to point directly to the block of U32 opcodes. The test for "is there a compiled version" can switch to mg_find(..., PERL_MAGIC_fm) returning a pointer, and the use of a flag bit abolished. Retain SvCOMPILED() and SvCOMPILED_{on,off}() as compatibility for XS code on CPAN - the first is always 0, the other two now no-ops.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/proto.h b/proto.h
index a733e50d6f..845658b658 100644
--- a/proto.h
+++ b/proto.h
@@ -5710,7 +5710,7 @@ STATIC OP* S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **opli
#define PERL_ARGS_ASSERT_DOFINDLABEL \
assert(o); assert(label); assert(opstack); assert(oplimit)
-STATIC void S_doparseform(pTHX_ SV *sv)
+STATIC MAGIC * S_doparseform(pTHX_ SV *sv)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_DOPARSEFORM \
assert(sv)