line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* -*- mode:C tab-width:4 -*- */ |
2
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT |
3
|
|
|
|
|
|
|
#include "EXTERN.h" |
4
|
|
|
|
|
|
|
#include "perl.h" |
5
|
|
|
|
|
|
|
#include "perlapi.h" |
6
|
|
|
|
|
|
|
#include "XSUB.h" |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#ifdef PERL_OBJECT |
10
|
|
|
|
|
|
|
# undef PL_op_name |
11
|
|
|
|
|
|
|
# undef PL_opargs |
12
|
|
|
|
|
|
|
# undef PL_op_desc |
13
|
|
|
|
|
|
|
# define PL_op_name (get_op_names()) |
14
|
|
|
|
|
|
|
# define PL_opargs (get_opargs()) |
15
|
|
|
|
|
|
|
# define PL_op_desc (get_op_descs()) |
16
|
|
|
|
|
|
|
#endif |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
/* CPAN #28912: MSWin32 and AIX as only platforms do not export PERL_CORE functions, |
19
|
|
|
|
|
|
|
such as Perl_pad_alloc, Perl_cv_clone, fold_constants, |
20
|
|
|
|
|
|
|
so disable this feature. cygwin gcc-3 --export-all-symbols was non-strict, gcc-4 is. |
21
|
|
|
|
|
|
|
POSIX with export PERL_DL_NONLAZY=1 also fails. This is checked in Makefile.PL |
22
|
|
|
|
|
|
|
but cannot be solved for clients adding it. |
23
|
|
|
|
|
|
|
TODO: Add the patchlevel here when it is fixed in CORE. |
24
|
|
|
|
|
|
|
*/ |
25
|
|
|
|
|
|
|
#if !defined (DISABLE_PERL_CORE_EXPORTED) && \ |
26
|
|
|
|
|
|
|
(defined(WIN32) || \ |
27
|
|
|
|
|
|
|
defined(_MSC_VER) || defined(__MINGW32_VERSION) || \ |
28
|
|
|
|
|
|
|
(defined(__CYGWIN__) && (__GNUC__ > 3)) || defined(AIX)) |
29
|
|
|
|
|
|
|
# define DISABLE_PERL_CORE_EXPORTED |
30
|
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#ifdef DISABLE_PERL_CORE_EXPORTED |
33
|
|
|
|
|
|
|
# undef HAVE_PAD_ALLOC |
34
|
|
|
|
|
|
|
# undef HAVE_CV_CLONE |
35
|
|
|
|
|
|
|
# undef HAVE_FOLD_CONSTANTS |
36
|
|
|
|
|
|
|
#endif |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#ifdef PERL_CUSTOM_OPS |
39
|
|
|
|
|
|
|
# define CHECK_CUSTOM_OPS \ |
40
|
|
|
|
|
|
|
if (typenum == OP_CUSTOM) \ |
41
|
|
|
|
|
|
|
o->op_ppaddr = custom_op_ppaddr(SvPV_nolen(type)); |
42
|
|
|
|
|
|
|
#else |
43
|
|
|
|
|
|
|
# define CHECK_CUSTOM_OPS |
44
|
|
|
|
|
|
|
#endif |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#ifndef PadARRAY |
47
|
|
|
|
|
|
|
#undef HAVE_PADNAMELIST |
48
|
|
|
|
|
|
|
# if PERL_VERSION < 8 || (PERL_VERSION == 8 && !PERL_SUBVERSION) |
49
|
|
|
|
|
|
|
typedef AV PADLIST; |
50
|
|
|
|
|
|
|
typedef AV PAD; |
51
|
|
|
|
|
|
|
# endif |
52
|
|
|
|
|
|
|
# define PadlistARRAY(pl) ((PAD **)AvARRAY(pl)) |
53
|
|
|
|
|
|
|
# define PadlistNAMES(pl) (*PadlistARRAY(pl)) |
54
|
|
|
|
|
|
|
# define PadARRAY AvARRAY |
55
|
|
|
|
|
|
|
# define PadnamelistMAX AvFILLp |
56
|
|
|
|
|
|
|
# define PadnamelistARRAY AvARRAY |
57
|
|
|
|
|
|
|
#else |
58
|
|
|
|
|
|
|
#define HAVE_PADNAMELIST |
59
|
|
|
|
|
|
|
#endif |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#ifndef SvIS_FREED |
62
|
|
|
|
|
|
|
# define SvIS_FREED(sv) ((sv)->sv_flags == SVTYPEMASK) |
63
|
|
|
|
|
|
|
#endif |
64
|
|
|
|
|
|
|
#ifndef OpSIBLING |
65
|
|
|
|
|
|
|
# ifdef PERL_OP_PARENT |
66
|
|
|
|
|
|
|
# define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL) |
67
|
|
|
|
|
|
|
# define OpSIBLING_set(o, v) ((o)->op_moresib ? (o)->op_sibparent = (v) : NULL) |
68
|
|
|
|
|
|
|
# else |
69
|
|
|
|
|
|
|
# define OpSIBLING(o) (o)->op_sibling |
70
|
|
|
|
|
|
|
# define OpSIBLING_set(o, v) (o)->op_sibling = (v) |
71
|
|
|
|
|
|
|
# endif |
72
|
|
|
|
|
|
|
#else |
73
|
|
|
|
|
|
|
# ifndef OpSIBLING_set |
74
|
|
|
|
|
|
|
# define OpSIBLING_set(o, v) OpMORESIB_set((o), (v)) |
75
|
|
|
|
|
|
|
# endif |
76
|
|
|
|
|
|
|
#endif |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#ifndef CvISXSUB |
79
|
|
|
|
|
|
|
# ifdef CvXSUB |
80
|
|
|
|
|
|
|
# define CvISXSUB(cv) CvXSUB(cv) |
81
|
|
|
|
|
|
|
# else |
82
|
|
|
|
|
|
|
# error no CvISXSUB nor CvXSUB |
83
|
|
|
|
|
|
|
# endif |
84
|
|
|
|
|
|
|
#endif |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
static const char* const svclassnames[] = { |
87
|
|
|
|
|
|
|
"B::NULL", |
88
|
|
|
|
|
|
|
#if PERL_VERSION >= 9 && PERL_VERSION < 19 |
89
|
|
|
|
|
|
|
"B::BIND", |
90
|
|
|
|
|
|
|
#endif |
91
|
|
|
|
|
|
|
"B::IV", |
92
|
|
|
|
|
|
|
"B::NV", |
93
|
|
|
|
|
|
|
#if PERL_VERSION <= 10 |
94
|
|
|
|
|
|
|
"B::RV", |
95
|
|
|
|
|
|
|
#endif |
96
|
|
|
|
|
|
|
"B::PV", |
97
|
|
|
|
|
|
|
#if PERL_VERSION >= 19 |
98
|
|
|
|
|
|
|
"B::INVLIST", |
99
|
|
|
|
|
|
|
#endif |
100
|
|
|
|
|
|
|
"B::PVIV", |
101
|
|
|
|
|
|
|
"B::PVNV", |
102
|
|
|
|
|
|
|
"B::PVMG", |
103
|
|
|
|
|
|
|
#if PERL_VERSION <= 8 |
104
|
|
|
|
|
|
|
"B::BM", |
105
|
|
|
|
|
|
|
#endif |
106
|
|
|
|
|
|
|
#if PERL_VERSION >= 11 |
107
|
|
|
|
|
|
|
"B::REGEXP", |
108
|
|
|
|
|
|
|
#endif |
109
|
|
|
|
|
|
|
#if PERL_VERSION >= 9 |
110
|
|
|
|
|
|
|
"B::GV", |
111
|
|
|
|
|
|
|
#endif |
112
|
|
|
|
|
|
|
"B::PVLV", |
113
|
|
|
|
|
|
|
"B::AV", |
114
|
|
|
|
|
|
|
"B::HV", |
115
|
|
|
|
|
|
|
"B::CV", |
116
|
|
|
|
|
|
|
#if PERL_VERSION <= 8 |
117
|
|
|
|
|
|
|
"B::GV", |
118
|
|
|
|
|
|
|
#endif |
119
|
|
|
|
|
|
|
"B::FM", |
120
|
|
|
|
|
|
|
"B::IO", |
121
|
|
|
|
|
|
|
}; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
typedef enum { |
124
|
|
|
|
|
|
|
OPc_NULL, /* 0 */ |
125
|
|
|
|
|
|
|
OPc_BASEOP, /* 1 */ |
126
|
|
|
|
|
|
|
OPc_UNOP, /* 2 */ |
127
|
|
|
|
|
|
|
OPc_BINOP, /* 3 */ |
128
|
|
|
|
|
|
|
OPc_LOGOP, /* 4 */ |
129
|
|
|
|
|
|
|
OPc_LISTOP, /* 5 */ |
130
|
|
|
|
|
|
|
OPc_PMOP, /* 6 */ |
131
|
|
|
|
|
|
|
OPc_SVOP, /* 7 */ |
132
|
|
|
|
|
|
|
OPc_PADOP, /* 8 */ |
133
|
|
|
|
|
|
|
OPc_PVOP, /* 9 */ |
134
|
|
|
|
|
|
|
OPc_CVOP, /* 10 */ |
135
|
|
|
|
|
|
|
OPc_LOOP, /* 11 */ |
136
|
|
|
|
|
|
|
OPc_COP, /* 12 */ |
137
|
|
|
|
|
|
|
OPc_METHOP, /* 13 */ |
138
|
|
|
|
|
|
|
OPc_UNOP_AUX /* 14 */ |
139
|
|
|
|
|
|
|
} opclass; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
static char *opclassnames[] = { |
142
|
|
|
|
|
|
|
"B::NULL", |
143
|
|
|
|
|
|
|
"B::OP", |
144
|
|
|
|
|
|
|
"B::UNOP", |
145
|
|
|
|
|
|
|
"B::BINOP", |
146
|
|
|
|
|
|
|
"B::LOGOP", |
147
|
|
|
|
|
|
|
"B::LISTOP", |
148
|
|
|
|
|
|
|
"B::PMOP", |
149
|
|
|
|
|
|
|
"B::SVOP", |
150
|
|
|
|
|
|
|
"B::PADOP", |
151
|
|
|
|
|
|
|
"B::PVOP", |
152
|
|
|
|
|
|
|
"B::CVOP", |
153
|
|
|
|
|
|
|
"B::LOOP", |
154
|
|
|
|
|
|
|
"B::COP", |
155
|
|
|
|
|
|
|
"B::METHOP", |
156
|
|
|
|
|
|
|
"B::UNOP_AUX" |
157
|
|
|
|
|
|
|
}; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
static int walkoptree_debug = 0; /* Flag for walkoptree debug hook */ |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
static SV *specialsv_list[7]; /* 0-6 */ |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
AV * tmp_comppad; |
164
|
|
|
|
|
|
|
#ifdef HAVE_PADNAMELIST |
165
|
|
|
|
|
|
|
PADNAMELIST * tmp_comppad_name; |
166
|
|
|
|
|
|
|
#else |
167
|
|
|
|
|
|
|
AV * tmp_comppad_name; |
168
|
|
|
|
|
|
|
#endif |
169
|
|
|
|
|
|
|
I32 tmp_padix, tmp_reset_pending; |
170
|
|
|
|
|
|
|
OP * tmp_op; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
CV * my_curr_cv = NULL; |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
SV** my_current_pad; |
175
|
|
|
|
|
|
|
SV** tmp_pad; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
HV* root_cache; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
#define GEN_PAD { set_active_sub(find_cv_by_root((OP*)o));tmp_pad = PL_curpad;PL_curpad = my_current_pad;} |
180
|
|
|
|
|
|
|
#define GEN_PAD_CV(cv) { set_active_sub(cv);tmp_pad = PL_curpad;PL_curpad = my_current_pad;} |
181
|
|
|
|
|
|
|
#define OLD_PAD (PL_curpad = tmp_pad) |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
#define SAVE_VARS \ |
184
|
|
|
|
|
|
|
{ \ |
185
|
|
|
|
|
|
|
tmp_comppad = PL_comppad; \ |
186
|
|
|
|
|
|
|
tmp_comppad_name = PL_comppad_name; \ |
187
|
|
|
|
|
|
|
tmp_padix = PL_padix; \ |
188
|
|
|
|
|
|
|
tmp_reset_pending = PL_pad_reset_pending; \ |
189
|
|
|
|
|
|
|
tmp_pad = PL_curpad; \ |
190
|
|
|
|
|
|
|
tmp_op = PL_op; \ |
191
|
|
|
|
|
|
|
if ( my_curr_cv) { \ |
192
|
|
|
|
|
|
|
PL_comppad = PadlistARRAY(CvPADLIST(my_curr_cv))[1]; \ |
193
|
|
|
|
|
|
|
PL_comppad_name = PadlistNAMES(CvPADLIST(my_curr_cv)); \ |
194
|
|
|
|
|
|
|
PL_padix = PadnamelistMAX(PL_comppad_name); \ |
195
|
|
|
|
|
|
|
PL_pad_reset_pending = 0; \ |
196
|
|
|
|
|
|
|
} \ |
197
|
|
|
|
|
|
|
PL_curpad = AvARRAY(PL_comppad); \ |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
#define RESTORE_VARS \ |
201
|
|
|
|
|
|
|
{ \ |
202
|
|
|
|
|
|
|
PL_op = tmp_op; \ |
203
|
|
|
|
|
|
|
PL_comppad = tmp_comppad; \ |
204
|
|
|
|
|
|
|
PL_curpad = tmp_pad; \ |
205
|
|
|
|
|
|
|
PL_padix = tmp_padix; \ |
206
|
|
|
|
|
|
|
PL_comppad_name = tmp_comppad_name; \ |
207
|
|
|
|
|
|
|
PL_pad_reset_pending = tmp_reset_pending; \ |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
void |
211
|
0
|
|
|
|
|
|
set_active_sub(SV *sv) |
212
|
|
|
|
|
|
|
{ |
213
|
|
|
|
|
|
|
dTHX; |
214
|
|
|
|
|
|
|
PADLIST* padlist; |
215
|
|
|
|
|
|
|
PAD** svp; |
216
|
|
|
|
|
|
|
/* sv_dump(SvRV(sv)); */ |
217
|
0
|
|
|
|
|
|
padlist = CvPADLIST(SvRV(sv)); |
218
|
0
|
0
|
|
|
|
|
if (!padlist) { |
219
|
|
|
|
|
|
|
dTHX; /* XXX coverage 0 */ |
220
|
0
|
|
|
|
|
|
sv_dump(sv); |
221
|
0
|
|
|
|
|
|
sv_dump((SV*)SvRV(sv)); |
222
|
0
|
|
|
|
|
|
croak("set_active_sub: !CvPADLIST(SvRV(sv))"); |
223
|
|
|
|
|
|
|
} |
224
|
0
|
|
|
|
|
|
svp = PadlistARRAY(padlist); |
225
|
0
|
|
|
|
|
|
my_current_pad = PadARRAY(svp[1]); /* => GEN_PAD */ |
226
|
0
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
static SV * |
229
|
3
|
|
|
|
|
|
find_cv_by_root(OP* o) { |
230
|
|
|
|
|
|
|
dTHX; |
231
|
3
|
|
|
|
|
|
OP* root = o; |
232
|
|
|
|
|
|
|
SV* key; |
233
|
|
|
|
|
|
|
HE* cached; |
234
|
|
|
|
|
|
|
|
235
|
3
|
50
|
|
|
|
|
if (PL_compcv && SvTYPE(PL_compcv) == SVt_PVCV && !PL_eval_root) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
236
|
|
|
|
|
|
|
/* XXX coverage 0 */ |
237
|
0
|
0
|
|
|
|
|
if (SvROK(PL_compcv)) { |
238
|
0
|
|
|
|
|
|
sv_dump(SvRV(PL_compcv)); |
239
|
0
|
|
|
|
|
|
croak("find_cv_by_root: SvROK(PL_compcv)"); |
240
|
|
|
|
|
|
|
} |
241
|
0
|
|
|
|
|
|
return newRV((SV*)PL_compcv); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
3
|
100
|
|
|
|
|
if (!root_cache) |
245
|
2
|
|
|
|
|
|
root_cache = newHV(); |
246
|
|
|
|
|
|
|
|
247
|
143
|
100
|
|
|
|
|
while(root->op_next) |
248
|
140
|
|
|
|
|
|
root = root->op_next; |
249
|
|
|
|
|
|
|
|
250
|
3
|
|
|
|
|
|
key = newSViv(PTR2IV(root)); |
251
|
|
|
|
|
|
|
|
252
|
3
|
|
|
|
|
|
cached = hv_fetch_ent(root_cache, key, 0, 0); |
253
|
3
|
100
|
|
|
|
|
if (cached) { |
254
|
1
|
|
|
|
|
|
SvREFCNT_dec(key); |
255
|
1
|
|
|
|
|
|
return HeVAL(cached); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
2
|
100
|
|
|
|
|
if (PL_main_root == root) { |
259
|
|
|
|
|
|
|
/* Special case, this is the main root */ |
260
|
1
|
|
|
|
|
|
cached = hv_store_ent(root_cache, key, newRV((SV*)PL_main_cv), 0); |
261
|
1
|
50
|
|
|
|
|
} else if (PL_eval_root == root && PL_compcv) { |
|
|
0
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
SV* tmpcv = (SV*)NEWSV(1104,0); /* XXX coverage 0 */ |
263
|
0
|
|
|
|
|
|
sv_upgrade((SV *)tmpcv, SVt_PVCV); |
264
|
0
|
|
|
|
|
|
CvPADLIST(tmpcv) = CvPADLIST(PL_compcv); |
265
|
0
|
|
|
|
|
|
SvREFCNT_inc(CvPADLIST(tmpcv)); |
266
|
0
|
|
|
|
|
|
CvROOT(tmpcv) = root; |
267
|
|
|
|
|
|
|
OP_REFCNT_LOCK; |
268
|
0
|
0
|
|
|
|
|
OpREFCNT_inc(root); |
269
|
|
|
|
|
|
|
OP_REFCNT_UNLOCK; |
270
|
0
|
|
|
|
|
|
cached = hv_store_ent(root_cache, key, newRV((SV*)tmpcv), 0); |
271
|
|
|
|
|
|
|
} else { |
272
|
|
|
|
|
|
|
/* Need to walk the symbol table, yay */ |
273
|
1
|
|
|
|
|
|
CV* cv = 0; |
274
|
|
|
|
|
|
|
SV* sva; |
275
|
|
|
|
|
|
|
SV* sv; |
276
|
|
|
|
|
|
|
register SV* svend; |
277
|
|
|
|
|
|
|
|
278
|
278
|
50
|
|
|
|
|
for (sva = PL_sv_arenaroot; sva; sva = (SV*)SvANY(sva)) { |
279
|
278
|
|
|
|
|
|
svend = &sva[SvREFCNT(sva)]; |
280
|
47113
|
100
|
|
|
|
|
for (sv = sva + 1; sv < svend; ++sv) { |
281
|
46836
|
100
|
|
|
|
|
if (!SvIS_FREED(sv) && SvREFCNT(sv)) { |
|
|
50
|
|
|
|
|
|
282
|
46737
|
100
|
|
|
|
|
if (SvTYPE(sv) == SVt_PVCV && |
|
|
100
|
|
|
|
|
|
283
|
3016
|
|
|
|
|
|
CvROOT(sv) == root |
284
|
|
|
|
|
|
|
) { |
285
|
1
|
|
|
|
|
|
cv = (CV*) sv; |
286
|
1
|
|
|
|
|
|
goto out; |
287
|
46736
|
100
|
|
|
|
|
} else if ( SvTYPE(sv) == SVt_PVGV && |
|
|
50
|
|
|
|
|
|
288
|
|
|
|
|
|
|
#if PERL_VERSION >= 10 |
289
|
3643
|
50
|
|
|
|
|
isGV_with_GP(sv) && |
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
290
|
|
|
|
|
|
|
#endif |
291
|
3643
|
100
|
|
|
|
|
GvGP(sv) && |
292
|
2877
|
50
|
|
|
|
|
GvCV(sv) && !SvVALID(sv) && !CvXSUB(GvCV(sv)) && |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
293
|
55
|
|
|
|
|
|
CvROOT(GvCV(sv)) == root) |
294
|
|
|
|
|
|
|
{ |
295
|
0
|
|
|
|
|
|
cv = (CV*) GvCV(sv); /* XXX coverage 0 */ |
296
|
0
|
|
|
|
|
|
goto out; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
|
302
|
0
|
0
|
|
|
|
|
if (!cv) { |
303
|
0
|
|
|
|
|
|
croak("find_cv_by_root: couldn't find the root cv\n"); /* XXX coverage 0 */ |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
out: |
306
|
1
|
|
|
|
|
|
cached = hv_store_ent(root_cache, key, newRV((SV*)cv), 0); |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
2
|
|
|
|
|
|
SvREFCNT_dec(key); |
310
|
2
|
|
|
|
|
|
return (SV*) HeVAL(cached); |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
static SV * |
315
|
1217
|
|
|
|
|
|
make_sv_object(pTHX_ SV *arg, SV *sv) |
316
|
|
|
|
|
|
|
{ |
317
|
1217
|
|
|
|
|
|
char *type = 0; |
318
|
|
|
|
|
|
|
IV iv; |
319
|
|
|
|
|
|
|
|
320
|
9736
|
100
|
|
|
|
|
for (iv = 0; iv < sizeof(specialsv_list)/sizeof(SV*); iv++) { |
321
|
8519
|
50
|
|
|
|
|
if (sv == specialsv_list[iv]) { |
322
|
0
|
|
|
|
|
|
type = "B::SPECIAL"; /* XXX coverage 0 */ |
323
|
0
|
|
|
|
|
|
break; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
} |
326
|
1217
|
50
|
|
|
|
|
if (!type) { |
327
|
1217
|
|
|
|
|
|
type = (char*)svclassnames[SvTYPE(sv)]; |
328
|
1217
|
|
|
|
|
|
iv = PTR2IV(sv); |
329
|
|
|
|
|
|
|
} |
330
|
1217
|
|
|
|
|
|
sv_setiv(newSVrv(arg, type), iv); |
331
|
1217
|
|
|
|
|
|
return arg; |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
/* |
336
|
|
|
|
|
|
|
#define PERL_CUSTOM_OPS |
337
|
|
|
|
|
|
|
now defined by Makefile.PL, if building for 5.8.x |
338
|
|
|
|
|
|
|
*/ |
339
|
|
|
|
|
|
|
static I32 |
340
|
6
|
|
|
|
|
|
op_name_to_num(SV * name) |
341
|
|
|
|
|
|
|
{ |
342
|
|
|
|
|
|
|
dTHX; |
343
|
|
|
|
|
|
|
char const *s; |
344
|
6
|
50
|
|
|
|
|
char *wanted = SvPV_nolen(name); |
345
|
6
|
|
|
|
|
|
int i =0; |
346
|
6
|
|
|
|
|
|
int topop = OP_max; |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
#ifdef PERL_CUSTOM_OPS |
349
|
6
|
|
|
|
|
|
topop--; |
350
|
|
|
|
|
|
|
#endif |
351
|
|
|
|
|
|
|
|
352
|
6
|
50
|
|
|
|
|
if (SvIOK(name) && SvIV(name) >= 0 && SvIV(name) < topop) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
353
|
0
|
0
|
|
|
|
|
return SvIV(name); /* XXX coverage 0 */ |
354
|
|
|
|
|
|
|
|
355
|
707
|
50
|
|
|
|
|
for (s = PL_op_name[i]; s; s = PL_op_name[++i]) { |
356
|
707
|
100
|
|
|
|
|
if (strEQ(s, wanted)) |
357
|
6
|
|
|
|
|
|
return i; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
#ifdef PERL_CUSTOM_OPS |
360
|
0
|
0
|
|
|
|
|
if (PL_custom_op_names) { |
361
|
|
|
|
|
|
|
HE* ent; |
362
|
|
|
|
|
|
|
SV* value; |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
/* This is sort of a hv_exists, backwards - since custom-ops |
365
|
|
|
|
|
|
|
are stored using their pp-addr as key, we must scan the |
366
|
|
|
|
|
|
|
values */ |
367
|
0
|
|
|
|
|
|
(void)hv_iterinit(PL_custom_op_names); |
368
|
0
|
0
|
|
|
|
|
while ((ent = hv_iternext(PL_custom_op_names))) { |
369
|
0
|
0
|
|
|
|
|
if (strEQ(SvPV_nolen(hv_iterval(PL_custom_op_names,ent)),wanted)) |
|
|
0
|
|
|
|
|
|
370
|
0
|
|
|
|
|
|
return OP_CUSTOM; |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
#endif |
374
|
|
|
|
|
|
|
|
375
|
0
|
0
|
|
|
|
|
croak("No such op \"%s\"", SvPV_nolen(name)); /* XXX coverage 0 */ |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
return -1; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
#ifdef PERL_CUSTOM_OPS |
381
|
|
|
|
|
|
|
static void* |
382
|
0
|
|
|
|
|
|
custom_op_ppaddr(char *name) |
383
|
|
|
|
|
|
|
{ |
384
|
|
|
|
|
|
|
dTHX; |
385
|
|
|
|
|
|
|
HE *ent; |
386
|
|
|
|
|
|
|
SV *value; |
387
|
0
|
0
|
|
|
|
|
if (!PL_custom_op_names) |
388
|
0
|
|
|
|
|
|
return 0; |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
/* This is sort of a hv_fetch, backwards */ |
391
|
0
|
|
|
|
|
|
(void)hv_iterinit(PL_custom_op_names); |
392
|
0
|
0
|
|
|
|
|
while ((ent = hv_iternext(PL_custom_op_names))) { |
393
|
0
|
0
|
|
|
|
|
if (strEQ(SvPV_nolen(hv_iterval(PL_custom_op_names,ent)),name)) |
|
|
0
|
|
|
|
|
|
394
|
0
|
0
|
|
|
|
|
return INT2PTR(void*,SvIV(hv_iterkeysv(ent))); |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
|
397
|
0
|
|
|
|
|
|
return 0; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
#endif |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
static opclass |
402
|
43162
|
|
|
|
|
|
cc_opclass(pTHX_ const OP *o) |
403
|
|
|
|
|
|
|
{ |
404
|
43162
|
|
|
|
|
|
bool custom = 0; |
405
|
|
|
|
|
|
|
|
406
|
43162
|
100
|
|
|
|
|
if (!o) |
407
|
4328
|
|
|
|
|
|
return OPc_NULL; |
408
|
|
|
|
|
|
|
|
409
|
38834
|
100
|
|
|
|
|
if (o->op_type == 0) |
410
|
1132
|
100
|
|
|
|
|
return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP; |
411
|
|
|
|
|
|
|
|
412
|
37702
|
100
|
|
|
|
|
if (o->op_type == OP_SASSIGN) |
413
|
262
|
50
|
|
|
|
|
return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP); |
414
|
|
|
|
|
|
|
|
415
|
37440
|
50
|
|
|
|
|
if (o->op_type == OP_AELEMFAST) { |
416
|
0
|
0
|
|
|
|
|
if (o->op_flags & OPf_SPECIAL) |
417
|
0
|
|
|
|
|
|
return OPc_BASEOP; |
418
|
|
|
|
|
|
|
else |
419
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
420
|
|
|
|
|
|
|
return OPc_PADOP; |
421
|
|
|
|
|
|
|
#else |
422
|
0
|
|
|
|
|
|
return OPc_SVOP; |
423
|
|
|
|
|
|
|
#endif |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
427
|
|
|
|
|
|
|
if (o->op_type == OP_GV || o->op_type == OP_GVSV |
428
|
|
|
|
|
|
|
|| o->op_type == OP_RCATLINE) |
429
|
|
|
|
|
|
|
return OPc_PADOP; |
430
|
|
|
|
|
|
|
#endif |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
#ifdef PERL_CUSTOM_OPS |
433
|
37440
|
50
|
|
|
|
|
if (o->op_type == OP_CUSTOM) |
434
|
0
|
|
|
|
|
|
custom = 1; |
435
|
|
|
|
|
|
|
#endif |
436
|
|
|
|
|
|
|
|
437
|
37440
|
|
|
|
|
|
switch (PL_opargs[o->op_type] & OA_CLASS_MASK) { |
438
|
|
|
|
|
|
|
case OA_BASEOP: |
439
|
6617
|
|
|
|
|
|
return OPc_BASEOP; |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
case OA_UNOP: |
442
|
8080
|
|
|
|
|
|
return OPc_UNOP; |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
case OA_BINOP: |
445
|
592
|
|
|
|
|
|
return OPc_BINOP; |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
case OA_LOGOP: |
448
|
2047
|
|
|
|
|
|
return OPc_LOGOP; |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
case OA_LISTOP: |
451
|
6910
|
|
|
|
|
|
return OPc_LISTOP; |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
case OA_PMOP: |
454
|
8
|
|
|
|
|
|
return OPc_PMOP; |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
case OA_SVOP: |
457
|
3261
|
|
|
|
|
|
return OPc_SVOP; |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
case OA_PVOP_OR_SVOP: |
460
|
|
|
|
|
|
|
/* |
461
|
|
|
|
|
|
|
* Character translations (tr///) are usually a PVOP, keeping a |
462
|
|
|
|
|
|
|
* pointer to a table of shorts used to look up translations. |
463
|
|
|
|
|
|
|
* Under utf8, however, a simple table isn't practical; instead, |
464
|
|
|
|
|
|
|
* the OP is an SVOP (or, under threads, a PADOP), |
465
|
|
|
|
|
|
|
* and the SV is a reference to a swash |
466
|
|
|
|
|
|
|
* (i.e., an RV pointing to an HV). |
467
|
|
|
|
|
|
|
*/ |
468
|
0
|
0
|
|
|
|
|
return (!custom && |
|
|
0
|
|
|
|
|
|
469
|
0
|
|
|
|
|
|
(o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF)) |
470
|
|
|
|
|
|
|
) |
471
|
|
|
|
|
|
|
#if defined(USE_ITHREADS) \ |
472
|
|
|
|
|
|
|
&& (PERL_VERSION > 8 || (PERL_VERSION == 8 && PERL_SUBVERSION >= 9)) |
473
|
|
|
|
|
|
|
? OPc_PADOP : OPc_PVOP; |
474
|
|
|
|
|
|
|
#else |
475
|
|
|
|
|
|
|
? OPc_SVOP : OPc_PVOP; |
476
|
|
|
|
|
|
|
#endif |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
case OA_LOOP: |
479
|
26
|
|
|
|
|
|
return OPc_LOOP; |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
case OA_COP: |
482
|
7962
|
|
|
|
|
|
return OPc_COP; |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
#if PERL_VERSION >= 22 |
485
|
|
|
|
|
|
|
case OA_METHOP: |
486
|
1666
|
|
|
|
|
|
return OPc_METHOP; |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
case OA_UNOP_AUX: |
489
|
18
|
|
|
|
|
|
return OPc_UNOP_AUX; |
490
|
|
|
|
|
|
|
#endif |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
case OA_BASEOP_OR_UNOP: |
493
|
|
|
|
|
|
|
/* |
494
|
|
|
|
|
|
|
* UNI(OP_foo) in toke.c returns token UNI or FUNC1 depending on |
495
|
|
|
|
|
|
|
* whether parens were seen. perly.y uses OPf_SPECIAL to |
496
|
|
|
|
|
|
|
* signal whether a BASEOP had empty parens or none. |
497
|
|
|
|
|
|
|
* Some other UNOPs are created later, though, so the best |
498
|
|
|
|
|
|
|
* test is OPf_KIDS, which is set in newUNOP. |
499
|
|
|
|
|
|
|
*/ |
500
|
253
|
100
|
|
|
|
|
return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP; |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
case OA_FILESTATOP: |
503
|
|
|
|
|
|
|
/* |
504
|
|
|
|
|
|
|
* The file stat OPs are created via UNI(OP_foo) in toke.c but use |
505
|
|
|
|
|
|
|
* the OPf_REF flag to distinguish between OP types instead of the |
506
|
|
|
|
|
|
|
* usual OPf_SPECIAL flag. As usual, if OPf_KIDS is set, then we |
507
|
|
|
|
|
|
|
* return OPc_UNOP so that walkoptree can find our children. If |
508
|
|
|
|
|
|
|
* OPf_KIDS is not set then we check OPf_REF. Without OPf_REF set |
509
|
|
|
|
|
|
|
* (no argument to the operator) it's an OP; with OPf_REF set it's |
510
|
|
|
|
|
|
|
* an SVOP (and op_sv is the GV for the filehandle argument). |
511
|
|
|
|
|
|
|
*/ |
512
|
0
|
0
|
|
|
|
|
return ((o->op_flags & OPf_KIDS) ? OPc_UNOP : |
|
|
0
|
|
|
|
|
|
513
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
514
|
|
|
|
|
|
|
(o->op_flags & OPf_REF) ? OPc_PADOP : OPc_BASEOP); |
515
|
|
|
|
|
|
|
#else |
516
|
0
|
|
|
|
|
|
(o->op_flags & OPf_REF) ? OPc_SVOP : OPc_BASEOP); |
517
|
|
|
|
|
|
|
#endif |
518
|
|
|
|
|
|
|
case OA_LOOPEXOP: |
519
|
|
|
|
|
|
|
/* |
520
|
|
|
|
|
|
|
* next, last, redo, dump and goto use OPf_SPECIAL to indicate that a |
521
|
|
|
|
|
|
|
* label was omitted (in which case it's a BASEOP) or else a term was |
522
|
|
|
|
|
|
|
* seen. In this last case, all except goto are definitely PVOP but |
523
|
|
|
|
|
|
|
* goto is either a PVOP (with an ordinary constant label), an UNOP |
524
|
|
|
|
|
|
|
* with OPf_STACKED (with a non-constant non-sub) or an UNOP for |
525
|
|
|
|
|
|
|
* OP_REFGEN (with goto &sub) in which case OPf_STACKED also seems to |
526
|
|
|
|
|
|
|
* get set. |
527
|
|
|
|
|
|
|
*/ |
528
|
0
|
0
|
|
|
|
|
if (o->op_flags & OPf_STACKED) |
529
|
0
|
|
|
|
|
|
return OPc_UNOP; |
530
|
0
|
0
|
|
|
|
|
else if (o->op_flags & OPf_SPECIAL) |
531
|
0
|
|
|
|
|
|
return OPc_BASEOP; |
532
|
|
|
|
|
|
|
else |
533
|
0
|
|
|
|
|
|
return OPc_PVOP; |
534
|
|
|
|
|
|
|
} |
535
|
0
|
0
|
|
|
|
|
warn("can't determine class of operator %s, assuming BASEOP\n", |
536
|
0
|
|
|
|
|
|
OP_NAME(o)); |
537
|
0
|
|
|
|
|
|
return OPc_BASEOP; |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
static char * |
541
|
43162
|
|
|
|
|
|
cc_opclassname(pTHX_ OP *o) |
542
|
|
|
|
|
|
|
{ |
543
|
43162
|
|
|
|
|
|
return opclassnames[cc_opclass(aTHX_ o)]; |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
static OP * |
547
|
8
|
|
|
|
|
|
SVtoO(SV* sv) |
548
|
|
|
|
|
|
|
{ |
549
|
|
|
|
|
|
|
dTHX; |
550
|
8
|
50
|
|
|
|
|
if (SvROK(sv)) { |
551
|
8
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv)); |
552
|
8
|
|
|
|
|
|
return INT2PTR(OP*,tmp); |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
else { |
555
|
0
|
|
|
|
|
|
return 0; |
556
|
|
|
|
|
|
|
} |
557
|
|
|
|
|
|
|
croak("Argument is not a reference"); |
558
|
|
|
|
|
|
|
return 0; /* Not reached */ |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
/* svop_new */ |
562
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
|
SV *__svop_new(pTHX_ SV *class, SV *type, I32 flags, SV *sv) |
564
|
|
|
|
|
|
|
{ |
565
|
|
|
|
|
|
|
OP *o; |
566
|
|
|
|
|
|
|
SV *result; |
567
|
|
|
|
|
|
|
SV **sparepad; |
568
|
|
|
|
|
|
|
OP *saveop; |
569
|
|
|
|
|
|
|
I32 typenum; |
570
|
|
|
|
|
|
|
|
571
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
572
|
0
|
|
|
|
|
|
sparepad = PL_curpad; |
573
|
0
|
|
|
|
|
|
PL_curpad = AvARRAY(PL_comppad); |
574
|
0
|
|
|
|
|
|
saveop = PL_op; |
575
|
0
|
|
|
|
|
|
typenum = op_name_to_num(type); /* XXX More classes here! */ |
576
|
0
|
0
|
|
|
|
|
if (typenum == OP_GVSV) { |
577
|
0
|
0
|
|
|
|
|
if (*(SvPV_nolen(sv)) == '$') |
|
|
0
|
|
|
|
|
|
578
|
0
|
|
|
|
|
|
sv = (SV*)gv_fetchpv(SvPVX(sv)+1, TRUE, SVt_PV); |
579
|
|
|
|
|
|
|
else |
580
|
0
|
|
|
|
|
|
croak("First character to GVSV was not dollar"); |
581
|
|
|
|
|
|
|
} else { |
582
|
0
|
0
|
|
|
|
|
if (SvTYPE(sv) != SVt_PVCV) { |
583
|
0
|
|
|
|
|
|
sv = newSVsv(sv); /* copy it unless it's cv */ |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
} |
586
|
0
|
|
|
|
|
|
o = newSVOP(typenum, flags, SvREFCNT_inc(sv)); |
587
|
0
|
0
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
588
|
0
|
|
|
|
|
|
RESTORE_VARS; |
589
|
0
|
|
|
|
|
|
result = sv_newmortal(); |
590
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(result, "B::SVOP"), PTR2IV(o)); |
591
|
0
|
|
|
|
|
|
return result; |
592
|
|
|
|
|
|
|
} |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
/* Pre-5.7 compatibility */ |
595
|
|
|
|
|
|
|
#ifndef op_clear |
596
|
0
|
|
|
|
|
|
void op_clear(OP* o) { |
597
|
|
|
|
|
|
|
/* Fake it, I'm bored */ |
598
|
0
|
|
|
|
|
|
croak("This operation requires a newer version of Perl"); |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
#endif |
601
|
|
|
|
|
|
|
#ifndef op_null |
602
|
|
|
|
|
|
|
# define op_null croak("This operation requires a newer version of Perl"); |
603
|
|
|
|
|
|
|
#endif |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
#ifndef PM_GETRE |
606
|
|
|
|
|
|
|
# define PM_GETRE(o) ((o)->op_pmregexp) |
607
|
|
|
|
|
|
|
#endif |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
typedef OP *B__OP; |
610
|
|
|
|
|
|
|
typedef UNOP *B__UNOP; |
611
|
|
|
|
|
|
|
typedef BINOP *B__BINOP; |
612
|
|
|
|
|
|
|
typedef LOGOP *B__LOGOP; |
613
|
|
|
|
|
|
|
typedef LISTOP *B__LISTOP; |
614
|
|
|
|
|
|
|
typedef PMOP *B__PMOP; |
615
|
|
|
|
|
|
|
typedef SVOP *B__SVOP; |
616
|
|
|
|
|
|
|
typedef PADOP *B__PADOP; |
617
|
|
|
|
|
|
|
typedef PVOP *B__PVOP; |
618
|
|
|
|
|
|
|
typedef LOOP *B__LOOP; |
619
|
|
|
|
|
|
|
typedef COP *B__COP; |
620
|
|
|
|
|
|
|
#if PERL_VERSION >= 22 |
621
|
|
|
|
|
|
|
typedef METHOP *B__METHOP; |
622
|
|
|
|
|
|
|
typedef UNOP_AUX *B__UNOP_AUX; |
623
|
|
|
|
|
|
|
typedef UNOP_AUX_item *B__UNOP_AUX_item; |
624
|
|
|
|
|
|
|
#endif |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
typedef SV *B__SV; |
627
|
|
|
|
|
|
|
typedef SV *B__IV; |
628
|
|
|
|
|
|
|
typedef SV *B__PV; |
629
|
|
|
|
|
|
|
typedef SV *B__NV; |
630
|
|
|
|
|
|
|
typedef SV *B__PVMG; |
631
|
|
|
|
|
|
|
typedef SV *B__PVLV; |
632
|
|
|
|
|
|
|
typedef SV *B__BM; |
633
|
|
|
|
|
|
|
typedef SV *B__RV; |
634
|
|
|
|
|
|
|
typedef AV *B__AV; |
635
|
|
|
|
|
|
|
typedef HV *B__HV; |
636
|
|
|
|
|
|
|
typedef CV *B__CV; |
637
|
|
|
|
|
|
|
typedef GV *B__GV; |
638
|
|
|
|
|
|
|
typedef IO *B__IO; |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
typedef MAGIC *B__MAGIC; |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B PREFIX = B_ |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
# XXX coverage 0 |
645
|
|
|
|
|
|
|
void |
646
|
|
|
|
|
|
|
B_fudge() |
647
|
|
|
|
|
|
|
CODE: |
648
|
0
|
0
|
|
|
|
|
SSCHECK(2); |
649
|
0
|
|
|
|
|
|
SSPUSHPTR((SV*)PL_comppad); |
650
|
0
|
|
|
|
|
|
SSPUSHINT(SAVEt_COMPPAD); |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
# coverage ok |
653
|
|
|
|
|
|
|
B::OP |
654
|
|
|
|
|
|
|
B_main_root(...) |
655
|
|
|
|
|
|
|
PROTOTYPE: ;$ |
656
|
|
|
|
|
|
|
CODE: |
657
|
5
|
50
|
|
|
|
|
if (items > 0) |
658
|
0
|
|
|
|
|
|
PL_main_root = SVtoO(ST(0)); |
659
|
5
|
|
|
|
|
|
RETVAL = PL_main_root; |
660
|
|
|
|
|
|
|
OUTPUT: |
661
|
|
|
|
|
|
|
RETVAL |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
# coverage ok |
664
|
|
|
|
|
|
|
B::OP |
665
|
|
|
|
|
|
|
B_main_start(...) |
666
|
|
|
|
|
|
|
PROTOTYPE: ;$ |
667
|
|
|
|
|
|
|
CODE: |
668
|
6
|
50
|
|
|
|
|
if (items > 0) |
669
|
0
|
|
|
|
|
|
PL_main_start = SVtoO(ST(0)); |
670
|
6
|
|
|
|
|
|
RETVAL = PL_main_start; |
671
|
|
|
|
|
|
|
OUTPUT: |
672
|
|
|
|
|
|
|
RETVAL |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
# XXX coverage 0 |
675
|
|
|
|
|
|
|
SV * |
676
|
|
|
|
|
|
|
B_cv_pad(...) |
677
|
|
|
|
|
|
|
CV * old_cv = NO_INIT |
678
|
|
|
|
|
|
|
PROTOTYPE: ;$ |
679
|
|
|
|
|
|
|
CODE: |
680
|
0
|
|
|
|
|
|
old_cv = my_curr_cv; |
681
|
0
|
0
|
|
|
|
|
if (items > 0) { |
682
|
0
|
0
|
|
|
|
|
if (SvROK(ST(0))) { |
683
|
|
|
|
|
|
|
IV tmp; |
684
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(ST(0), "B::CV")) |
685
|
0
|
|
|
|
|
|
croak("Reference is not a B::CV object"); |
686
|
0
|
0
|
|
|
|
|
tmp = SvIV((SV*)SvRV(ST(0))); |
687
|
0
|
|
|
|
|
|
my_curr_cv = INT2PTR(CV*,tmp); |
688
|
|
|
|
|
|
|
} else { |
689
|
0
|
|
|
|
|
|
my_curr_cv = NULL; |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
|
693
|
0
|
0
|
|
|
|
|
if ( old_cv ) { |
694
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
695
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::CV"), PTR2IV(old_cv)); |
696
|
|
|
|
|
|
|
} else { |
697
|
0
|
|
|
|
|
|
ST(0) = &PL_sv_undef; |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
#define OP_desc(o) (char* const)PL_op_desc[o->op_type] |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::OP PREFIX = OP_ |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
# coverage: basic.t |
705
|
|
|
|
|
|
|
B::CV |
706
|
|
|
|
|
|
|
OP_find_cv(o) |
707
|
|
|
|
|
|
|
B::OP o |
708
|
|
|
|
|
|
|
CODE: |
709
|
3
|
|
|
|
|
|
RETVAL = (CV*)SvRV(find_cv_by_root((OP*)o)); |
710
|
|
|
|
|
|
|
OUTPUT: |
711
|
|
|
|
|
|
|
RETVAL |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
# coverage ok |
714
|
|
|
|
|
|
|
B::OP |
715
|
|
|
|
|
|
|
OP_next(o, ...) |
716
|
|
|
|
|
|
|
B::OP o |
717
|
|
|
|
|
|
|
CODE: |
718
|
5481
|
100
|
|
|
|
|
if (items > 1) |
719
|
6
|
|
|
|
|
|
o->op_next = SVtoO(ST(1)); |
720
|
5481
|
|
|
|
|
|
RETVAL = o->op_next; |
721
|
|
|
|
|
|
|
OUTPUT: |
722
|
|
|
|
|
|
|
RETVAL |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
# coverage ok |
725
|
|
|
|
|
|
|
B::OP |
726
|
|
|
|
|
|
|
OP_sibling(o, ...) |
727
|
|
|
|
|
|
|
B::OP o |
728
|
|
|
|
|
|
|
CODE: |
729
|
11649
|
100
|
|
|
|
|
if (items > 1) |
730
|
2
|
|
|
|
|
|
OpSIBLING_set(o, SVtoO(ST(1))); |
731
|
11649
|
100
|
|
|
|
|
RETVAL = OpSIBLING(o); |
732
|
|
|
|
|
|
|
OUTPUT: |
733
|
|
|
|
|
|
|
RETVAL |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
#ifdef PERL_OP_PARENT |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
# XXX coverage 0 |
738
|
|
|
|
|
|
|
B::OP |
739
|
|
|
|
|
|
|
OP_sibparent(o, ...) |
740
|
|
|
|
|
|
|
B::OP o |
741
|
|
|
|
|
|
|
CODE: |
742
|
0
|
0
|
|
|
|
|
if (items > 1) |
743
|
0
|
|
|
|
|
|
OpLASTSIB_set(o, SVtoO(ST(1))); |
744
|
0
|
|
|
|
|
|
RETVAL = o->op_sibparent; |
745
|
|
|
|
|
|
|
OUTPUT: |
746
|
|
|
|
|
|
|
RETVAL |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
#endif |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
# XXX coverage 0 |
751
|
|
|
|
|
|
|
IV |
752
|
|
|
|
|
|
|
OP_ppaddr(o, ...) |
753
|
|
|
|
|
|
|
B::OP o |
754
|
|
|
|
|
|
|
CODE: |
755
|
0
|
0
|
|
|
|
|
if (items > 1) |
756
|
0
|
0
|
|
|
|
|
o->op_ppaddr = INT2PTR(void*,SvIV(ST(1))); |
757
|
0
|
|
|
|
|
|
RETVAL = PTR2IV((void*)(o->op_ppaddr)); |
758
|
|
|
|
|
|
|
OUTPUT: |
759
|
|
|
|
|
|
|
RETVAL |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
# XXX coverage 0 |
762
|
|
|
|
|
|
|
char * |
763
|
|
|
|
|
|
|
OP_desc(o) |
764
|
|
|
|
|
|
|
B::OP o |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
# XXX coverage 50% |
767
|
|
|
|
|
|
|
PADOFFSET |
768
|
|
|
|
|
|
|
OP_targ(o, ...) |
769
|
|
|
|
|
|
|
B::OP o |
770
|
|
|
|
|
|
|
CODE: |
771
|
1831
|
100
|
|
|
|
|
if (items > 1) |
772
|
1
|
50
|
|
|
|
|
o->op_targ = (PADOFFSET)SvIV(ST(1)); |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
/* begin highly experimental */ /* XXX coverage 0 */ |
775
|
1831
|
100
|
|
|
|
|
if (items > 1 && (SvIV(ST(1)) > 1000 || SvIV(ST(1)) & 0x80000000)) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
776
|
0
|
0
|
|
|
|
|
PADLIST *padlist = INT2PTR(PADLIST*,SvIV(ST(1))); |
777
|
|
|
|
|
|
|
|
778
|
0
|
|
|
|
|
|
I32 old_padix = PL_padix; |
779
|
0
|
|
|
|
|
|
I32 old_comppad_name_fill = PL_comppad_name_fill; |
780
|
0
|
|
|
|
|
|
I32 old_min_intro_pending = PL_min_intro_pending; |
781
|
0
|
|
|
|
|
|
I32 old_max_intro_pending = PL_max_intro_pending; |
782
|
|
|
|
|
|
|
/* int old_cv_has_eval = PL_cv_has_eval; */ |
783
|
0
|
|
|
|
|
|
I32 old_pad_reset_pending = PL_pad_reset_pending; |
784
|
0
|
|
|
|
|
|
SV **old_curpad = PL_curpad; |
785
|
0
|
|
|
|
|
|
AV *old_comppad = PL_comppad; |
786
|
|
|
|
|
|
|
#ifdef HAVE_PADNAMELIST |
787
|
0
|
|
|
|
|
|
PADNAMELIST *old_comppad_name = PL_comppad_name; |
788
|
|
|
|
|
|
|
#else |
789
|
|
|
|
|
|
|
AV *old_comppad_name = PL_comppad_name; |
790
|
|
|
|
|
|
|
#endif |
791
|
|
|
|
|
|
|
/* PTR2UV */ |
792
|
|
|
|
|
|
|
|
793
|
0
|
|
|
|
|
|
PL_comppad_name = PadlistNAMES(padlist); |
794
|
0
|
|
|
|
|
|
PL_comppad = PadlistARRAY(padlist)[1]; |
795
|
0
|
|
|
|
|
|
PL_curpad = AvARRAY(PL_comppad); |
796
|
|
|
|
|
|
|
|
797
|
0
|
|
|
|
|
|
PL_padix = PadnamelistMAX(PL_comppad_name); |
798
|
0
|
|
|
|
|
|
PL_pad_reset_pending = 0; |
799
|
|
|
|
|
|
|
/* PL_comppad_name_fill appears irrelevant as long as you |
800
|
|
|
|
|
|
|
stick to pad_alloc, pad_swipe, pad_free. |
801
|
|
|
|
|
|
|
* PL_comppad_name_fill = 0; |
802
|
|
|
|
|
|
|
* PL_min_intro_pending = 0; |
803
|
|
|
|
|
|
|
* PL_cv_has_eval = 0; |
804
|
|
|
|
|
|
|
*/ |
805
|
|
|
|
|
|
|
#ifdef HAVE_PAD_ALLOC |
806
|
0
|
|
|
|
|
|
o->op_targ = Perl_pad_alloc(aTHX_ 0, SVs_PADTMP); |
807
|
|
|
|
|
|
|
#else |
808
|
|
|
|
|
|
|
/* CPAN #28912: MSWin32 does not export Perl_pad_alloc. |
809
|
|
|
|
|
|
|
Rewrite from Perl_pad_alloc for PADTMP: |
810
|
|
|
|
|
|
|
Scan the pad from PL_padix upwards for a slot which |
811
|
|
|
|
|
|
|
has no name and no active value. */ |
812
|
|
|
|
|
|
|
{ |
813
|
|
|
|
|
|
|
SV *sv; |
814
|
|
|
|
|
|
|
# if PERL_VERSION > 18 |
815
|
|
|
|
|
|
|
PADNAME * const * const names = PadnamelistARRAY(PL_comppad_name); |
816
|
|
|
|
|
|
|
const SSize_t names_fill = PadnamelistMAX(PL_comppad_name); |
817
|
|
|
|
|
|
|
for (;;) { |
818
|
|
|
|
|
|
|
PADNAME *pn; |
819
|
|
|
|
|
|
|
if (++PL_padix <= names_fill && |
820
|
|
|
|
|
|
|
(pn = names[PL_padix]) && PadnamePV(pn)) |
821
|
|
|
|
|
|
|
continue; |
822
|
|
|
|
|
|
|
sv = *av_fetch(PL_comppad, PL_padix, TRUE); |
823
|
|
|
|
|
|
|
if (!(SvFLAGS(sv) & SVs_PADTMP)) |
824
|
|
|
|
|
|
|
break; |
825
|
|
|
|
|
|
|
} |
826
|
|
|
|
|
|
|
# else |
827
|
|
|
|
|
|
|
SV * const * const names = PadnamelistARRAY(PL_comppad_name); |
828
|
|
|
|
|
|
|
const SSize_t names_fill = PadnamelistMAX(PL_comppad_name); |
829
|
|
|
|
|
|
|
for (;;) { |
830
|
|
|
|
|
|
|
if (++PL_padix <= names_fill && |
831
|
|
|
|
|
|
|
(sv = names[PL_padix]) && sv != &PL_sv_undef) |
832
|
|
|
|
|
|
|
continue; |
833
|
|
|
|
|
|
|
sv = *av_fetch(PL_comppad, PL_padix, TRUE); |
834
|
|
|
|
|
|
|
if (!(SvFLAGS(sv) & (SVs_PADTMP | SVs_PADMY)) && |
835
|
|
|
|
|
|
|
!IS_PADGV(sv) && !IS_PADCONST(sv)) |
836
|
|
|
|
|
|
|
break; |
837
|
|
|
|
|
|
|
} |
838
|
|
|
|
|
|
|
# endif |
839
|
|
|
|
|
|
|
o->op_targ = PL_padix; |
840
|
|
|
|
|
|
|
SvFLAGS(sv) |= SVs_PADTMP; |
841
|
|
|
|
|
|
|
} |
842
|
|
|
|
|
|
|
#endif |
843
|
0
|
|
|
|
|
|
PL_padix = old_padix; |
844
|
0
|
|
|
|
|
|
PL_comppad_name_fill = old_comppad_name_fill; |
845
|
0
|
|
|
|
|
|
PL_min_intro_pending = old_min_intro_pending; |
846
|
0
|
|
|
|
|
|
PL_max_intro_pending = old_max_intro_pending; |
847
|
|
|
|
|
|
|
/* PL_cv_has_eval = old_cv_has_eval; */ |
848
|
0
|
|
|
|
|
|
PL_pad_reset_pending = old_pad_reset_pending; |
849
|
0
|
|
|
|
|
|
PL_curpad = old_curpad; |
850
|
0
|
|
|
|
|
|
PL_comppad = old_comppad; |
851
|
0
|
|
|
|
|
|
PL_comppad_name = old_comppad_name; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
/* end highly experimental */ |
854
|
|
|
|
|
|
|
|
855
|
1831
|
|
|
|
|
|
RETVAL = o->op_targ; |
856
|
|
|
|
|
|
|
OUTPUT: |
857
|
|
|
|
|
|
|
RETVAL |
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
# coverage 50% |
860
|
|
|
|
|
|
|
U16 |
861
|
|
|
|
|
|
|
OP_type(o, ...) |
862
|
|
|
|
|
|
|
B::OP o |
863
|
|
|
|
|
|
|
CODE: |
864
|
93
|
50
|
|
|
|
|
if (items > 1) { |
865
|
0
|
0
|
|
|
|
|
o->op_type = (U16)SvIV(ST(1)); /* XXX coverage 0 */ |
866
|
0
|
|
|
|
|
|
o->op_ppaddr = PL_ppaddr[o->op_type]; |
867
|
|
|
|
|
|
|
} |
868
|
93
|
|
|
|
|
|
RETVAL = o->op_type; |
869
|
|
|
|
|
|
|
OUTPUT: |
870
|
|
|
|
|
|
|
RETVAL |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
#if PERL_VERSION < 10 |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
U16 |
875
|
|
|
|
|
|
|
OP_seq(o, ...) |
876
|
|
|
|
|
|
|
B::OP o |
877
|
|
|
|
|
|
|
CODE: |
878
|
|
|
|
|
|
|
if (items > 1) |
879
|
|
|
|
|
|
|
o->op_seq = (U16)SvIV(ST(1)); |
880
|
|
|
|
|
|
|
RETVAL = o->op_seq; |
881
|
|
|
|
|
|
|
OUTPUT: |
882
|
|
|
|
|
|
|
RETVAL |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
#endif |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
# coverage ok |
887
|
|
|
|
|
|
|
U8 |
888
|
|
|
|
|
|
|
OP_flags(o, ...) |
889
|
|
|
|
|
|
|
B::OP o |
890
|
|
|
|
|
|
|
CODE: |
891
|
6490
|
50
|
|
|
|
|
if (items > 1) |
892
|
0
|
0
|
|
|
|
|
o->op_flags = (U8)SvIV(ST(1)); |
893
|
6490
|
|
|
|
|
|
RETVAL = o->op_flags; |
894
|
|
|
|
|
|
|
OUTPUT: |
895
|
|
|
|
|
|
|
RETVAL |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
# coverage ok |
898
|
|
|
|
|
|
|
U8 |
899
|
|
|
|
|
|
|
OP_private(o, ...) |
900
|
|
|
|
|
|
|
B::OP o |
901
|
|
|
|
|
|
|
CODE: |
902
|
1679
|
50
|
|
|
|
|
if (items > 1) |
903
|
0
|
0
|
|
|
|
|
o->op_private = (U8)SvIV(ST(1)); |
904
|
1679
|
|
|
|
|
|
RETVAL = o->op_private; |
905
|
|
|
|
|
|
|
OUTPUT: |
906
|
|
|
|
|
|
|
RETVAL |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
# XXX coverage 0 |
909
|
|
|
|
|
|
|
void |
910
|
|
|
|
|
|
|
OP_dump(o) |
911
|
|
|
|
|
|
|
B::OP o |
912
|
|
|
|
|
|
|
CODE: |
913
|
0
|
|
|
|
|
|
op_dump(o); |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
# XXX coverage 0 |
916
|
|
|
|
|
|
|
void |
917
|
|
|
|
|
|
|
OP_clean(o) |
918
|
|
|
|
|
|
|
B::OP o |
919
|
|
|
|
|
|
|
CODE: |
920
|
0
|
0
|
|
|
|
|
if (o == PL_main_root) |
921
|
0
|
|
|
|
|
|
o->op_next = Nullop; |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
# XXX coverage 0 |
924
|
|
|
|
|
|
|
void |
925
|
|
|
|
|
|
|
OP_new(class, type, flags) |
926
|
|
|
|
|
|
|
SV * class |
927
|
|
|
|
|
|
|
SV * type |
928
|
|
|
|
|
|
|
I32 flags |
929
|
|
|
|
|
|
|
OP *o = NO_INIT |
930
|
|
|
|
|
|
|
I32 typenum = NO_INIT |
931
|
|
|
|
|
|
|
CODE: |
932
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
933
|
0
|
|
|
|
|
|
typenum = op_name_to_num(type); |
934
|
0
|
|
|
|
|
|
o = newOP(typenum, flags); |
935
|
0
|
0
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
936
|
0
|
|
|
|
|
|
RESTORE_VARS; |
937
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
938
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::OP"), PTR2IV(o)); |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
# XXX coverage 0 |
941
|
|
|
|
|
|
|
void |
942
|
|
|
|
|
|
|
OP_newstate(class, flags, label, oldo) |
943
|
|
|
|
|
|
|
SV * class |
944
|
|
|
|
|
|
|
I32 flags |
945
|
|
|
|
|
|
|
char * label |
946
|
|
|
|
|
|
|
B::OP oldo |
947
|
|
|
|
|
|
|
OP *o = NO_INIT |
948
|
|
|
|
|
|
|
CODE: |
949
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
950
|
0
|
|
|
|
|
|
o = newSTATEOP(flags, label, oldo); |
951
|
0
|
|
|
|
|
|
RESTORE_VARS; |
952
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
953
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::LISTOP"), PTR2IV(o)); |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
# XXX coverage 0 |
956
|
|
|
|
|
|
|
B::OP |
957
|
|
|
|
|
|
|
OP_mutate(o, type) |
958
|
|
|
|
|
|
|
B::OP o |
959
|
|
|
|
|
|
|
SV* type |
960
|
|
|
|
|
|
|
I32 rtype = NO_INIT |
961
|
|
|
|
|
|
|
CODE: |
962
|
0
|
|
|
|
|
|
rtype = op_name_to_num(type); |
963
|
0
|
|
|
|
|
|
o->op_ppaddr = PL_ppaddr[rtype]; |
964
|
0
|
|
|
|
|
|
o->op_type = rtype; |
965
|
|
|
|
|
|
|
OUTPUT: |
966
|
|
|
|
|
|
|
o |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
# Introduced with change 34924, git change b7783a124ff |
969
|
|
|
|
|
|
|
# This works now only on non-MSWin32/AIX platforms and without PERL_DL_NONLAZY=1, |
970
|
|
|
|
|
|
|
# checked by DISABLE_PERL_CORE_EXPORTED |
971
|
|
|
|
|
|
|
# If you use such a platform, you have to fold the constants by yourself. |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
#if defined(HAVE_FOLD_CONSTANTS) && (PERL_VERSION >= 11) |
974
|
|
|
|
|
|
|
# define Perl_fold_constants S_fold_constants |
975
|
|
|
|
|
|
|
#endif |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
# XXX coverage 0, added with 0.07 |
978
|
|
|
|
|
|
|
B::OP |
979
|
|
|
|
|
|
|
OP_convert(o, type, flags) |
980
|
|
|
|
|
|
|
B::OP o |
981
|
|
|
|
|
|
|
I32 flags |
982
|
|
|
|
|
|
|
I32 type |
983
|
|
|
|
|
|
|
CODE: |
984
|
0
|
0
|
|
|
|
|
if (!o || o->op_type != OP_LIST) |
|
|
0
|
|
|
|
|
|
985
|
0
|
|
|
|
|
|
o = newLISTOP(OP_LIST, 0, o, Nullop); |
986
|
|
|
|
|
|
|
else |
987
|
0
|
|
|
|
|
|
o->op_flags &= ~OPf_WANT; |
988
|
|
|
|
|
|
|
|
989
|
0
|
0
|
|
|
|
|
if (!(PL_opargs[type] & OA_MARK) && o->op_type != OP_NULL) { |
|
|
0
|
|
|
|
|
|
990
|
0
|
|
|
|
|
|
op_clear(o); |
991
|
0
|
|
|
|
|
|
o->op_targ = o->op_type; |
992
|
|
|
|
|
|
|
} |
993
|
|
|
|
|
|
|
|
994
|
0
|
|
|
|
|
|
o->op_type = type; |
995
|
0
|
|
|
|
|
|
o->op_ppaddr = PL_ppaddr[type]; |
996
|
0
|
|
|
|
|
|
o->op_flags |= flags; |
997
|
|
|
|
|
|
|
|
998
|
0
|
|
|
|
|
|
o = PL_check[type](aTHX_ (OP*)o); |
999
|
|
|
|
|
|
|
#ifdef HAVE_FOLD_CONSTANTS |
1000
|
|
|
|
|
|
|
if (o->op_type == type) { |
1001
|
|
|
|
|
|
|
COP *cop = PL_curcop; |
1002
|
|
|
|
|
|
|
PL_curcop = &PL_compiling; |
1003
|
|
|
|
|
|
|
o = Perl_fold_constants(aTHX_ o); |
1004
|
|
|
|
|
|
|
PL_curcop = cop; |
1005
|
|
|
|
|
|
|
} |
1006
|
|
|
|
|
|
|
#endif |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
OUTPUT: |
1009
|
|
|
|
|
|
|
o |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::UNOP PREFIX = UNOP_ |
1012
|
|
|
|
|
|
|
|
1013
|
|
|
|
|
|
|
# coverage 50% |
1014
|
|
|
|
|
|
|
B::OP |
1015
|
|
|
|
|
|
|
UNOP_first(o, ...) |
1016
|
|
|
|
|
|
|
B::UNOP o |
1017
|
|
|
|
|
|
|
CODE: |
1018
|
19603
|
50
|
|
|
|
|
if (items > 1) |
1019
|
0
|
|
|
|
|
|
o->op_first = SVtoO(ST(1)); /* XXX coverage 0 */ |
1020
|
19603
|
|
|
|
|
|
RETVAL = o->op_first; |
1021
|
|
|
|
|
|
|
OUTPUT: |
1022
|
|
|
|
|
|
|
RETVAL |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
# XXX coverage 0 |
1025
|
|
|
|
|
|
|
void |
1026
|
|
|
|
|
|
|
UNOP_new(class, type, flags, sv_first) |
1027
|
|
|
|
|
|
|
SV * class |
1028
|
|
|
|
|
|
|
SV * type |
1029
|
|
|
|
|
|
|
I32 flags |
1030
|
|
|
|
|
|
|
SV * sv_first |
1031
|
|
|
|
|
|
|
OP *first = NO_INIT |
1032
|
|
|
|
|
|
|
OP *o = NO_INIT |
1033
|
|
|
|
|
|
|
I32 typenum = NO_INIT |
1034
|
|
|
|
|
|
|
CODE: |
1035
|
2
|
|
|
|
|
|
I32 padflag = 0; |
1036
|
2
|
50
|
|
|
|
|
if (SvROK(sv_first)) { |
1037
|
2
|
50
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1038
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1039
|
|
|
|
|
|
|
else { |
1040
|
2
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1041
|
2
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1042
|
|
|
|
|
|
|
} |
1043
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1044
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP->new should be a B::OP object or a false value"); |
1045
|
|
|
|
|
|
|
else |
1046
|
0
|
|
|
|
|
|
first = Nullop; |
1047
|
|
|
|
|
|
|
{ |
1048
|
|
|
|
|
|
|
|
1049
|
2
|
50
|
|
|
|
|
SAVE_VARS; |
1050
|
2
|
|
|
|
|
|
typenum = op_name_to_num(type); |
1051
|
|
|
|
|
|
|
{ |
1052
|
2
|
|
|
|
|
|
COP *cop = PL_curcop; |
1053
|
2
|
|
|
|
|
|
PL_curcop = &PL_compiling; |
1054
|
2
|
|
|
|
|
|
o = newUNOP(typenum, flags, first); |
1055
|
2
|
|
|
|
|
|
PL_curcop = cop; |
1056
|
|
|
|
|
|
|
} |
1057
|
2
|
50
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1058
|
2
|
|
|
|
|
|
RESTORE_VARS; |
1059
|
|
|
|
|
|
|
} |
1060
|
2
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1061
|
2
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::UNOP"), PTR2IV(o)); |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::BINOP PREFIX = BINOP_ |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
# XXX coverage 0 |
1066
|
|
|
|
|
|
|
void |
1067
|
|
|
|
|
|
|
BINOP_null(o) |
1068
|
|
|
|
|
|
|
B::BINOP o |
1069
|
|
|
|
|
|
|
CODE: |
1070
|
0
|
|
|
|
|
|
op_null((OP*)o); |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
# coverage 50% |
1073
|
|
|
|
|
|
|
B::OP |
1074
|
|
|
|
|
|
|
BINOP_last(o,...) |
1075
|
|
|
|
|
|
|
B::BINOP o |
1076
|
|
|
|
|
|
|
CODE: |
1077
|
271
|
50
|
|
|
|
|
if (items > 1) |
1078
|
0
|
|
|
|
|
|
o->op_last = SVtoO(ST(1)); /* XXX coverage 0 */ |
1079
|
271
|
|
|
|
|
|
RETVAL = o->op_last; |
1080
|
|
|
|
|
|
|
OUTPUT: |
1081
|
|
|
|
|
|
|
RETVAL |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
# coverage 50% |
1084
|
|
|
|
|
|
|
void |
1085
|
|
|
|
|
|
|
BINOP_new(class, type, flags, sv_first, sv_last) |
1086
|
|
|
|
|
|
|
SV * class |
1087
|
|
|
|
|
|
|
SV * type |
1088
|
|
|
|
|
|
|
I32 flags |
1089
|
|
|
|
|
|
|
SV * sv_first |
1090
|
|
|
|
|
|
|
SV * sv_last |
1091
|
|
|
|
|
|
|
OP *first = NO_INIT |
1092
|
|
|
|
|
|
|
OP *last = NO_INIT |
1093
|
|
|
|
|
|
|
OP *o = NO_INIT |
1094
|
|
|
|
|
|
|
CODE: |
1095
|
2
|
100
|
|
|
|
|
if (SvROK(sv_first)) { |
1096
|
1
|
50
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1097
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1098
|
|
|
|
|
|
|
else { |
1099
|
1
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1100
|
1
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1101
|
|
|
|
|
|
|
} |
1102
|
1
|
50
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1103
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP->new should be a B::OP object or a false value"); |
1104
|
|
|
|
|
|
|
else |
1105
|
1
|
|
|
|
|
|
first = Nullop; |
1106
|
|
|
|
|
|
|
|
1107
|
2
|
100
|
|
|
|
|
if (SvROK(sv_last)) { |
1108
|
1
|
50
|
|
|
|
|
if (!sv_derived_from(sv_last, "B::OP")) |
1109
|
0
|
|
|
|
|
|
croak("Reference 'last' was not a B::OP object"); |
1110
|
|
|
|
|
|
|
else { |
1111
|
1
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_last)); |
1112
|
1
|
|
|
|
|
|
last = INT2PTR(OP*, tmp); |
1113
|
|
|
|
|
|
|
} |
1114
|
1
|
50
|
|
|
|
|
} else if (SvTRUE(sv_last)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1115
|
0
|
|
|
|
|
|
croak("'last' argument to B::BINOP->new should be a B::OP object or a false value"); |
1116
|
|
|
|
|
|
|
else |
1117
|
1
|
|
|
|
|
|
last = Nullop; |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
{ |
1120
|
2
|
|
|
|
|
|
I32 typenum = op_name_to_num(type); |
1121
|
|
|
|
|
|
|
|
1122
|
2
|
50
|
|
|
|
|
SAVE_VARS; |
1123
|
|
|
|
|
|
|
|
1124
|
2
|
50
|
|
|
|
|
if (typenum == OP_SASSIGN || typenum == OP_AASSIGN) |
|
|
50
|
|
|
|
|
|
1125
|
0
|
|
|
|
|
|
o = newASSIGNOP(flags, first, 0, last); |
1126
|
|
|
|
|
|
|
else { |
1127
|
2
|
|
|
|
|
|
COP *cop = PL_curcop; |
1128
|
2
|
|
|
|
|
|
PL_curcop = &PL_compiling; |
1129
|
2
|
|
|
|
|
|
o = newBINOP(typenum, flags, first, last); |
1130
|
2
|
|
|
|
|
|
PL_curcop = cop; |
1131
|
2
|
50
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
} |
1133
|
|
|
|
|
|
|
|
1134
|
2
|
|
|
|
|
|
RESTORE_VARS; |
1135
|
|
|
|
|
|
|
} |
1136
|
2
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1137
|
2
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::BINOP"), PTR2IV(o)); |
1138
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::LISTOP PREFIX = LISTOP_ |
1140
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
# coverage scope.t |
1142
|
|
|
|
|
|
|
void |
1143
|
|
|
|
|
|
|
LISTOP_new(class, type, flags, sv_first, sv_last) |
1144
|
|
|
|
|
|
|
SV * class |
1145
|
|
|
|
|
|
|
SV * type |
1146
|
|
|
|
|
|
|
I32 flags |
1147
|
|
|
|
|
|
|
SV * sv_first |
1148
|
|
|
|
|
|
|
SV * sv_last |
1149
|
|
|
|
|
|
|
OP *first = NO_INIT |
1150
|
|
|
|
|
|
|
OP *last = NO_INIT |
1151
|
|
|
|
|
|
|
OP *o = NO_INIT |
1152
|
|
|
|
|
|
|
CODE: |
1153
|
1
|
50
|
|
|
|
|
if (SvROK(sv_first)) { |
1154
|
1
|
50
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1155
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1156
|
|
|
|
|
|
|
else { |
1157
|
1
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1158
|
1
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1159
|
|
|
|
|
|
|
} |
1160
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1161
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP->new should be a B::OP object or a false value"); |
1162
|
|
|
|
|
|
|
else |
1163
|
0
|
|
|
|
|
|
first = Nullop; |
1164
|
|
|
|
|
|
|
|
1165
|
1
|
50
|
|
|
|
|
if (SvROK(sv_last)) { |
1166
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_last, "B::OP")) |
1167
|
0
|
|
|
|
|
|
croak("Reference 'last' was not a B::OP object"); |
1168
|
|
|
|
|
|
|
else { |
1169
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_last)); |
1170
|
0
|
|
|
|
|
|
last = INT2PTR(OP*, tmp); |
1171
|
|
|
|
|
|
|
} |
1172
|
1
|
50
|
|
|
|
|
} else if (SvTRUE(sv_last)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1173
|
0
|
|
|
|
|
|
croak("'last' argument to B::BINOP->new should be a B::OP object or a false value"); |
1174
|
|
|
|
|
|
|
else |
1175
|
1
|
|
|
|
|
|
last = Nullop; |
1176
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
{ |
1178
|
1
|
|
|
|
|
|
I32 typenum = op_name_to_num(type); |
1179
|
|
|
|
|
|
|
|
1180
|
1
|
50
|
|
|
|
|
SAVE_VARS; |
1181
|
1
|
|
|
|
|
|
o = newLISTOP(typenum, flags, first, last); |
1182
|
1
|
50
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1183
|
1
|
|
|
|
|
|
RESTORE_VARS; |
1184
|
|
|
|
|
|
|
} |
1185
|
1
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1186
|
1
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::LISTOP"), PTR2IV(o)); |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::LOGOP PREFIX = LOGOP_ |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
# XXX coverage 0 |
1191
|
|
|
|
|
|
|
void |
1192
|
|
|
|
|
|
|
LOGOP_new(class, type, flags, sv_first, sv_last) |
1193
|
|
|
|
|
|
|
SV * class |
1194
|
|
|
|
|
|
|
SV * type |
1195
|
|
|
|
|
|
|
I32 flags |
1196
|
|
|
|
|
|
|
SV * sv_first |
1197
|
|
|
|
|
|
|
SV * sv_last |
1198
|
|
|
|
|
|
|
OP *first = NO_INIT |
1199
|
|
|
|
|
|
|
OP *last = NO_INIT |
1200
|
|
|
|
|
|
|
OP *o = NO_INIT |
1201
|
|
|
|
|
|
|
CODE: |
1202
|
0
|
0
|
|
|
|
|
if (SvROK(sv_first)) { |
1203
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1204
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1205
|
|
|
|
|
|
|
else { |
1206
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1207
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1208
|
|
|
|
|
|
|
} |
1209
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1210
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP->new should be a B::OP object or a false value"); |
1211
|
|
|
|
|
|
|
else |
1212
|
0
|
|
|
|
|
|
first = Nullop; |
1213
|
|
|
|
|
|
|
|
1214
|
0
|
0
|
|
|
|
|
if (SvROK(sv_last)) { |
1215
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_last, "B::OP")) |
1216
|
0
|
|
|
|
|
|
croak("Reference 'last' was not a B::OP object"); |
1217
|
|
|
|
|
|
|
else { |
1218
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_last)); |
1219
|
0
|
|
|
|
|
|
last = INT2PTR(OP*, tmp); |
1220
|
|
|
|
|
|
|
} |
1221
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_last)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1222
|
0
|
|
|
|
|
|
croak("'last' argument to B::BINOP->new should be a B::OP object or a false value"); |
1223
|
|
|
|
|
|
|
else |
1224
|
0
|
|
|
|
|
|
last = Nullop; |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
{ |
1227
|
0
|
|
|
|
|
|
I32 typenum = op_name_to_num(type); |
1228
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
1229
|
0
|
|
|
|
|
|
o = newLOGOP(typenum, flags, first, last); |
1230
|
0
|
0
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1231
|
0
|
|
|
|
|
|
RESTORE_VARS; |
1232
|
|
|
|
|
|
|
} |
1233
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1234
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::LOGOP"), PTR2IV(o)); |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
# XXX coverage 0 |
1237
|
|
|
|
|
|
|
void |
1238
|
|
|
|
|
|
|
LOGOP_newcond(class, flags, sv_first, sv_last, sv_else) |
1239
|
|
|
|
|
|
|
SV * class |
1240
|
|
|
|
|
|
|
I32 flags |
1241
|
|
|
|
|
|
|
SV * sv_first |
1242
|
|
|
|
|
|
|
SV * sv_last |
1243
|
|
|
|
|
|
|
SV * sv_else |
1244
|
|
|
|
|
|
|
OP *first = NO_INIT |
1245
|
|
|
|
|
|
|
OP *last = NO_INIT |
1246
|
|
|
|
|
|
|
OP *elseo = NO_INIT |
1247
|
|
|
|
|
|
|
OP *o = NO_INIT |
1248
|
|
|
|
|
|
|
CODE: |
1249
|
0
|
0
|
|
|
|
|
if (SvROK(sv_first)) { |
1250
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1251
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1252
|
|
|
|
|
|
|
else { |
1253
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1254
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1255
|
|
|
|
|
|
|
} |
1256
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1257
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP->new should be a B::OP object or a false value"); |
1258
|
|
|
|
|
|
|
else |
1259
|
0
|
|
|
|
|
|
first = Nullop; |
1260
|
|
|
|
|
|
|
|
1261
|
0
|
0
|
|
|
|
|
if (SvROK(sv_last)) { |
1262
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_last, "B::OP")) |
1263
|
0
|
|
|
|
|
|
croak("Reference 'last' was not a B::OP object"); |
1264
|
|
|
|
|
|
|
else { |
1265
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_last)); |
1266
|
0
|
|
|
|
|
|
last = INT2PTR(OP*, tmp); |
1267
|
|
|
|
|
|
|
} |
1268
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_last)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1269
|
0
|
|
|
|
|
|
croak("'last' argument to B::BINOP->new should be a B::OP object or a false value"); |
1270
|
|
|
|
|
|
|
else |
1271
|
0
|
|
|
|
|
|
last = Nullop; |
1272
|
|
|
|
|
|
|
|
1273
|
0
|
0
|
|
|
|
|
if (SvROK(sv_else)) { |
1274
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_else, "B::OP")) |
1275
|
0
|
|
|
|
|
|
croak("Reference 'else' was not a B::OP object"); |
1276
|
|
|
|
|
|
|
else { |
1277
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_else)); |
1278
|
0
|
|
|
|
|
|
elseo = INT2PTR(OP*, tmp); |
1279
|
|
|
|
|
|
|
} |
1280
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_else)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1281
|
0
|
|
|
|
|
|
croak("'last' argument to B::BINOP->new should be a B::OP object or a false value"); |
1282
|
|
|
|
|
|
|
else |
1283
|
0
|
|
|
|
|
|
elseo = Nullop; |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
{ |
1286
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
1287
|
0
|
|
|
|
|
|
o = newCONDOP(flags, first, last, elseo); |
1288
|
0
|
|
|
|
|
|
RESTORE_VARS; |
1289
|
|
|
|
|
|
|
} |
1290
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1291
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::LOGOP"), PTR2IV(o)); |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
# coverage 50% |
1294
|
|
|
|
|
|
|
B::OP |
1295
|
|
|
|
|
|
|
LOGOP_other(o,...) |
1296
|
|
|
|
|
|
|
B::LOGOP o |
1297
|
|
|
|
|
|
|
CODE: |
1298
|
161
|
50
|
|
|
|
|
if (items > 1) |
1299
|
0
|
|
|
|
|
|
o->op_other = SVtoO(ST(1)); |
1300
|
161
|
|
|
|
|
|
RETVAL = o->op_other; |
1301
|
|
|
|
|
|
|
OUTPUT: |
1302
|
|
|
|
|
|
|
RETVAL |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
#if PERL_VERSION < 10 |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
#define PMOP_pmreplroot(o) o->op_pmreplroot |
1307
|
|
|
|
|
|
|
#define PMOP_pmnext(o) o->op_pmnext |
1308
|
|
|
|
|
|
|
#define PMOP_pmpermflags(o) o->op_pmpermflags |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
#endif |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
#define PMOP_pmregexp(o) o->op_pmregexp |
1313
|
|
|
|
|
|
|
#define PMOP_pmflags(o) o->op_pmflags |
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::PMOP PREFIX = PMOP_ |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
#if PERL_VERSION < 10 |
1318
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
void |
1320
|
|
|
|
|
|
|
PMOP_pmreplroot(o) |
1321
|
|
|
|
|
|
|
B::PMOP o |
1322
|
|
|
|
|
|
|
OP * root = NO_INIT |
1323
|
|
|
|
|
|
|
CODE: |
1324
|
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1325
|
|
|
|
|
|
|
root = o->op_pmreplroot; |
1326
|
|
|
|
|
|
|
/* OP_PUSHRE stores an SV* instead of an OP* in op_pmreplroot */ |
1327
|
|
|
|
|
|
|
if (o->op_type == OP_PUSHRE) { |
1328
|
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), root ? |
1329
|
|
|
|
|
|
|
svclassnames[SvTYPE((SV*)root)] : "B::SV"), |
1330
|
|
|
|
|
|
|
PTR2IV(root)); |
1331
|
|
|
|
|
|
|
} |
1332
|
|
|
|
|
|
|
else { |
1333
|
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), cc_opclassname(aTHX_ root)), PTR2IV(root)); |
1334
|
|
|
|
|
|
|
} |
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
B::OP |
1337
|
|
|
|
|
|
|
PMOP_pmreplstart(o, ...) |
1338
|
|
|
|
|
|
|
B::PMOP o |
1339
|
|
|
|
|
|
|
CODE: |
1340
|
|
|
|
|
|
|
if (items > 1) |
1341
|
|
|
|
|
|
|
o->op_pmreplstart = SVtoO(ST(1)); |
1342
|
|
|
|
|
|
|
RETVAL = o->op_pmreplstart; |
1343
|
|
|
|
|
|
|
OUTPUT: |
1344
|
|
|
|
|
|
|
RETVAL |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
B::PMOP |
1347
|
|
|
|
|
|
|
PMOP_pmnext(o, ...) |
1348
|
|
|
|
|
|
|
B::PMOP o |
1349
|
|
|
|
|
|
|
CODE: |
1350
|
|
|
|
|
|
|
if (items > 1) |
1351
|
|
|
|
|
|
|
o->op_pmnext = (PMOP*)SVtoO(ST(1)); |
1352
|
|
|
|
|
|
|
RETVAL = o->op_pmnext; |
1353
|
|
|
|
|
|
|
OUTPUT: |
1354
|
|
|
|
|
|
|
RETVAL |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
U16 |
1357
|
|
|
|
|
|
|
PMOP_pmpermflags(o) |
1358
|
|
|
|
|
|
|
B::PMOP o |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
#endif |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
U16 |
1363
|
|
|
|
|
|
|
PMOP_pmflags(o) |
1364
|
|
|
|
|
|
|
B::PMOP o |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
#if PERL_VERSION < 11 |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
void |
1369
|
|
|
|
|
|
|
PMOP_precomp(o) |
1370
|
|
|
|
|
|
|
B::PMOP o |
1371
|
|
|
|
|
|
|
REGEXP * rx = NO_INIT |
1372
|
|
|
|
|
|
|
CODE: |
1373
|
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1374
|
|
|
|
|
|
|
rx = PM_GETRE(o); |
1375
|
|
|
|
|
|
|
if (rx) |
1376
|
|
|
|
|
|
|
sv_setpvn(ST(0), rx->precomp, rx->prelen); |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
#endif |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
#define SVOP_sv(o) (cSVOPo_sv) |
1381
|
|
|
|
|
|
|
#define SVOP_gv(o) ((GV*)cSVOPo_sv) |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::SVOP PREFIX = SVOP_ |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
# coverage 50% |
1386
|
|
|
|
|
|
|
# SVOP::sv(o, sv, cvref) |
1387
|
|
|
|
|
|
|
# not-threaded ignore optional 2nd cvref arg. |
1388
|
|
|
|
|
|
|
# threaded only allow my variables, not TMP nor OUR. |
1389
|
|
|
|
|
|
|
# XXX [CPAN #70398] B::SVOP->sv broken by B::Generate. |
1390
|
|
|
|
|
|
|
# bad sideeffect polluting Concise. |
1391
|
|
|
|
|
|
|
B::SV |
1392
|
|
|
|
|
|
|
SVOP_sv(o, ...) |
1393
|
|
|
|
|
|
|
B::SVOP o |
1394
|
|
|
|
|
|
|
PREINIT: |
1395
|
|
|
|
|
|
|
SV *sv; |
1396
|
|
|
|
|
|
|
CODE: |
1397
|
473
|
100
|
|
|
|
|
if (items > 1) { |
1398
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1399
|
|
|
|
|
|
|
if (items > 2) { |
1400
|
|
|
|
|
|
|
if (!(SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVCV)) |
1401
|
|
|
|
|
|
|
croak("2nd arg is not a cvref"); |
1402
|
|
|
|
|
|
|
GEN_PAD_CV(ST(2)); |
1403
|
|
|
|
|
|
|
} else { |
1404
|
|
|
|
|
|
|
GEN_PAD; |
1405
|
|
|
|
|
|
|
} |
1406
|
|
|
|
|
|
|
#endif |
1407
|
3
|
|
|
|
|
|
sv = newSVsv(ST(1)); |
1408
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1409
|
|
|
|
|
|
|
if ( cSVOPx(o)->op_sv ) { |
1410
|
|
|
|
|
|
|
cSVOPx(o)->op_sv = sv; /* XXX coverage 0 */ |
1411
|
|
|
|
|
|
|
} |
1412
|
|
|
|
|
|
|
else { |
1413
|
|
|
|
|
|
|
/* assert(SvTYPE(sv) & SVs_PADMY); */ |
1414
|
|
|
|
|
|
|
PAD_SVl(o->op_targ) = sv; |
1415
|
|
|
|
|
|
|
} |
1416
|
|
|
|
|
|
|
#else |
1417
|
3
|
|
|
|
|
|
cSVOPx(o)->op_sv = sv; |
1418
|
|
|
|
|
|
|
#endif |
1419
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1420
|
|
|
|
|
|
|
OLD_PAD; |
1421
|
|
|
|
|
|
|
#endif |
1422
|
|
|
|
|
|
|
} |
1423
|
|
|
|
|
|
|
/* [CPAN #70398] cSVOPo_sv => cSVOPx(o)->op_sv */ |
1424
|
473
|
|
|
|
|
|
RETVAL = cSVOPx(o)->op_sv; |
1425
|
|
|
|
|
|
|
OUTPUT: |
1426
|
|
|
|
|
|
|
RETVAL |
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
# XXX coverage 0 |
1429
|
|
|
|
|
|
|
B::GV |
1430
|
|
|
|
|
|
|
SVOP_gv(o) |
1431
|
|
|
|
|
|
|
B::SVOP o |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
# coverage 50% const.t |
1434
|
|
|
|
|
|
|
# uses the additional args type, flags, sv from the embedding function |
1435
|
|
|
|
|
|
|
#define NEW_SVOP(_newOPgen, B_class) \ |
1436
|
|
|
|
|
|
|
{ \ |
1437
|
|
|
|
|
|
|
OP *o; \ |
1438
|
|
|
|
|
|
|
SV* param; \ |
1439
|
|
|
|
|
|
|
I32 typenum; \ |
1440
|
|
|
|
|
|
|
SAVE_VARS; \ |
1441
|
|
|
|
|
|
|
typenum = op_name_to_num(type); /* XXX More classes here! */ \ |
1442
|
|
|
|
|
|
|
if (typenum == OP_GVSV) { \ |
1443
|
|
|
|
|
|
|
if (*(SvPV_nolen(sv)) == '$') \ |
1444
|
|
|
|
|
|
|
param = (SV*)gv_fetchpv(SvPVX(sv)+1, TRUE, SVt_PV); \ |
1445
|
|
|
|
|
|
|
else \ |
1446
|
|
|
|
|
|
|
croak("First character to GVSV was not dollar"); \ |
1447
|
|
|
|
|
|
|
} else \ |
1448
|
|
|
|
|
|
|
param = newSVsv(sv); \ |
1449
|
|
|
|
|
|
|
o = _newOPgen(typenum, flags, param); \ |
1450
|
|
|
|
|
|
|
CHECK_CUSTOM_OPS \ |
1451
|
|
|
|
|
|
|
RESTORE_VARS; \ |
1452
|
|
|
|
|
|
|
ST(0) = sv_newmortal(); \ |
1453
|
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), B_class), PTR2IV(o)); \ |
1454
|
|
|
|
|
|
|
} |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
# XXX coverage 0 |
1458
|
|
|
|
|
|
|
SV* |
1459
|
|
|
|
|
|
|
SVOP_new_svrv(class, type, flags, sv) |
1460
|
|
|
|
|
|
|
SV * class |
1461
|
|
|
|
|
|
|
SV * type |
1462
|
|
|
|
|
|
|
I32 flags |
1463
|
|
|
|
|
|
|
SV * sv |
1464
|
|
|
|
|
|
|
CODE: |
1465
|
0
|
|
|
|
|
|
ST(0) = __svop_new(aTHX_ class, type, flags, SvRV(sv)); |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
|
1468
|
|
|
|
|
|
|
# coverage 100% const.t |
1469
|
|
|
|
|
|
|
# class: ignored. B::SVOP forced |
1470
|
|
|
|
|
|
|
# Note: This is the NEW_SVOP macro expanded for debugging |
1471
|
|
|
|
|
|
|
OP* |
1472
|
|
|
|
|
|
|
SVOP_new(class, type, flags, sv) |
1473
|
|
|
|
|
|
|
SV * class |
1474
|
|
|
|
|
|
|
SV * type |
1475
|
|
|
|
|
|
|
I32 flags |
1476
|
|
|
|
|
|
|
SV * sv |
1477
|
|
|
|
|
|
|
CODE: |
1478
|
|
|
|
|
|
|
OP *o; |
1479
|
|
|
|
|
|
|
SV* param; |
1480
|
|
|
|
|
|
|
I32 typenum; |
1481
|
1
|
50
|
|
|
|
|
SAVE_VARS; |
1482
|
1
|
|
|
|
|
|
typenum = op_name_to_num(type); /* XXX More classes here! */ |
1483
|
1
|
50
|
|
|
|
|
if (typenum == OP_GVSV) { |
1484
|
0
|
0
|
|
|
|
|
if (*(SvPV_nolen(sv)) == '$') |
|
|
0
|
|
|
|
|
|
1485
|
0
|
|
|
|
|
|
param = (SV*)gv_fetchpv(SvPVX(sv)+1, TRUE, SVt_PV); |
1486
|
|
|
|
|
|
|
else |
1487
|
0
|
|
|
|
|
|
croak("First character to GVSV was not dollar"); |
1488
|
|
|
|
|
|
|
} else |
1489
|
1
|
|
|
|
|
|
param = newSVsv(sv); |
1490
|
1
|
|
|
|
|
|
o = newSVOP(typenum, flags, param); |
1491
|
1
|
50
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1492
|
1
|
|
|
|
|
|
RESTORE_VARS; |
1493
|
1
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1494
|
1
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::SVOP"), PTR2IV(o)); |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
#define PADOP_padix(o) o->op_padix |
1498
|
|
|
|
|
|
|
#define PADOP_sv(o) (o->op_padix ? PL_curpad[o->op_padix] : Nullsv) |
1499
|
|
|
|
|
|
|
#define PADOP_gv(o) ((o->op_padix \ |
1500
|
|
|
|
|
|
|
&& SvTYPE(PL_curpad[o->op_padix]) == SVt_PVGV) \ |
1501
|
|
|
|
|
|
|
? (GV*)PL_curpad[o->op_padix] : Nullgv) |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::GVOP PREFIX = GVOP_ |
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
# XXX coverage 0 |
1506
|
|
|
|
|
|
|
SV * |
1507
|
|
|
|
|
|
|
GVOP_new(class, type, flags, sv) |
1508
|
|
|
|
|
|
|
SV * class |
1509
|
|
|
|
|
|
|
SV * type |
1510
|
|
|
|
|
|
|
I32 flags |
1511
|
|
|
|
|
|
|
SV * sv |
1512
|
|
|
|
|
|
|
CODE: |
1513
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1514
|
|
|
|
|
|
|
NEW_SVOP(newPADOP, "B::PADOP"); |
1515
|
|
|
|
|
|
|
#else |
1516
|
0
|
0
|
|
|
|
|
NEW_SVOP(newSVOP, "B::SVOP"); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
#endif |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::PADOP PREFIX = PADOP_ |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
PADOFFSET |
1522
|
|
|
|
|
|
|
PADOP_padix(o, ...) |
1523
|
|
|
|
|
|
|
B::PADOP o |
1524
|
|
|
|
|
|
|
CODE: |
1525
|
0
|
0
|
|
|
|
|
if (items > 1) |
1526
|
0
|
0
|
|
|
|
|
o->op_padix = (PADOFFSET)SvIV(ST(1)); |
1527
|
0
|
|
|
|
|
|
RETVAL = o->op_padix; |
1528
|
|
|
|
|
|
|
OUTPUT: |
1529
|
|
|
|
|
|
|
RETVAL |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
B::SV |
1532
|
|
|
|
|
|
|
PADOP_sv(o, ...) |
1533
|
|
|
|
|
|
|
B::PADOP o |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
B::GV |
1536
|
|
|
|
|
|
|
PADOP_gv(o) |
1537
|
|
|
|
|
|
|
B::PADOP o |
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::PVOP PREFIX = PVOP_ |
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
void |
1542
|
|
|
|
|
|
|
PVOP_pv(o) |
1543
|
|
|
|
|
|
|
B::PVOP o |
1544
|
|
|
|
|
|
|
CODE: |
1545
|
|
|
|
|
|
|
/* |
1546
|
|
|
|
|
|
|
* OP_TRANS uses op_pv to point to a table of 256 shorts |
1547
|
|
|
|
|
|
|
* whereas other PVOPs point to a null terminated string. |
1548
|
|
|
|
|
|
|
*/ |
1549
|
0
|
0
|
|
|
|
|
ST(0) = sv_2mortal(newSVpv(o->op_pv, (o->op_type == OP_TRANS) ? |
1550
|
|
|
|
|
|
|
256 * sizeof(short) : 0)); |
1551
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::LOOP PREFIX = LOOP_ |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
B::OP |
1555
|
|
|
|
|
|
|
LOOP_redoop(o, ...) |
1556
|
|
|
|
|
|
|
B::LOOP o |
1557
|
|
|
|
|
|
|
CODE: |
1558
|
0
|
0
|
|
|
|
|
if (items > 1) |
1559
|
0
|
|
|
|
|
|
o->op_redoop = SVtoO(ST(1)); |
1560
|
0
|
|
|
|
|
|
RETVAL = o->op_redoop; |
1561
|
|
|
|
|
|
|
OUTPUT: |
1562
|
|
|
|
|
|
|
RETVAL |
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
B::OP |
1565
|
|
|
|
|
|
|
LOOP_nextop(o, ...) |
1566
|
|
|
|
|
|
|
B::LOOP o |
1567
|
|
|
|
|
|
|
CODE: |
1568
|
10
|
50
|
|
|
|
|
if (items > 1) |
1569
|
0
|
|
|
|
|
|
o->op_nextop = SVtoO(ST(1)); |
1570
|
10
|
|
|
|
|
|
RETVAL = o->op_nextop; |
1571
|
|
|
|
|
|
|
OUTPUT: |
1572
|
|
|
|
|
|
|
RETVAL |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
B::OP |
1575
|
|
|
|
|
|
|
LOOP_lastop(o, ...) |
1576
|
|
|
|
|
|
|
B::LOOP o |
1577
|
|
|
|
|
|
|
CODE: |
1578
|
7
|
50
|
|
|
|
|
if (items > 1) |
1579
|
0
|
|
|
|
|
|
o->op_lastop = SVtoO(ST(1)); |
1580
|
7
|
|
|
|
|
|
RETVAL = o->op_lastop; |
1581
|
|
|
|
|
|
|
OUTPUT: |
1582
|
|
|
|
|
|
|
RETVAL |
1583
|
|
|
|
|
|
|
|
1584
|
|
|
|
|
|
|
#if PERL_VERSION < 11 |
1585
|
|
|
|
|
|
|
#define COP_label(o) o->cop_label |
1586
|
|
|
|
|
|
|
#endif |
1587
|
|
|
|
|
|
|
#define COP_stashpv(o) CopSTASHPV(o) |
1588
|
|
|
|
|
|
|
#define COP_stash(o) CopSTASH(o) |
1589
|
|
|
|
|
|
|
#define COP_file(o) CopFILE(o) |
1590
|
|
|
|
|
|
|
#define COP_cop_seq(o) o->cop_seq |
1591
|
|
|
|
|
|
|
#if PERL_VERSION < 10 |
1592
|
|
|
|
|
|
|
#define COP_arybase(o) o->cop_arybase |
1593
|
|
|
|
|
|
|
#endif |
1594
|
|
|
|
|
|
|
#define COP_line(o) CopLINE(o) |
1595
|
|
|
|
|
|
|
#define COP_warnings(o) (SV*)o->cop_warnings |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::COP PREFIX = COP_ |
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
|
1600
|
|
|
|
|
|
|
#if PERL_VERSION < 11 |
1601
|
|
|
|
|
|
|
|
1602
|
|
|
|
|
|
|
char * |
1603
|
|
|
|
|
|
|
COP_label(o) |
1604
|
|
|
|
|
|
|
B::COP o |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
#endif |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
char * |
1609
|
|
|
|
|
|
|
COP_stashpv(o) |
1610
|
|
|
|
|
|
|
B::COP o |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
B::HV |
1613
|
|
|
|
|
|
|
COP_stash(o) |
1614
|
|
|
|
|
|
|
B::COP o |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
char * |
1617
|
|
|
|
|
|
|
COP_file(o) |
1618
|
|
|
|
|
|
|
B::COP o |
1619
|
|
|
|
|
|
|
|
1620
|
|
|
|
|
|
|
U32 |
1621
|
|
|
|
|
|
|
COP_cop_seq(o) |
1622
|
|
|
|
|
|
|
B::COP o |
1623
|
|
|
|
|
|
|
|
1624
|
|
|
|
|
|
|
#if PERL_VERSION < 10 |
1625
|
|
|
|
|
|
|
|
1626
|
|
|
|
|
|
|
I32 |
1627
|
|
|
|
|
|
|
COP_arybase(o) |
1628
|
|
|
|
|
|
|
B::COP o |
1629
|
|
|
|
|
|
|
|
1630
|
|
|
|
|
|
|
#endif |
1631
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
U16 |
1633
|
|
|
|
|
|
|
COP_line(o) |
1634
|
|
|
|
|
|
|
B::COP o |
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
=pod |
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
/* |
1639
|
|
|
|
|
|
|
Disable this wrong B::COP->warnings [CPAN #70396] |
1640
|
|
|
|
|
|
|
Use the orginal B version instead. |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
TODO: This throws a warning that cop_warnings is (STRLEN*) |
1643
|
|
|
|
|
|
|
while I am casting to (SV*). The typedef converts special |
1644
|
|
|
|
|
|
|
values of (STRLEN*) into SV objects. Hope the initial pointer |
1645
|
|
|
|
|
|
|
casting isn't a problem. |
1646
|
|
|
|
|
|
|
|
1647
|
|
|
|
|
|
|
New code for 5.11 is loosely based upon patch 27786 changes to |
1648
|
|
|
|
|
|
|
B.xs, but avoids calling the static function added there. |
1649
|
|
|
|
|
|
|
XXX: maybe de-static that function |
1650
|
|
|
|
|
|
|
*/ |
1651
|
|
|
|
|
|
|
|
1652
|
|
|
|
|
|
|
#if PERL_VERSION < 11 |
1653
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
B::SV |
1655
|
|
|
|
|
|
|
COP_warnings(o) |
1656
|
|
|
|
|
|
|
B::COP o |
1657
|
|
|
|
|
|
|
|
1658
|
|
|
|
|
|
|
#else |
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
void |
1661
|
|
|
|
|
|
|
COP_warnings(o) |
1662
|
|
|
|
|
|
|
B::COP o |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
#endif |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
=cut |
1667
|
|
|
|
|
|
|
|
1668
|
|
|
|
|
|
|
=pod |
1669
|
|
|
|
|
|
|
|
1670
|
|
|
|
|
|
|
/* |
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
another go: with blead@33056, get another arg2 mismatch to newSVpv |
1673
|
|
|
|
|
|
|
in this code. Turns out that COP_warnings(o) returns void now. |
1674
|
|
|
|
|
|
|
So I hope to comment out this XS, and get B's version instead. |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
B::SV |
1677
|
|
|
|
|
|
|
COP_warnings(o) |
1678
|
|
|
|
|
|
|
B::COP o |
1679
|
|
|
|
|
|
|
CODE: |
1680
|
|
|
|
|
|
|
RETVAL = newSVpv(o->cop_warnings, 0); |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
#endif |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
*/ |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
=cut |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
#ifndef CopLABEL_alloc |
1689
|
|
|
|
|
|
|
#define CopLABEL_alloc(str) ((str)?savepv(str):NULL) |
1690
|
|
|
|
|
|
|
#endif |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
# XXX coverage 70% |
1693
|
|
|
|
|
|
|
B::COP |
1694
|
|
|
|
|
|
|
COP_new(class, flags, name, sv_first) |
1695
|
|
|
|
|
|
|
SV * class |
1696
|
|
|
|
|
|
|
char * name |
1697
|
|
|
|
|
|
|
I32 flags |
1698
|
|
|
|
|
|
|
SV * sv_first |
1699
|
|
|
|
|
|
|
OP *first = NO_INIT |
1700
|
|
|
|
|
|
|
OP *o = NO_INIT |
1701
|
|
|
|
|
|
|
CODE: |
1702
|
|
|
|
|
|
|
|
1703
|
0
|
0
|
|
|
|
|
if (SvROK(sv_first)) { /* # XXX coverage o */ |
1704
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1705
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1706
|
|
|
|
|
|
|
else { |
1707
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1708
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1709
|
|
|
|
|
|
|
} |
1710
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1711
|
0
|
|
|
|
|
|
croak("'first' argument to B::COP->new should be a B::OP object or a false value"); |
1712
|
|
|
|
|
|
|
else |
1713
|
0
|
|
|
|
|
|
first = Nullop; |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
{ |
1716
|
|
|
|
|
|
|
#if PERL_VERSION >= 10 |
1717
|
0
|
|
|
|
|
|
yy_parser* saveparser = PL_parser, dummyparser; |
1718
|
0
|
0
|
|
|
|
|
if ( PL_parser == NULL) { |
1719
|
0
|
|
|
|
|
|
PL_parser = &dummyparser; |
1720
|
0
|
|
|
|
|
|
PL_parser-> copline = NOLINE; |
1721
|
|
|
|
|
|
|
} |
1722
|
|
|
|
|
|
|
#endif |
1723
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
1724
|
0
|
0
|
|
|
|
|
o = newSTATEOP(flags, CopLABEL_alloc(name), first); |
1725
|
0
|
|
|
|
|
|
RESTORE_VARS; |
1726
|
|
|
|
|
|
|
#if PERL_VERSION >= 10 |
1727
|
0
|
|
|
|
|
|
PL_parser = saveparser; |
1728
|
|
|
|
|
|
|
#endif |
1729
|
|
|
|
|
|
|
} |
1730
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1731
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::COP"), PTR2IV(o)); |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
#if PERL_VERSION >= 22 |
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::UNOP_AUX PREFIX = UNOP_AUX_ |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
# TODO: support list of [type, value] pairs |
1738
|
|
|
|
|
|
|
# coverage |
1739
|
|
|
|
|
|
|
B::UNOP_AUX_item |
1740
|
|
|
|
|
|
|
UNOP_AUX_aux(o, ...) |
1741
|
|
|
|
|
|
|
B::UNOP_AUX o |
1742
|
|
|
|
|
|
|
CODE: |
1743
|
0
|
0
|
|
|
|
|
if (items > 1) |
1744
|
0
|
|
|
|
|
|
o->op_aux = (UNOP_AUX_item*)SVtoO(ST(1)); |
1745
|
0
|
|
|
|
|
|
RETVAL = o->op_aux; |
1746
|
|
|
|
|
|
|
OUTPUT: |
1747
|
|
|
|
|
|
|
RETVAL |
1748
|
|
|
|
|
|
|
|
1749
|
|
|
|
|
|
|
# XXX coverage 0 |
1750
|
|
|
|
|
|
|
void |
1751
|
|
|
|
|
|
|
UNOP_AUX_new(class, type, flags, sv_first, sv_aux) |
1752
|
|
|
|
|
|
|
SV * class |
1753
|
|
|
|
|
|
|
SV * type |
1754
|
|
|
|
|
|
|
I32 flags |
1755
|
|
|
|
|
|
|
SV * sv_first |
1756
|
|
|
|
|
|
|
SV * sv_aux |
1757
|
|
|
|
|
|
|
OP *first = NO_INIT |
1758
|
|
|
|
|
|
|
UNOP_AUX_item *aux = NO_INIT |
1759
|
|
|
|
|
|
|
OP *o = NO_INIT |
1760
|
|
|
|
|
|
|
I32 typenum = NO_INIT |
1761
|
|
|
|
|
|
|
CODE: |
1762
|
0
|
|
|
|
|
|
I32 padflag = 0; |
1763
|
0
|
0
|
|
|
|
|
if (SvROK(sv_first)) { |
1764
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::OP")) |
1765
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::OP object"); |
1766
|
|
|
|
|
|
|
else { |
1767
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_first)); |
1768
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1769
|
|
|
|
|
|
|
} |
1770
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1771
|
0
|
|
|
|
|
|
croak("'first' argument to B::UNOP_AUX->new should be a B::OP object or a false value"); |
1772
|
|
|
|
|
|
|
else |
1773
|
0
|
|
|
|
|
|
first = Nullop; |
1774
|
|
|
|
|
|
|
|
1775
|
0
|
0
|
|
|
|
|
if (SvROK(sv_aux)) { |
1776
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(sv_first, "B::PV")) |
1777
|
0
|
|
|
|
|
|
croak("Reference 'first' was not a B::PV object"); |
1778
|
|
|
|
|
|
|
else { |
1779
|
0
|
0
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(sv_aux)); |
1780
|
0
|
|
|
|
|
|
aux = INT2PTR(UNOP_AUX_item*, tmp); |
1781
|
|
|
|
|
|
|
} |
1782
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(sv_aux)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1783
|
0
|
|
|
|
|
|
croak("'aux' argument to B::UNOP_AUX->new should be a B::PV object or a false value"); |
1784
|
|
|
|
|
|
|
else |
1785
|
0
|
|
|
|
|
|
aux = NULL; |
1786
|
|
|
|
|
|
|
{ |
1787
|
|
|
|
|
|
|
|
1788
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
1789
|
0
|
|
|
|
|
|
typenum = op_name_to_num(type); |
1790
|
|
|
|
|
|
|
{ |
1791
|
0
|
|
|
|
|
|
COP *cop = PL_curcop; |
1792
|
0
|
|
|
|
|
|
PL_curcop = &PL_compiling; |
1793
|
0
|
|
|
|
|
|
o = newUNOP_AUX(typenum, flags, first, aux); |
1794
|
0
|
|
|
|
|
|
PL_curcop = cop; |
1795
|
|
|
|
|
|
|
} |
1796
|
0
|
0
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1797
|
0
|
|
|
|
|
|
RESTORE_VARS; |
1798
|
|
|
|
|
|
|
} |
1799
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1800
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::UNOP_AUX"), PTR2IV(o)); |
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::METHOP PREFIX = METHOP_ |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
# coverage |
1805
|
|
|
|
|
|
|
B::HV |
1806
|
|
|
|
|
|
|
METHOP_rclass(o, ...) |
1807
|
|
|
|
|
|
|
B::METHOP o |
1808
|
|
|
|
|
|
|
SV *sv = NO_INIT |
1809
|
|
|
|
|
|
|
CODE: |
1810
|
0
|
0
|
|
|
|
|
if (items > 1) { |
1811
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1812
|
|
|
|
|
|
|
int i; |
1813
|
|
|
|
|
|
|
#endif |
1814
|
0
|
|
|
|
|
|
sv = (SV*)SVtoO(ST(1)); |
1815
|
0
|
0
|
|
|
|
|
if (sv && |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1816
|
0
|
|
|
|
|
|
(SvTYPE(sv) != SVt_PVHV |
1817
|
0
|
0
|
|
|
|
|
|| !HvNAME(sv))) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1818
|
0
|
|
|
|
|
|
croak("rclass argument is not a stash"); |
1819
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1820
|
|
|
|
|
|
|
for (i=0;i
|
1821
|
|
|
|
|
|
|
if (PL_curpad[i] == sv) { |
1822
|
|
|
|
|
|
|
o->op_rclass_targ = i; |
1823
|
|
|
|
|
|
|
break; |
1824
|
|
|
|
|
|
|
} |
1825
|
|
|
|
|
|
|
} |
1826
|
|
|
|
|
|
|
#else |
1827
|
0
|
|
|
|
|
|
o->op_rclass_sv = sv; |
1828
|
|
|
|
|
|
|
#endif |
1829
|
|
|
|
|
|
|
} |
1830
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1831
|
|
|
|
|
|
|
RETVAL = (HV*)PL_curpad[o->op_rclass_targ]; |
1832
|
|
|
|
|
|
|
#else |
1833
|
0
|
|
|
|
|
|
RETVAL = (HV*)o->op_rclass_sv; |
1834
|
|
|
|
|
|
|
#endif |
1835
|
|
|
|
|
|
|
OUTPUT: |
1836
|
|
|
|
|
|
|
RETVAL |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
B::SV |
1839
|
|
|
|
|
|
|
METHOP_meth_sv(o, ...) |
1840
|
|
|
|
|
|
|
B::METHOP o |
1841
|
|
|
|
|
|
|
CODE: |
1842
|
488
|
50
|
|
|
|
|
if (items > 1) |
1843
|
0
|
|
|
|
|
|
o->op_u.op_meth_sv = (SV*)SVtoO(ST(1)); |
1844
|
488
|
|
|
|
|
|
RETVAL = o->op_u.op_meth_sv; |
1845
|
|
|
|
|
|
|
OUTPUT: |
1846
|
|
|
|
|
|
|
RETVAL |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
# XXX coverage 0 |
1849
|
|
|
|
|
|
|
void |
1850
|
|
|
|
|
|
|
METHOP_new(class, type, flags, op_first) |
1851
|
|
|
|
|
|
|
SV * class |
1852
|
|
|
|
|
|
|
SV * type |
1853
|
|
|
|
|
|
|
I32 flags |
1854
|
|
|
|
|
|
|
SV * op_first |
1855
|
|
|
|
|
|
|
OP *first = NO_INIT |
1856
|
|
|
|
|
|
|
OP *o = NO_INIT |
1857
|
|
|
|
|
|
|
I32 typenum = NO_INIT |
1858
|
|
|
|
|
|
|
CODE: |
1859
|
0
|
|
|
|
|
|
I32 padflag = 0; |
1860
|
0
|
0
|
|
|
|
|
if (SvROK(op_first)) { |
1861
|
0
|
0
|
|
|
|
|
if (!sv_derived_from(op_first, "B::OP")) { |
1862
|
0
|
0
|
|
|
|
|
if (sv_derived_from(op_first, "B::PV")) { |
1863
|
0
|
0
|
|
|
|
|
IV tmp = SvIV(SvRV(op_first)); |
1864
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1865
|
|
|
|
|
|
|
} |
1866
|
0
|
|
|
|
|
|
else croak("Reference 'first' was not a B::OP or B::PV object"); |
1867
|
|
|
|
|
|
|
} |
1868
|
|
|
|
|
|
|
else { |
1869
|
0
|
0
|
|
|
|
|
IV tmp = SvIV(SvRV(op_first)); |
1870
|
0
|
|
|
|
|
|
first = INT2PTR(OP*, tmp); |
1871
|
|
|
|
|
|
|
} |
1872
|
0
|
0
|
|
|
|
|
} else if (SvTRUE(op_first)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1873
|
0
|
|
|
|
|
|
croak("'first' argument to B::METHOP->new should be a B::OP or B::PV object or a false value"); |
1874
|
|
|
|
|
|
|
else |
1875
|
0
|
|
|
|
|
|
first = Nullop; |
1876
|
|
|
|
|
|
|
{ |
1877
|
|
|
|
|
|
|
|
1878
|
0
|
0
|
|
|
|
|
SAVE_VARS; |
1879
|
0
|
|
|
|
|
|
typenum = op_name_to_num(type); |
1880
|
|
|
|
|
|
|
{ |
1881
|
0
|
|
|
|
|
|
COP *cop = PL_curcop; |
1882
|
0
|
|
|
|
|
|
PL_curcop = &PL_compiling; |
1883
|
0
|
|
|
|
|
|
o = newMETHOP(typenum, flags, first); |
1884
|
0
|
|
|
|
|
|
PL_curcop = cop; |
1885
|
|
|
|
|
|
|
} |
1886
|
0
|
0
|
|
|
|
|
CHECK_CUSTOM_OPS |
|
|
0
|
|
|
|
|
|
1887
|
0
|
|
|
|
|
|
RESTORE_VARS; |
1888
|
|
|
|
|
|
|
} |
1889
|
0
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1890
|
0
|
|
|
|
|
|
sv_setiv(newSVrv(ST(0), "B::METHOP"), PTR2IV(o)); |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
#endif |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::SV PREFIX = Sv |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
# coverage ok |
1897
|
|
|
|
|
|
|
SV* |
1898
|
|
|
|
|
|
|
Svsv(sv) |
1899
|
|
|
|
|
|
|
B::SV sv |
1900
|
|
|
|
|
|
|
CODE: |
1901
|
3
|
|
|
|
|
|
RETVAL = newSVsv(sv); |
1902
|
|
|
|
|
|
|
OUTPUT: |
1903
|
|
|
|
|
|
|
RETVAL |
1904
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
# XXX coverage 0 |
1906
|
|
|
|
|
|
|
void* |
1907
|
|
|
|
|
|
|
Svdump(sv) |
1908
|
|
|
|
|
|
|
B::SV sv |
1909
|
|
|
|
|
|
|
CODE: |
1910
|
0
|
|
|
|
|
|
sv_dump(sv); |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
# XXX coverage 0 |
1913
|
|
|
|
|
|
|
U32 |
1914
|
|
|
|
|
|
|
SvFLAGS(sv, ...) |
1915
|
|
|
|
|
|
|
B::SV sv |
1916
|
|
|
|
|
|
|
CODE: |
1917
|
4244
|
50
|
|
|
|
|
if (items > 1) |
1918
|
0
|
0
|
|
|
|
|
sv->sv_flags = SvIV(ST(1)); |
1919
|
4244
|
|
|
|
|
|
RETVAL = SvFLAGS(sv); |
1920
|
|
|
|
|
|
|
OUTPUT: |
1921
|
|
|
|
|
|
|
RETVAL |
1922
|
|
|
|
|
|
|
|
1923
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::CV PREFIX = CV_ |
1924
|
|
|
|
|
|
|
|
1925
|
|
|
|
|
|
|
# XXX coverage 0 |
1926
|
|
|
|
|
|
|
B::OP |
1927
|
|
|
|
|
|
|
CV_ROOT(cv) |
1928
|
|
|
|
|
|
|
B::CV cv |
1929
|
|
|
|
|
|
|
CODE: |
1930
|
5969
|
100
|
|
|
|
|
if (cv == PL_main_cv) { |
1931
|
7
|
|
|
|
|
|
RETVAL = PL_main_root; |
1932
|
|
|
|
|
|
|
} else { |
1933
|
5962
|
100
|
|
|
|
|
RETVAL = CvISXSUB(cv) ? NULL : CvROOT(cv); |
1934
|
|
|
|
|
|
|
} |
1935
|
|
|
|
|
|
|
OUTPUT: |
1936
|
|
|
|
|
|
|
RETVAL |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
# XXX coverage 0 |
1939
|
|
|
|
|
|
|
B::CV |
1940
|
|
|
|
|
|
|
CV_newsub_simple(class, name, block) |
1941
|
|
|
|
|
|
|
SV* class |
1942
|
|
|
|
|
|
|
SV* name |
1943
|
|
|
|
|
|
|
B::OP block |
1944
|
|
|
|
|
|
|
CV* mycv = NO_INIT |
1945
|
|
|
|
|
|
|
OP* o = NO_INIT |
1946
|
|
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
CODE: |
1948
|
0
|
|
|
|
|
|
o = newSVOP(OP_CONST, 0, SvREFCNT_inc(name)); |
1949
|
0
|
|
|
|
|
|
mycv = newSUB(start_subparse(FALSE, 0), o, Nullop, block); |
1950
|
|
|
|
|
|
|
/*op_free(o); */ |
1951
|
0
|
|
|
|
|
|
RETVAL = mycv; |
1952
|
|
|
|
|
|
|
OUTPUT: |
1953
|
|
|
|
|
|
|
RETVAL |
1954
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
#ifdef HAVE_CV_CLONE |
1956
|
|
|
|
|
|
|
# define PERL_CORE |
1957
|
|
|
|
|
|
|
# include "embed.h" |
1958
|
|
|
|
|
|
|
|
1959
|
|
|
|
|
|
|
# XXX coverage t/new_cv.t |
1960
|
|
|
|
|
|
|
B::CV |
1961
|
|
|
|
|
|
|
CV_NEW_with_start(cv, root, start) |
1962
|
|
|
|
|
|
|
B::CV cv |
1963
|
|
|
|
|
|
|
B::OP root |
1964
|
|
|
|
|
|
|
B::OP start |
1965
|
|
|
|
|
|
|
PREINIT: |
1966
|
|
|
|
|
|
|
CV *new; |
1967
|
|
|
|
|
|
|
CODE: |
1968
|
2
|
|
|
|
|
|
new = Perl_cv_clone(aTHX_ cv); |
1969
|
2
|
|
|
|
|
|
CvROOT(new) = root; |
1970
|
2
|
|
|
|
|
|
CvSTART(new) = start; |
1971
|
2
|
|
|
|
|
|
CvDEPTH(new) = 0; |
1972
|
|
|
|
|
|
|
#if PERL_VERSION > 9 |
1973
|
2
|
|
|
|
|
|
CvPADLIST(new) = CvPADLIST(cv); |
1974
|
|
|
|
|
|
|
#endif |
1975
|
2
|
|
|
|
|
|
SvREFCNT_inc(new); |
1976
|
2
|
|
|
|
|
|
RETVAL = new; |
1977
|
|
|
|
|
|
|
OUTPUT: |
1978
|
|
|
|
|
|
|
RETVAL |
1979
|
|
|
|
|
|
|
|
1980
|
|
|
|
|
|
|
#undef PERL_CORE |
1981
|
|
|
|
|
|
|
#endif |
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
MODULE = B::Generate PACKAGE = B::PV PREFIX = Sv |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
# XXX coverage 0 |
1986
|
|
|
|
|
|
|
void |
1987
|
|
|
|
|
|
|
SvPV(sv,...) |
1988
|
|
|
|
|
|
|
B::PV sv |
1989
|
|
|
|
|
|
|
CODE: |
1990
|
|
|
|
|
|
|
{ |
1991
|
840
|
100
|
|
|
|
|
if (items > 1) { |
1992
|
1
|
50
|
|
|
|
|
sv_setpv(sv, SvPV_nolen(ST(1))); |
1993
|
|
|
|
|
|
|
} |
1994
|
840
|
|
|
|
|
|
ST(0) = sv_newmortal(); |
1995
|
840
|
50
|
|
|
|
|
if ( SvPOK(sv) ) { |
1996
|
840
|
|
|
|
|
|
sv_setpvn(ST(0), SvPVX(sv), SvCUR(sv)); |
1997
|
840
|
|
|
|
|
|
SvFLAGS(ST(0)) |= SvUTF8(sv); |
1998
|
|
|
|
|
|
|
} |
1999
|
|
|
|
|
|
|
else { |
2000
|
|
|
|
|
|
|
/* XXX for backward compatibility, but should fail */ |
2001
|
|
|
|
|
|
|
/* croak( "argument is not SvPOK" ); */ |
2002
|
0
|
|
|
|
|
|
sv_setpvn(ST(0), NULL, 0); |
2003
|
|
|
|
|
|
|
} |
2004
|
|
|
|
|
|
|
} |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
BOOT: |
2007
|
11
|
|
|
|
|
|
specialsv_list[0] = Nullsv; |
2008
|
11
|
|
|
|
|
|
specialsv_list[1] = &PL_sv_undef; |
2009
|
11
|
|
|
|
|
|
specialsv_list[2] = &PL_sv_yes; |
2010
|
11
|
|
|
|
|
|
specialsv_list[3] = &PL_sv_no; |
2011
|
|
|
|
|
|
|
/* These are supposed to be (STRLEN*) so I cheat. */ |
2012
|
11
|
|
|
|
|
|
specialsv_list[4] = (SV*)pWARN_ALL; |
2013
|
11
|
|
|
|
|
|
specialsv_list[5] = (SV*)pWARN_NONE; |
2014
|
11
|
|
|
|
|
|
specialsv_list[6] = (SV*)pWARN_STD; |