ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Faster/Faster.pm
(Generate patch)

Comparing Faster/Faster.pm (file contents):
Revision 1.4 by root, Thu Mar 9 22:32:17 2006 UTC vs.
Revision 1.6 by root, Fri Mar 10 00:11:44 2006 UTC

54 entertry unsafe 54 entertry unsafe
55 substconst unsafe 55 substconst unsafe
56 formline unsafe 56 formline unsafe
57 grepstart unsafe 57 grepstart unsafe
58 require unsafe 58 require unsafe
59 match unsafe todo
60 subst unsafe todo
61 entereval unsafe todo
62 mapstart unsafe todo
59 63
60 pushmark noasync 64 pushmark noasync
61 padsv noasync 65 padsv noasync
62 entersub noasync 66 entersub noasync
63 aassign noasync 67 aassign noasync
94} 98}
95 99
96sub out_next { 100sub out_next {
97 my ($op) = @_; 101 my ($op) = @_;
98 102
103 if (${$op->next}) {
99 $source .= " nextop = (OP *)${$op->next}L;\n"; 104 $source .= " nextop = (OP *)${$op->next}L;\n";
100 $source .= " goto op_${$op->next};\n"; 105 $source .= " goto op_${$op->next};\n";
106 } else {
107 $source .= " return 0;\n";
108 }
101} 109}
102 110
103sub callop { 111sub callop {
104 my ($op) = @_; 112 my ($op) = @_;
105 113
106 my $name = $op->name; 114 my $name = $op->name;
107 115
108 $name eq "entersub" 116 $name eq "entersub"
109 ? "(PL_ppaddr [OP_ENTERSUB]) (aTHX)" 117 ? "(PL_ppaddr [OP_ENTERSUB]) (aTHX)"
118 : $name eq "mapstart"
119 ? "Perl_pp_grepstart (aTHX)"
110 : "Perl_pp_$name (aTHX)" 120 : "Perl_pp_$name (aTHX)"
111} 121}
112 122
113sub op_nextstate { 123sub op_nextstate {
114 my ($op) = @_; 124 my ($op) = @_;
115 125
150 my ($op) = @_; 160 my ($op) = @_;
151 161
152 $source .= <<EOF; 162 $source .= <<EOF;
153 { 163 {
154 dSP; 164 dSP;
165
155 if (SvTRUE (TOPs)) 166 if (SvTRUE (TOPs))
156 { 167 {
157 --SP; 168 --SP;
158 PUTBACK; 169 PUTBACK;
159 nextop = (OP *)${$op->other}L; 170 nextop = (OP *)${$op->other}L;
160 goto op_${$op->other}; 171 goto op_${$op->other};
161 } 172 }
162
163 nextop = (OP *)${$op->next}L;
164 goto op_${$op->next};
165 } 173 }
166EOF 174EOF
175
176 out_next $op;
167} 177}
168 178
169sub op_padsv { 179sub op_padsv {
170 my ($op) = @_; 180 my ($op) = @_;
171 181
187 } 197 }
188 } 198 }
189 $source .= <<EOF; 199 $source .= <<EOF;
190 } 200 }
191EOF 201EOF
202
203 out_next $op;
204}
205
206sub op_aelemfast {
207 my ($op) = @_;
208
209 my $targ = $op->targ;
210 my $private = $op->private;
211
212 $source .= " {\n";
213
214 if ($op->flags & B::OPf_SPECIAL) {
215 $source .= " AV *av = (AV*)PAD_SV((PADOFFSET)$targ);\n";
216 } else {
217 $source .= " AV *av = GvAV ((GV *)${$op->sv}L);\n";
218 }
219
220 if ($op->flags & B::OPf_MOD) {
221 $source .= " SV *sv = *av_fetch (av, $private, 1);\n";
222 } else {
223 $source .= " SV **svp = av_fetch (av, $private, 0); SV *sv = svp ? *svp : &PL_sv_undef;\n";
224 }
225
226 if (!($op->flags & B::OPf_MOD)) {
227 $source .= " if (SvGMAGICAL (sv)) sv = sv_mortalcopy (sv);\n";
228 }
229
230 $source .= " dSP;\n";
231 $source .= " XPUSHs (sv);\n";
232 $source .= " PUTBACK;\n";
233 $source .= " }\n";
192 234
193 out_next $op; 235 out_next $op;
194} 236}
195 237
196# pattern const+ (or general push1) 238# pattern const+ (or general push1)
299 $source .= " PERL_ASYNC_CHECK ();\n"; 341 $source .= " PERL_ASYNC_CHECK ();\n";
300 } 342 }
301 343
302 if (my $can = __PACKAGE__->can ("op_$name")) { 344 if (my $can = __PACKAGE__->can ("op_$name")) {
303 $can->($op); 345 $can->($op);
346 } elsif (exists $flag{unsafe}{$name}) {
347 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d#
348 $source .= " PL_op = nextop; return " . (callop $op) . ";\n";
304 } elsif ("LOGOP" eq B::class $op or exists $flag{otherop}{$name}) { 349 } elsif ("LOGOP" eq B::class $op or exists $flag{otherop}{$name}) {
305 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d# 350 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d#
306 $source .= " PL_op = nextop; nextop = " . (callop $op) . ";\n"; 351 $source .= " PL_op = nextop; nextop = " . (callop $op) . ";\n";
307 $source .= " if (nextop == (OP *)${$op->other}L) goto op_${$op->other};\n"; 352 $source .= " if (nextop == (OP *)${$op->other}L) goto op_${$op->other};\n";
308 $source .= " assert ((\"$name\", nextop == (OP *)${$op->next}));\n";#d# 353 $source .= " assert ((\"$name\", nextop == (OP *)${$op->next}));\n";#d#
309 $source .= " goto op_${$op->next};\n"; 354 $source .= ${$op->next} ? " goto op_${$op->next};\n" : " return 0;\n";
310 } elsif (exists $flag{unsafe}{$name}) {
311 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d#
312 $source .= " PL_op = nextop; return " . (callop $op) . ";\n";
313 } else { 355 } else {
314 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d# 356 $source .= " assert ((\"$name\", nextop == (OP *)$$op));\n";#d#
315 $source .= " PL_op = nextop; nextop = " . (callop $op) . ";\n"; 357 $source .= " PL_op = nextop; nextop = " . (callop $op) . ";\n";
316 if ($name eq "entersub") { 358 if ($name eq "entersub") {
317 $source .= <<EOF; 359 $source .= <<EOF;
321 PL_op = nextop; nextop = (PL_op->op_ppaddr)(aTHX); 363 PL_op = nextop; nextop = (PL_op->op_ppaddr)(aTHX);
322 } 364 }
323EOF 365EOF
324 } 366 }
325 $source .= " assert ((\"$name\", nextop == (OP *)${$op->next}));\n";#d# 367 $source .= " assert ((\"$name\", nextop == (OP *)${$op->next}));\n";#d#
326 $source .= " goto op_${$op->next};\n"; 368 $source .= ${$op->next} ? " goto op_${$op->next};\n" : " return 0;\n";
327 } 369 }
328 } 370 }
329 371
330 $source .= "}\n"; 372 $source .= "}\n";
331 #warn $source; 373 #warn $source;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines