* but this is replaced when op is grafted in, when
* this op will point to the real next op, and the new
* parent takes over role of remembering starting op.)
* but this is replaced when op is grafted in, when
* this op will point to the real next op, and the new
* parent takes over role of remembering starting op.)
/* If op_type:9 is changed to :10, also change cx_pusheval()
Also, if the type of op_type is ever changed (e.g. to PERL_BITFIELD32)
then all the other bit-fields before/after it should change their
/* If op_type:9 is changed to :10, also change cx_pusheval()
Also, if the type of op_type is ever changed (e.g. to PERL_BITFIELD32)
then all the other bit-fields before/after it should change their
- /* On local LVAL, don't init local value. */
- /* On OP_SORT, subroutine is inlined. */
- /* On OP_NOT, inversion was implicit. */
- /* On OP_LEAVE, don't restore curpm, e.g.
+ /* On local LVAL, don't init local value. */
+ /* On OP_SORT, subroutine is inlined. */
+ /* On OP_NOT, inversion was implicit. */
+ /* On OP_LEAVE, don't restore curpm, e.g.
- /* On truncate, we truncate filehandle */
- /* On control verbs, we saw no label */
- /* On flipflop, we saw ... instead of .. */
- /* On UNOPs, saw bare parens, e.g. eof(). */
- /* On OP_CHDIR, handle (or bare parens) */
- /* On OP_NULL, saw a "do". */
- /* On OP_EXISTS, treat av as av, not avhv. */
- /* On OP_(ENTER|LEAVE)EVAL, don't clear $@ */
- /* On regcomp, "use re 'eval'" was in scope */
- /* On RV2[ACGHS]V, don't create GV--in
- defined()*/
- /* On OP_DBSTATE, indicates breakpoint
- * (runtime property) */
- /* On OP_REQUIRE, was seen as CORE::require */
- /* On OP_(ENTER|LEAVE)WHEN, there's
- no condition */
- /* On OP_SMARTMATCH, an implicit smartmatch */
- /* On OP_ANONHASH and OP_ANONLIST, create a
- reference to the new anon hash or array */
- /* On OP_HELEM, OP_MULTIDEREF and OP_HSLICE,
+ /* On truncate, we truncate filehandle */
+ /* On control verbs, we saw no label */
+ /* On flipflop, we saw ... instead of .. */
+ /* On UNOPs, saw bare parens, e.g. eof(). */
+ /* On OP_CHDIR, handle (or bare parens) */
+ /* On OP_NULL, saw a "do". */
+ /* On OP_EXISTS, treat av as av, not avhv. */
+ /* On OP_(ENTER|LEAVE)EVAL, don't clear $@ */
+ /* On regcomp, "use re 'eval'" was in scope */
+ /* On RV2[ACGHS]V, don't create GV--in
+ defined()*/
+ /* On OP_DBSTATE, indicates breakpoint
+ * (runtime property) */
+ /* On OP_REQUIRE, was seen as CORE::require */
+ /* On OP_(ENTER|LEAVE)WHEN, there's
+ no condition */
+ /* On OP_SMARTMATCH, an implicit smartmatch */
+ /* On OP_ANONHASH and OP_ANONLIST, create a
+ reference to the new anon hash or array */
+ /* On OP_HELEM, OP_MULTIDEREF and OP_HSLICE,
- /* On OP_MATCH, OP_SUBST & OP_TRANS, the
- operand of a logical or conditional
- that was optimised away, so it should
- not be bound via =~ */
- /* On OP_CONST, from a constant CV */
- /* On OP_GLOB, two meanings:
- - Before ck_glob, called as CORE::glob
- - After ck_glob, use Perl glob function
- */
+ /* On OP_MATCH, OP_SUBST & OP_TRANS, the
+ operand of a logical or conditional
+ that was optimised away, so it should
+ not be bound via =~ */
+ /* On OP_CONST, from a constant CV */
+ /* On OP_GLOB, two meanings:
+ - Before ck_glob, called as CORE::glob
+ - After ck_glob, use Perl glob function
+ */
/* On OP_PADRANGE, push @_ */
/* On OP_DUMP, has no label */
/* On OP_UNSTACK, in a C-style for loop */
/* On OP_PADRANGE, push @_ */
/* On OP_DUMP, has no label */
/* On OP_UNSTACK, in a C-style for loop */
/* There is no room in op_flags for this one, so it has its own bit-
field member (op_folded) instead. The flag is only used to tell
op_convert_list to set op_folded. */
/* There is no room in op_flags for this one, so it has its own bit-
field member (op_folded) instead. The flag is only used to tell
op_convert_list to set op_folded. */
-#define PMf_IS_QR (1U<<(PMf_BASE_SHIFT+16))
-#define PMf_USE_RE_EVAL (1U<<(PMf_BASE_SHIFT+17)) /* use re'eval' in scope */
+#define PMf_IS_QR (1U<<(PMf_BASE_SHIFT+15))
+#define PMf_USE_RE_EVAL (1U<<(PMf_BASE_SHIFT+16)) /* use re'eval' in scope */
+
+/* Means that this is a subpattern being compiled while processing a \p{}
+ * wildcard. This isn't called from op.c, but it is passed as a pm flag. */
+#define PMf_WILDCARD (1U<<(PMf_BASE_SHIFT+17))
- OP * opslab_freed; /* chain of freed ops */
- size_t opslab_refcnt; /* number of ops */
+ OPSLAB * opslab_head; /* first slab in chain */
+ OP ** opslab_freed; /* array of sized chains of freed ops (head only)*/
+ size_t opslab_refcnt; /* number of ops (head slab only) */
+ U16 opslab_freed_size; /* allocated size of opslab_freed */
+ U16 opslab_size; /* size of slab in pointers,
+ including header */
+ U16 opslab_free_space; /* space available in this slab
+ for allocating new ops (in ptr
+ units) */
- (OPSLOT *)(((char *)o)-OPSLOT_HEADER))
-# define OpSLAB(o) OpSLOT(o)->opslot_slab
+ (OPSLOT *)(((char *)o)-OPSLOT_HEADER))
+
+/* the slab that owns this op */
+# define OpMySLAB(o) \
+ ((OPSLAB*)((char *)((I32**)OpSLOT(o) - OpSLOT(o)->opslot_offset)-STRUCT_OFFSET(struct opslab, opslab_slots)))
+/* the first (head) opslab of the chain in which this op is allocated */
+# define OpSLAB(o) \
+ (OpMySLAB(o)->opslab_head)
+/* calculate the slot given the owner slab and an offset */
+#define OpSLOToff(slab, offset) \
+ ((OPSLOT*)(((I32 **)&(slab)->opslab_slots)+(offset)))
+
Set an entry in the BHK structure, and set the flags to indicate it is
valid. C<which> is a preprocessing token indicating which entry to set.
The type of C<ptr> depends on the entry.
Set an entry in the BHK structure, and set the flags to indicate it is
valid. C<which> is a preprocessing token indicating which entry to set.
The type of C<ptr> depends on the entry.
Re-enable an entry in this BHK structure, by setting the appropriate
flag. C<which> is a preprocessor token indicating which entry to enable.
This will assert (under -DDEBUGGING) if the entry doesn't contain a valid
pointer.
Re-enable an entry in this BHK structure, by setting the appropriate
flag. C<which> is a preprocessor token indicating which entry to enable.
This will assert (under -DDEBUGGING) if the entry doesn't contain a valid
pointer.
- if (PL_blockhooks) { \
- SSize_t i; \
- for (i = av_tindex(PL_blockhooks); i >= 0; i--) { \
- SV *sv = AvARRAY(PL_blockhooks)[i]; \
- BHK *hk; \
- \
- assert(SvIOK(sv)); \
- if (SvUOK(sv)) \
- hk = INT2PTR(BHK *, SvUVX(sv)); \
- else \
- hk = INT2PTR(BHK *, SvIVX(sv)); \
- \
- if (BhkENTRY(hk, which)) \
- BhkENTRY(hk, which)(aTHX_ arg); \
- } \
- } \
+ if (PL_blockhooks) { \
+ SSize_t i; \
+ for (i = av_top_index(PL_blockhooks); i >= 0; i--) { \
+ SV *sv = AvARRAY(PL_blockhooks)[i]; \
+ BHK *hk; \
+ \
+ assert(SvIOK(sv)); \
+ if (SvUOK(sv)) \
+ hk = INT2PTR(BHK *, SvUVX(sv)); \
+ else \
+ hk = INT2PTR(BHK *, SvIVX(sv)); \
+ \
+ if (BhkENTRY(hk, which)) \
+ BhkENTRY(hk, which)(aTHX_ arg); \
+ } \
+ } \
Return a member of the XOP structure. C<which> is a cpp token
indicating which entry to return. If the member is not set
this will return a default value. The return type depends
on C<which>. This macro evaluates its arguments more than
Return a member of the XOP structure. C<which> is a cpp token
indicating which entry to return. If the member is not set
this will return a default value. The return type depends
on C<which>. This macro evaluates its arguments more than
Set a member of the XOP structure. C<which> is a cpp token
indicating which entry to set. See L<perlguts/"Custom Operators">
for details about the available members and how
they are used. This macro evaluates its argument
more than once.
Set a member of the XOP structure. C<which> is a cpp token
indicating which entry to set. See L<perlguts/"Custom Operators">
for details about the available members and how
they are used. This macro evaluates its argument
more than once.
=for apidoc Am|U32|OP_CLASS|OP *o
Return the class of the provided OP: that is, which of the *OP
structures it uses. For core ops this currently gets the information out
=for apidoc Am|U32|OP_CLASS|OP *o
Return the class of the provided OP: that is, which of the *OP
structures it uses. For core ops this currently gets the information out
For custom ops the type is returned from the registration, and it is up
to the registree to ensure it is accurate. The value returned will be
one of the C<OA_>* constants from F<op.h>.
For custom ops the type is returned from the registration, and it is up
to the registree to ensure it is accurate. The value returned will be
one of the C<OA_>* constants from F<op.h>.
-#ifdef PERL_OP_PARENT
-# define OpHAS_SIBLING(o) (cBOOL((o)->op_moresib))
-# define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL)
-# define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibparent = (sib))
-# define OpLASTSIB_set(o, parent) \
- ((o)->op_moresib = 0, (o)->op_sibparent = (parent))
-# define OpMAYBESIB_set(o, sib, parent) \
- ((o)->op_sibparent = ((o)->op_moresib = cBOOL(sib)) ? (sib) : (parent))
-#else
-# define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling))
-# define OpSIBLING(o) (0 + (o)->op_sibling)
-# define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibling = (sib))
-# define OpLASTSIB_set(o, parent) \
- ((o)->op_moresib = 0, (o)->op_sibling = NULL)
-# define OpMAYBESIB_set(o, sib, parent) \
- ((o)->op_moresib = cBOOL(sib), (o)->op_sibling = (sib))
-#endif
+#define OpHAS_SIBLING(o) (cBOOL((o)->op_moresib))
+#define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL)
+#define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibparent = (sib))
+#define OpLASTSIB_set(o, parent) \
+ ((o)->op_moresib = 0, (o)->op_sibparent = (parent))
+#define OpMAYBESIB_set(o, sib, parent) \
+ ((o)->op_sibparent = ((o)->op_moresib = cBOOL(sib)) ? (sib) : (parent))
#define newATTRSUB(f, o, p, a, b) Perl_newATTRSUB_x(aTHX_ f, o, p, a, b, FALSE)
#define newSUB(f, o, p, b) newATTRSUB((f), (o), (p), NULL, (b))
#define newATTRSUB(f, o, p, a, b) Perl_newATTRSUB_x(aTHX_ f, o, p, a, b, FALSE)
#define newSUB(f, o, p, b) newATTRSUB((f), (o), (p), NULL, (b))
-static const char * const deprecated_above_ff_msg
- = "Use of strings with code points over 0xFF as arguments to "
- "%s operator is deprecated";
+# define FATAL_ABOVE_FF_MSG \
+ "Use of strings with code points over 0xFF as arguments to " \
+ "%s operator is not allowed"
+#endif
+#if defined(PERL_IN_OP_C) || defined(PERL_IN_DOOP_C) || defined(PERL_IN_PERL_C)
+# define TR_UNMAPPED (UV)-1
+# define TR_DELETE (UV)-2
+# define TR_R_EMPTY (UV)-3 /* rhs (replacement) is empty */
+# define TR_OOB (UV)-4 /* Something that isn't one of the others */
+# define TR_SPECIAL_HANDLING TR_DELETE /* Can occupy same value */
+# define TR_UNLISTED TR_UNMAPPED /* A synonym whose name is clearer
+ at times */
+#if defined(PERL_IN_OP_C) || defined(PERL_IN_TOKE_C)
+#define RANGE_INDICATOR ILLEGAL_UTF8_BYTE
+#endif
+
+/* stuff for OP_ARGCHECK */
+
+struct op_argcheck_aux {
+ UV params; /* number of positional parameters */
+ UV opt_params; /* number of optional positional parameters */
+ char slurpy; /* presence of slurpy: may be '\0', '@' or '%' */
+};