From 70f1c38e1fa7069a433a2122f705909e54492243 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Wed, 4 Dec 2024 16:54:16 +0000 Subject: [PATCH] Create three new (currently-unimplemented) ops OP_MULTIPARAM, OP_PARAMTEST and OP_PARAMSTORE --- ext/Opcode/Opcode.pm | 1 + lib/B/Op_private.pm | 3 +++ opcode.h | 23 ++++++++++++++++++++++- opnames.h | 5 ++++- pp.c | 15 +++++++++++++++ pp_proto.h | 3 +++ regen/opcodes | 4 ++++ 7 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 20495dc48c59..3ad9029e1d35 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -309,6 +309,7 @@ invert_opset function. rv2hv helem hslice kvhslice each values keys exists delete aeach akeys avalues multideref argelem argdefelem argcheck + multiparam paramtest paramstore preinc i_preinc predec i_predec postinc i_postinc postdec i_postdec int hex oct abs pow multiply i_multiply diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index bd1a5ccd9f87..cd15fcc7512d 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -478,6 +478,7 @@ $bits{method_super}{0} = $bf[0]; @{$bits{msgsnd}}{3,2,1,0} = ($bf[5], $bf[5], $bf[5], $bf[5]); @{$bits{multiconcat}}{6,5,3,0} = ('OPpMULTICONCAT_APPEND', 'OPpMULTICONCAT_FAKE', 'OPpMULTICONCAT_STRINGIFY', $bf[0]); @{$bits{multideref}}{5,4,0} = ('OPpMULTIDEREF_DELETE', 'OPpMULTIDEREF_EXISTS', $bf[0]); +$bits{multiparam}{0} = $bf[0]; @{$bits{multiply}}{1,0} = ($bf[1], $bf[1]); @{$bits{ncmp}}{1,0} = ($bf[1], $bf[1]); @{$bits{ne}}{1,0} = ($bf[1], $bf[1]); @@ -496,6 +497,8 @@ $bits{padhv}{0} = 'OPpPADHV_ISKEYS'; @{$bits{padrange}}{6,5,4,3,2,1,0} = ($bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6]); @{$bits{padsv}}{5,4} = ($bf[9], $bf[9]); $bits{padsv_store}{0} = $bf[0]; +$bits{paramstore}{0} = $bf[0]; +$bits{paramtest}{0} = $bf[0]; @{$bits{pipe_op}}{3,2,1,0} = ($bf[5], $bf[5], $bf[5], $bf[5]); $bits{pop}{0} = $bf[0]; $bits{pos}{0} = $bf[0]; diff --git a/opcode.h b/opcode.h index d8d7fe67fc90..25df804d9c38 100644 --- a/opcode.h +++ b/opcode.h @@ -566,6 +566,9 @@ EXTCONST char* const PL_op_name[] INIT({ "methstart", "initfield", "classname", + "multiparam", + "paramtest", + "paramstore", "freed", }); @@ -988,6 +991,9 @@ EXTCONST char* const PL_op_desc[] INIT({ "method start", "initialise field", "class name", + "signature processing", + "signature argument value test", + "signature parameter default expression", "freed op", }); @@ -1415,6 +1421,9 @@ INIT({ Perl_pp_methstart, Perl_pp_initfield, Perl_pp_classname, + Perl_pp_multiparam, + Perl_pp_paramtest, + Perl_pp_paramstore, }); EXT Perl_check_t PL_check[] /* or perlvars.h */ @@ -1837,6 +1846,9 @@ INIT({ Perl_ck_null, /* methstart */ Perl_ck_null, /* initfield */ Perl_ck_classname, /* classname */ + Perl_ck_null, /* multiparam */ + Perl_ck_null, /* paramtest */ + Perl_ck_null, /* paramstore */ }); EXTCONST U32 PL_opargs[] INIT({ @@ -2258,6 +2270,9 @@ EXTCONST U32 PL_opargs[] INIT({ 0x00000f00, /* methstart */ 0x00000f00, /* initfield */ 0x00000008, /* classname */ + 0x00000f00, /* multiparam */ + 0x00000300, /* paramtest */ + 0x00000100, /* paramstore */ }); END_EXTERN_C @@ -2981,6 +2996,9 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { 265, /* methstart */ 267, /* initfield */ -1, /* classname */ + 0, /* multiparam */ + 0, /* paramtest */ + 0, /* paramstore */ }; @@ -2999,7 +3017,7 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { */ EXTCONST U16 PL_op_private_bitdefs[] = { - 0x0003, /* scalar, prototype, refgen, srefgen, readline, regcmaybe, regcreset, regcomp, substcont, chop, schop, defined, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, not, ucfirst, lcfirst, uc, lc, quotemeta, aeach, avalues, each, pop, shift, grepstart, anywhile, mapstart, mapwhile, range, and, or, dor, andassign, orassign, dorassign, argcheck, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, fc, anonconst, cmpchain_and, cmpchain_dup, entertrycatch, catch, is_bool, is_weak, weaken, unweaken, is_tainted */ + 0x0003, /* scalar, prototype, refgen, srefgen, readline, regcmaybe, regcreset, regcomp, substcont, chop, schop, defined, study, preinc, i_preinc, predec, i_predec, postinc, i_postinc, postdec, i_postdec, not, ucfirst, lcfirst, uc, lc, quotemeta, aeach, avalues, each, pop, shift, grepstart, anywhile, mapstart, mapwhile, range, and, or, dor, andassign, orassign, dorassign, argcheck, untie, tied, dbmclose, getsockname, getpeername, lstat, stat, readlink, readdir, telldir, rewinddir, closedir, localtime, alarm, require, dofile, entertry, ghbyname, gnbyname, gpbyname, shostent, snetent, sprotoent, sservent, gpwnam, gpwuid, ggrnam, ggrgid, lock, once, fc, anonconst, cmpchain_and, cmpchain_dup, entertrycatch, catch, is_bool, is_weak, weaken, unweaken, is_tainted, multiparam, paramtest, paramstore */ 0x3cfc, 0x5379, /* pushmark */ 0x00bd, /* wantarray, runcv */ 0x077e, 0x0554, 0x1b70, 0x542c, 0x4fc8, 0x4225, /* const */ @@ -3507,6 +3525,9 @@ EXTCONST U8 PL_op_private_valid[] = { /* METHSTART */ (OPpARG1_MASK|OPpINITFIELDS), /* INITFIELD */ (OPpARG1_MASK|OPpINITFIELD_AV|OPpINITFIELD_HV), /* CLASSNAME */ (0), + /* MULTIPARAM */ (OPpARG1_MASK), + /* PARAMTEST */ (OPpARG1_MASK), + /* PARAMSTORE */ (OPpARG1_MASK), }; diff --git a/opnames.h b/opnames.h index 79ff2b40ddad..62aaa488a470 100644 --- a/opnames.h +++ b/opnames.h @@ -432,6 +432,9 @@ typedef enum opcode { OP_METHSTART = 415, OP_INITFIELD = 416, OP_CLASSNAME = 417, + OP_MULTIPARAM = 418, + OP_PARAMTEST = 419, + OP_PARAMSTORE = 420, OP_max } opcode; @@ -442,7 +445,7 @@ An enum of all the legal Perl opcodes, defined in F =cut */ -#define MAXO 418 +#define MAXO 421 #define OP_FREED MAXO /* the OP_IS_* macros are optimized to a simple range check because diff --git a/pp.c b/pp.c index ebc80de38378..b132ac817694 100644 --- a/pp.c +++ b/pp.c @@ -7809,6 +7809,21 @@ PP(pp_argcheck) return NORMAL; } +PP(pp_multiparam) +{ + croak("TODO pp_multiparam"); +} + +PP(pp_paramtest) +{ + croak("TODO pp_paramtest"); +} + +PP(pp_paramstore) +{ + croak("TODO pp_paramstore"); +} + PP_wrapped(pp_isa, 2, 0) { dSP; diff --git a/pp_proto.h b/pp_proto.h index 239eb2f829de..3e8213f3032c 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -177,6 +177,7 @@ PERL_CALLCONV PP(pp_mkdir) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_modulo) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_multiconcat) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_multideref) __attribute__visibility__("hidden"); +PERL_CALLCONV PP(pp_multiparam) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_multiply) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_nbit_and) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_nbit_or) __attribute__visibility__("hidden"); @@ -201,6 +202,8 @@ PERL_CALLCONV PP(pp_padhv) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_padrange) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_padsv) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_padsv_store) __attribute__visibility__("hidden"); +PERL_CALLCONV PP(pp_paramstore) __attribute__visibility__("hidden"); +PERL_CALLCONV PP(pp_paramtest) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_pipe_op) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_poptry) __attribute__visibility__("hidden"); PERL_CALLCONV PP(pp_pos) __attribute__visibility__("hidden"); diff --git a/regen/opcodes b/regen/opcodes index 62e6de328db4..59c6e6aa0ad4 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -601,3 +601,7 @@ methstart method start ck_null + initfield initialise field ck_null + classname class name ck_classname 0t + +multiparam signature processing ck_null + +paramtest signature argument value test ck_null | +paramstore signature parameter default expression ck_null 1