#define PL_ofs_sv (vTHX->Tofs_sv)
#define PL_op (vTHX->Top)
#define PL_opsave (vTHX->Topsave)
+#define PL_peepp (vTHX->Tpeepp)
#define PL_protect (vTHX->Tprotect)
#define PL_reg_call_cc (vTHX->Treg_call_cc)
#define PL_reg_curpm (vTHX->Treg_curpm)
#define PL_ofs_sv (aTHXo->interp.Tofs_sv)
#define PL_op (aTHXo->interp.Top)
#define PL_opsave (aTHXo->interp.Topsave)
+#define PL_peepp (aTHXo->interp.Tpeepp)
#define PL_protect (aTHXo->interp.Tprotect)
#define PL_reg_call_cc (aTHXo->interp.Treg_call_cc)
#define PL_reg_curpm (aTHXo->interp.Treg_curpm)
#define PL_ofs_sv (aTHX->Tofs_sv)
#define PL_op (aTHX->Top)
#define PL_opsave (aTHX->Topsave)
+#define PL_peepp (aTHX->Tpeepp)
#define PL_protect (aTHX->Tprotect)
#define PL_reg_call_cc (aTHX->Treg_call_cc)
#define PL_reg_curpm (aTHX->Treg_curpm)
#define PL_Tofs_sv PL_ofs_sv
#define PL_Top PL_op
#define PL_Topsave PL_opsave
+#define PL_Tpeepp PL_peepp
#define PL_Tprotect PL_protect
#define PL_Treg_call_cc PL_reg_call_cc
#define PL_Treg_curpm PL_reg_curpm
#include "perl.h"
#include "keywords.h"
+#define CALL_PEEP(o) CALL_FPTR(PL_peepp)(o)
+
/* #define PL_OP_SLAB_ALLOC */
#ifdef PL_OP_SLAB_ALLOC
PL_eval_root->op_private |= OPpREFCOUNTED;
OpREFCNT_set(PL_eval_root, 1);
PL_eval_root->op_next = 0;
- peep(PL_eval_start);
+ CALL_PEEP(PL_eval_start);
}
else {
if (!o)
PL_main_root->op_private |= OPpREFCOUNTED;
OpREFCNT_set(PL_main_root, 1);
PL_main_root->op_next = 0;
- peep(PL_main_start);
+ CALL_PEEP(PL_main_start);
PL_compcv = 0;
/* Register with debugger */
PL_op = curop = LINKLIST(o);
o->op_next = 0;
- peep(curop);
+ CALL_PEEP(curop);
pp_pushmark();
CALLRUNOPS(aTHX);
PL_op = curop;
OpREFCNT_set(CvROOT(cv), 1);
CvSTART(cv) = LINKLIST(CvROOT(cv));
CvROOT(cv)->op_next = 0;
- peep(CvSTART(cv));
+ CALL_PEEP(CvSTART(cv));
/* now that optimizer has done its work, adjust pad values */
if (CvCLONE(cv)) {
OpREFCNT_set(CvROOT(cv), 1);
CvSTART(cv) = LINKLIST(CvROOT(cv));
CvROOT(cv)->op_next = 0;
- peep(CvSTART(cv));
+ CALL_PEEP(CvSTART(cv));
op_free(o);
PL_copline = NOLINE;
LEAVE_SCOPE(floor);
kid->op_next = 0; /* just disconnect the leave */
k = kLISTOP->op_first;
}
- peep(k);
+ CALL_PEEP(k);
kid = firstkid;
if (o->op_type == OP_SORT) {
o->op_seq = PL_op_seqmax++;
while (cLOGOP->op_other->op_type == OP_NULL)
cLOGOP->op_other = cLOGOP->op_other->op_next;
- peep(cLOGOP->op_other);
+ peep(cLOGOP->op_other); /* Recursive calls are not replaced by fptr calls */
break;
case OP_ENTERLOOP:
(void) find_threadsv("@"); /* Ensure $@ is initialised early */
PL_maxscream = -1;
+ PL_peepp = MEMBER_TO_FPTR(Perl_peep);
PL_regcompp = MEMBER_TO_FPTR(Perl_pregcomp);
PL_regexecp = MEMBER_TO_FPTR(Perl_regexec_flags);
PL_regint_start = MEMBER_TO_FPTR(Perl_re_intuit_start);
#define RsRECORD(sv) (SvROK(sv) && (SvIV(SvRV(sv)) > 0))
/* Enable variables which are pointers to functions */
+typedef void (CPERLscope(*peep_t))(pTHX_ OP* o);
typedef regexp*(CPERLscope(*regcomp_t)) (pTHX_ char* exp, char* xend, PMOP* pm);
typedef I32 (CPERLscope(*regexec_t)) (pTHX_ regexp* prog, char* stringarg,
char* strend, char* strbeg, I32 minend,
#define PL_op (*Perl_Top_ptr(aTHXo))
#undef PL_opsave
#define PL_opsave (*Perl_Topsave_ptr(aTHXo))
+#undef PL_peepp
+#define PL_peepp (*Perl_Tpeepp_ptr(aTHXo))
#undef PL_protect
#define PL_protect (*Perl_Tprotect_ptr(aTHXo))
#undef PL_reg_call_cc
PL_reginterp_cnt = 0;
PL_reg_starttry = 0;
+ /* Pluggable optimizer */
+ PL_peepp = proto_perl->Tpeepp;
+
if (!(flags & CLONEf_KEEP_PTR_TABLE)) {
ptr_table_free(PL_ptr_table);
PL_ptr_table = NULL;
PERLVARI(Treg_poscache, char *, Nullch) /* cache of pos of WHILEM */
PERLVAR(Treg_poscache_size, STRLEN) /* size of pos cache of WHILEM */
+PERLVARI(Tpeepp, peep_t, MEMBER_TO_FPTR(Perl_peep))
+ /* Pointer to peephole optimizer */
PERLVARI(Tregcompp, regcomp_t, MEMBER_TO_FPTR(Perl_pregcomp))
/* Pointer to REx compiler */
PERLVARI(Tregexecp, regexec_t, MEMBER_TO_FPTR(Perl_regexec_flags))
PL_reg_start_tmpl = 0;
PL_reg_poscache = Nullch;
+ PL_peepp = MEMBER_TO_FPTR(Perl_peep);
+
/* parent thread's data needs to be locked while we make copy */
MUTEX_LOCK(&t->mutex);