summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorsyber <syber@crazypanda.ru>2014-09-04 22:08:59 +0400
committerDavid Mitchell <davem@iabyn.com>2014-10-03 13:40:54 +0100
commitb46e009d94293e069270690750f6c669c6d0ce22 (patch)
treec335154dccea12b391db6aaf7cac73db22e08f43 /perly.y
parentdf968918245d10232f955ab0965da7f8d6297a29 (diff)
downloadperl-b46e009d94293e069270690750f6c669c6d0ce22.tar.gz
Make OP_METHOD* to be of new class METHOP
Introduce a new opcode class, METHOP, which will hold class/method related info needed at runtime to improve performance of class/object method calls, then change OP_METHOD and OP_METHOD_NAMED from being UNOP/SVOP to being METHOP. Note that because OP_METHOD is a UNOP with an op_first, while OP_METHOD_NAMED is an SVOP, the first field of the METHOP structure is a union holding either op_first or op_sv. This was seen as less messy than having to introduce two new op classes. The new op class's character is '.' Nothing has changed in functionality and/or performance by this commit. It just introduces new structure which will be extended with extra fields and used in later commits. Added METHOP constructors: - newMETHOP() for method ops with dynamic method names. The only optype for this op is OP_METHOD. - newMETHOP_named() for method ops with constant method names. Optypes for this op are: OP_METHOD_NAMED (currently) and (later) OP_METHOD_SUPER, OP_METHOD_REDIR, OP_METHOD_NEXT, OP_METHOD_NEXTCAN, OP_METHOD_MAYBENEXT (This commit includes fixups by davem)
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/perly.y b/perly.y
index 77773fdf5c..fcb9ec0aa7 100644
--- a/perly.y
+++ b/perly.y
@@ -638,24 +638,24 @@ listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */
{ $$ = convert(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, scalar($1), $5),
- newUNOP(OP_METHOD, 0, $3)));
+ newMETHOP(OP_METHOD, 0, $3)));
}
| term ARROW method /* $foo->bar */
{ $$ = convert(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST, scalar($1),
- newUNOP(OP_METHOD, 0, $3)));
+ newMETHOP(OP_METHOD, 0, $3)));
}
| METHOD indirob optlistexpr /* new Class @args */
{ $$ = convert(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, $2, $3),
- newUNOP(OP_METHOD, 0, $1)));
+ newMETHOP(OP_METHOD, 0, $1)));
}
| FUNCMETH indirob '(' optexpr ')' /* method $object (@args) */
{ $$ = convert(OP_ENTERSUB, OPf_STACKED,
op_append_elem(OP_LIST,
op_prepend_elem(OP_LIST, $2, $4),
- newUNOP(OP_METHOD, 0, $1)));
+ newMETHOP(OP_METHOD, 0, $1)));
}
| LSTOP optlistexpr /* print @args */
{ $$ = convert($1, 0, $2); }