… | |
… | |
8 | |
8 | |
9 | // this is, of course, a slower entersub |
9 | // this is, of course, a slower entersub |
10 | static OP * |
10 | static OP * |
11 | faster_entersub (pTHX) |
11 | faster_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 | } |