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

Comparing Faster/Faster.xs (file contents):
Revision 1.7 by root, Fri Mar 10 22:18:39 2006 UTC vs.
Revision 1.8 by root, Sun Mar 12 17:03:39 2006 UTC

8 8
9// this is, of course, a slower entersub 9// this is, of course, a slower entersub
10static OP * 10static OP *
11faster_entersub (pTHX) 11faster_entersub (pTHX)
12{ 12{
13 if (!PL_compcv) // only when not compiling, reduces recompiling due to op-address-shift
14 {
13 dSP; 15 dSP;
14 dTOPss; 16 dTOPss;
15 17
16 if (SvTYPE (sv) == SVt_PVGV) 18 if (SvTYPE (sv) == SVt_PVGV)
17 sv = (SV *)GvCV (sv); 19 sv = (SV *)GvCV (sv);
18 20
19 if (sv) 21 if (sv)
20 { 22 {
21 // only once for now 23 // only once for now
22 PL_op->op_ppaddr = old_entersub; 24 PL_op->op_ppaddr = old_entersub;
23 25
24 // only simple cv calls for now 26 // only simple cv calls for now
25 if (!PL_perldb && !PL_tainting 27 if (!PL_perldb && !PL_tainting
26 && SvTYPE (sv) == SVt_PVCV && !CvXSUB (sv) 28 && SvTYPE (sv) == SVt_PVCV && !CvXSUB (sv)
27 && CvSTART (sv) // must exist 29 && CvSTART (sv) // must exist
28 && CvSTART (sv)->op_type != OP_NULL) // shield against compiling an already-compiled op 30 && CvSTART (sv)->op_type != OP_NULL) // shield against compiling an already-compiled op
29 { 31 {
30 SV *bsv = newSViv (PTR2IV (sv)); 32 SV *bsv = newSViv (PTR2IV (sv));
31 33
32 ENTER; 34 ENTER;
33 SAVETMPS; 35 SAVETMPS;
34 PUSHMARK (SP); 36 PUSHMARK (SP);
35 // emulate B::CV typemap entry we don't have 37 // emulate B::CV typemap entry we don't have
36 XPUSHs (sv_2mortal (sv_bless (newRV_noinc (bsv), gv_stashpv ("B::CV", 1)))); 38 XPUSHs (sv_2mortal (sv_bless (newRV_noinc (bsv), gv_stashpv ("B::CV", 1))));
37 PUTBACK; 39 PUTBACK;
38 call_pv ("Faster::entersub", G_VOID|G_DISCARD|G_EVAL); 40 call_pv ("Faster::entersub", G_VOID|G_DISCARD|G_EVAL);
39 SPAGAIN; 41 SPAGAIN;
40 FREETMPS; 42 FREETMPS;
41 LEAVE; 43 LEAVE;
44 }
42 } 45 }
43 } 46 }
44 47
45 return old_entersub (aTHX); 48 return old_entersub (aTHX);
46} 49}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines