summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-10-27 17:33:32 +0000
committerDavid Mitchell <davem@iabyn.com>2014-12-07 09:07:30 +0000
commit2f7c6295c991839e20b09fbf3107b861d511de31 (patch)
tree0fdd9d2c00a5c76657a8f6b8a51612b0dd86fef7 /op.h
parenta644a388ed31c256984f12dd1869bbc141de76e5 (diff)
downloadperl-2f7c6295c991839e20b09fbf3107b861d511de31.tar.gz
add UNOP_AUX OP class
This is the same as a UNOP, but with the addition of an op_aux field, which points to an array of UNOP_AUX_item unions. It is intended as a general escape mechanism for adding per-op-type extra fields (or arrays of items) to UNOPs. Its class character (for regen/opcodes etc) is '+'. Currently there are no ops of this type; but shortly, OP_MULTIDEREF will be added, which is the original motivation for this new op type.
Diffstat (limited to 'op.h')
-rw-r--r--op.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/op.h b/op.h
index befdc79ee4..61a382fb76 100644
--- a/op.h
+++ b/op.h
@@ -169,6 +169,14 @@ Deprecated. Use C<GIMME_V> instead.
#define OPpENTERSUB_LVAL_MASK (OPpLVAL_INTRO|OPpENTERSUB_INARGS)
+/* things that can be elements of op_aux */
+typedef union {
+ PADOFFSET pad_offset;
+ SV *sv;
+ IV iv;
+ UV uv;
+} UNOP_AUX_item;
+
struct op {
BASEOP
@@ -179,6 +187,12 @@ struct unop {
OP * op_first;
};
+struct unop_aux {
+ BASEOP
+ OP *op_first;
+ UNOP_AUX_item *op_aux;
+};
+
struct binop {
BASEOP
OP * op_first;
@@ -394,6 +408,7 @@ struct loop {
};
#define cUNOPx(o) ((UNOP*)o)
+#define cUNOP_AUXx(o) ((UNOP_AUX*)o)
#define cBINOPx(o) ((BINOP*)o)
#define cLISTOPx(o) ((LISTOP*)o)
#define cLOGOPx(o) ((LOGOP*)o)
@@ -406,6 +421,7 @@ struct loop {
#define cMETHOPx(o) ((METHOP*)o)
#define cUNOP cUNOPx(PL_op)
+#define cUNOP_AUX cUNOP_AUXx(PL_op)
#define cBINOP cBINOPx(PL_op)
#define cLISTOP cLISTOPx(PL_op)
#define cLOGOP cLOGOPx(PL_op)
@@ -417,6 +433,7 @@ struct loop {
#define cLOOP cLOOPx(PL_op)
#define cUNOPo cUNOPx(o)
+#define cUNOP_AUXo cUNOP_AUXx(o)
#define cBINOPo cBINOPx(o)
#define cLISTOPo cLISTOPx(o)
#define cLOGOPo cLOGOPx(o)
@@ -428,6 +445,7 @@ struct loop {
#define cLOOPo cLOOPx(o)
#define kUNOP cUNOPx(kid)
+#define kUNOP_AUX cUNOP_AUXx(kid)
#define kBINOP cBINOPx(kid)
#define kLISTOP cLISTOPx(kid)
#define kLOGOP cLOGOPx(kid)
@@ -505,6 +523,7 @@ struct loop {
#define OA_FILESTATOP (12 << OCSHIFT)
#define OA_LOOPEXOP (13 << OCSHIFT)
#define OA_METHOP (14 << OCSHIFT)
+#define OA_UNOP_AUX (15 << OCSHIFT)
/* Each remaining nybble of PL_opargs (i.e. bits 12..15, 16..19 etc)
* encode the type for each arg */