| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* vi: set ft=c : */ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#define newAELEMOP(flags, first, key) S_newAELEMOP(aTHX_ flags, first, key) |
|
4
|
|
|
|
|
|
|
static OP *S_newAELEMOP(pTHX_ U32 flags, OP *first, I32 key) |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
#if HAVE_PERL_VERSION(5,16,0) |
|
7
|
|
|
|
|
|
|
if(key >= -128 && key < 128 && first->op_type == OP_PADAV) { |
|
8
|
|
|
|
|
|
|
OP *o = newOP(OP_AELEMFAST_LEX, flags); |
|
9
|
|
|
|
|
|
|
o->op_private = (I8)key; |
|
10
|
|
|
|
|
|
|
o->op_targ = first->op_targ; |
|
11
|
|
|
|
|
|
|
op_free(first); |
|
12
|
|
|
|
|
|
|
return o; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
#endif |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return newBINOP(OP_AELEM, flags, first, newSVOP(OP_CONST, 0, newSViv(key))); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#if HAVE_PERL_VERSION(5, 22, 0) |
|
20
|
|
|
|
|
|
|
# define HAVE_UNOP_AUX |
|
21
|
|
|
|
|
|
|
#endif |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#ifndef HAVE_UNOP_AUX |
|
24
|
|
|
|
|
|
|
typedef struct UNOP_with_IV { |
|
25
|
|
|
|
|
|
|
UNOP baseop; |
|
26
|
|
|
|
|
|
|
IV iv; |
|
27
|
|
|
|
|
|
|
} UNOP_with_IV; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#define newUNOP_with_IV(type, flags, first, iv) S_newUNOP_with_IV(aTHX_ type, flags, first, iv) |
|
30
|
|
|
|
|
|
|
static OP *S_newUNOP_with_IV(pTHX_ I32 type, I32 flags, OP *first, IV iv) |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
|
|
|
|
|
|
/* Cargoculted from perl's op.c:Perl_newUNOP() |
|
33
|
|
|
|
|
|
|
*/ |
|
34
|
|
|
|
|
|
|
UNOP_with_IV *op = PerlMemShared_malloc(sizeof(UNOP_with_IV) * 1); |
|
35
|
|
|
|
|
|
|
NewOp(1101, op, 1, UNOP_with_IV); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if(!first) |
|
38
|
|
|
|
|
|
|
first = newOP(OP_STUB, 0); |
|
39
|
|
|
|
|
|
|
UNOP *unop = (UNOP *)op; |
|
40
|
|
|
|
|
|
|
unop->op_type = (OPCODE)type; |
|
41
|
|
|
|
|
|
|
unop->op_first = first; |
|
42
|
|
|
|
|
|
|
unop->op_ppaddr = NULL; |
|
43
|
|
|
|
|
|
|
unop->op_flags = (U8)flags | OPf_KIDS; |
|
44
|
|
|
|
|
|
|
unop->op_private = (U8)(1 | (flags >> 8)); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
op->iv = iv; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return (OP *)op; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
#endif |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#define newMETHOD_REDIR_OP(rclass, methname, flags) S_newMETHOD_REDIR_OP(aTHX_ rclass, methname, flags) |
|
53
|
|
|
|
|
|
|
static OP *S_newMETHOD_REDIR_OP(pTHX_ SV *rclass, SV *methname, I32 flags) |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
|
|
|
|
|
|
#if HAVE_PERL_VERSION(5, 22, 0) |
|
56
|
|
|
|
|
|
|
OP *op = newMETHOP_named(OP_METHOD_REDIR, flags, methname); |
|
57
|
|
|
|
|
|
|
# ifdef USE_ITHREADS |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
|
|
|
|
|
|
/* cargoculted from S_op_relocate_sv() */ |
|
60
|
|
|
|
|
|
|
PADOFFSET ix = pad_alloc(OP_CONST, SVf_READONLY); |
|
61
|
|
|
|
|
|
|
PAD_SETSV(ix, rclass); |
|
62
|
|
|
|
|
|
|
cMETHOPx(op)->op_rclass_targ = ix; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
# else |
|
65
|
|
|
|
|
|
|
cMETHOPx(op)->op_rclass_sv = rclass; |
|
66
|
|
|
|
|
|
|
# endif |
|
67
|
|
|
|
|
|
|
#else |
|
68
|
|
|
|
|
|
|
OP *op = newUNOP(OP_METHOD, flags, |
|
69
|
|
|
|
|
|
|
newSVOP(OP_CONST, 0, newSVpvf("%" SVf "::%" SVf, rclass, methname))); |
|
70
|
|
|
|
|
|
|
#endif |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return op; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
/* If `@_` is called "snail", then elements of it can be called "slugs"; i.e. |
|
76
|
|
|
|
|
|
|
* snails without their container |
|
77
|
|
|
|
|
|
|
*/ |
|
78
|
|
|
|
|
|
|
#define newSLUGOP(idx) S_newSLUGOP(aTHX_ idx) |
|
79
|
|
|
|
|
|
|
static OP *S_newSLUGOP(pTHX_ int idx) |
|
80
|
|
|
|
|
|
|
{ |
|
81
|
6
|
|
|
|
|
|
OP *op = newGVOP(OP_AELEMFAST, 0, PL_defgv); |
|
82
|
6
|
|
|
|
|
|
op->op_private = idx; |
|
83
|
|
|
|
|
|
|
return op; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#ifndef newLISTOPn |
|
87
|
|
|
|
|
|
|
/* newLISTOPn was added in 5.39.3 */ |
|
88
|
|
|
|
|
|
|
# define newLISTOPn(type, flags, ...) S_newLISTOPn(aTHX_ type, flags, __VA_ARGS__) |
|
89
|
12
|
|
|
|
|
|
static OP *S_newLISTOPn(pTHX_ OPCODE type, U32 flags, ...) |
|
90
|
|
|
|
|
|
|
{ |
|
91
|
|
|
|
|
|
|
va_list args; |
|
92
|
12
|
|
|
|
|
|
va_start(args, flags); |
|
93
|
|
|
|
|
|
|
|
|
94
|
12
|
|
|
|
|
|
OP *o = newLISTOP(OP_LIST, 0, NULL, NULL); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
OP *kid; |
|
97
|
35
|
50
|
|
|
|
|
while((kid = va_arg(args, OP *))) |
|
|
|
100
|
|
|
|
|
|
|
98
|
23
|
|
|
|
|
|
o = op_append_elem(OP_LIST, o, kid); |
|
99
|
|
|
|
|
|
|
|
|
100
|
12
|
|
|
|
|
|
va_end(args); |
|
101
|
|
|
|
|
|
|
|
|
102
|
12
|
|
|
|
|
|
return op_convert_list(type, flags, o); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
#endif |