summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dump.c4
-rw-r--r--ext/Devel/Peek/t/Peek.t1
-rw-r--r--regcomp.c3
-rw-r--r--regexp.h75
-rw-r--r--sv.c6
5 files changed, 49 insertions, 40 deletions
diff --git a/dump.c b/dump.c
index 902026f0a0..1fdbb638c5 100644
--- a/dump.c
+++ b/dump.c
@@ -1553,8 +1553,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " COP_HIGH = %"UVuf"\n",
(UV) COP_SEQ_RANGE_HIGH(sv));
} else if ((type >= SVt_PVNV && type != SVt_PVAV && type != SVt_PVHV
- && type != SVt_PVCV && type != SVt_PVFM && !isGV_with_GP(sv)
- && !SvVALID(sv))
+ && type != SVt_PVCV && type != SVt_PVFM && type != SVt_REGEXP
+ && !isGV_with_GP(sv) && !SvVALID(sv))
|| type == SVt_NV) {
STORE_NUMERIC_LOCAL_SET_STANDARD();
/* %Vg doesn't work? --jhi */
diff --git a/ext/Devel/Peek/t/Peek.t b/ext/Devel/Peek/t/Peek.t
index 0047ee5271..087a613461 100644
--- a/ext/Devel/Peek/t/Peek.t
+++ b/ext/Devel/Peek/t/Peek.t
@@ -286,7 +286,6 @@ do_test(15,
REFCNT = 2
FLAGS = \\(POK,pPOK\\)
IV = 0
- NV = 0
PV = $ADDR "\\(\\?-xism:tic\\)"\\\0
CUR = 12
LEN = \\d+');
diff --git a/regcomp.c b/regcomp.c
index 96dd3f967e..48a6944fcc 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9206,14 +9206,13 @@ Perl_reg_temp_copy (pTHX_ REGEXP *rx) {
struct regexp *const r = (struct regexp *)SvANY(rx);
register const I32 npar = r->nparens+1;
(void)ReREFCNT_inc(rx);
- /* FIXME ORANGE (once we start actually using the regular SV fields.) */
/* We can take advantage of the existing "copied buffer" mechanism in SVs
by pointing directly at the buffer, but flagging that the allocated
space in the copy is zero. As we've just done a struct copy, it's now
a case of zero-ing that, rather than copying the current length. */
SvPV_set(ret_x, RX_WRAPPED(rx));
SvFLAGS(ret_x) |= SvFLAGS(rx) & (SVf_POK|SVp_POK|SVf_UTF8);
- StructCopy(r, ret, regexp);
+ StructCopy(&(r->xpv_cur), &(ret->xpv_cur), struct regexp_allocated);
SvLEN_set(ret_x, 0);
Newx(ret->offs, npar, regexp_paren_pair);
Copy(r->offs, ret->offs, npar, regexp_paren_pair);
diff --git a/regexp.h b/regexp.h
index ad59cc7346..7696ec25b8 100644
--- a/regexp.h
+++ b/regexp.h
@@ -66,44 +66,53 @@ typedef struct regexp_paren_pair {
regexp's data array based on the data item's type.
*/
+#define _REGEXP_COMMON \
+ /* what engine created this regexp? */ \
+ const struct regexp_engine* engine; \
+ REGEXP *mother_re; /* what re is this a lightweight copy of? */ \
+ /* Information about the match that the perl core uses to */ \
+ /* manage things */ \
+ U32 extflags; /* Flags used both externally and internally */ \
+ I32 minlen; /* mininum possible length of string to match */\
+ I32 minlenret; /* mininum possible length of $& */ \
+ U32 gofs; /* chars left of pos that we search from */ \
+ /* substring data about strings that must appear in the */ \
+ /* final match, used for optimisations */ \
+ struct reg_substr_data *substrs; \
+ U32 nparens; /* number of capture buffers */ \
+ /* private engine specific data */ \
+ U32 intflags; /* Engine Specific Internal flags */ \
+ void *pprivate; /* Data private to the regex engine which */ \
+ /* created this object. */ \
+ /* Data about the last/current match. These are modified */ \
+ /* during matching */ \
+ U32 lastparen; /* last open paren matched */ \
+ U32 lastcloseparen; /* last close paren matched */ \
+ regexp_paren_pair *swap; /* Swap copy of *offs */ \
+ /* Array of offsets for (@-) and (@+) */ \
+ regexp_paren_pair *offs; \
+ /* saved or original string so \digit works forever. */ \
+ char *subbeg; \
+ SV_SAVED_COPY /* If non-NULL, SV which is COW from original */\
+ I32 sublen; /* Length of string pointed by subbeg */ \
+ /* Information about the match that isn't often used */ \
+ /* offset from wrapped to the start of precomp */ \
+ unsigned pre_prefix:4; \
+ /* number of eval groups in the pattern - for security checks */\
+ unsigned seen_evals:28
+
typedef struct regexp {
_XPV_HEAD;
_XPVMG_HEAD;
- /* what engine created this regexp? */
- const struct regexp_engine* engine;
- REGEXP *mother_re; /* what re is this a lightweight copy of? */
-
- /* Information about the match that the perl core uses to manage things */
- U32 extflags; /* Flags used both externally and internally */
- I32 minlen; /* mininum possible length of string to match */
- I32 minlenret; /* mininum possible length of $& */
- U32 gofs; /* chars left of pos that we search from */
- struct reg_substr_data *substrs; /* substring data about strings that must appear
- in the final match, used for optimisations */
- U32 nparens; /* number of capture buffers */
-
- /* private engine specific data */
- U32 intflags; /* Engine Specific Internal flags */
- void *pprivate; /* Data private to the regex engine which
- created this object. */
-
- /* Data about the last/current match. These are modified during matching*/
- U32 lastparen; /* last open paren matched */
- U32 lastcloseparen; /* last close paren matched */
- regexp_paren_pair *swap; /* Swap copy of *offs */
- regexp_paren_pair *offs; /* Array of offsets for (@-) and (@+) */
-
- char *subbeg; /* saved or original string
- so \digit works forever. */
- SV_SAVED_COPY /* If non-NULL, SV which is COW from original */
- I32 sublen; /* Length of string pointed by subbeg */
-
-
- /* Information about the match that isn't often used */
- unsigned pre_prefix:4; /* offset from wrapped to the start of precomp */
- unsigned seen_evals:28; /* number of eval groups in the pattern - for security checks */
+ _REGEXP_COMMON;
} regexp;
+struct regexp_allocated {
+ _XPV_ALLOCATED_HEAD;
+ _XPVMG_HEAD;
+ _REGEXP_COMMON;
+};
+
/* HV *paren_names; Optional hash of paren names
now stored in the IV union */
diff --git a/sv.c b/sv.c
index a9bdfd2f4c..dc0ec589b7 100644
--- a/sv.c
+++ b/sv.c
@@ -917,8 +917,10 @@ static const struct body_details bodies_by_type[] = {
HASARENA, FIT_ARENA(0, sizeof(XPVMG)) },
/* something big */
- { sizeof(struct regexp), sizeof(struct regexp), 0,
- SVt_REGEXP, FALSE, HADNV, HASARENA, FIT_ARENA(0, sizeof(struct regexp))
+ { sizeof(struct regexp_allocated), sizeof(struct regexp_allocated),
+ + relative_STRUCT_OFFSET(struct regexp_allocated, regexp, xpv_cur),
+ SVt_REGEXP, FALSE, NONV, HASARENA,
+ FIT_ARENA(0, sizeof(struct regexp_allocated))
},
/* 48 */