X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=run.c;h=3c1c3a267636e0f4b0318fecfb14dbe5e8fcc1de;hb=86cb71737ed277fd6cd123008b871f7a00c2944b;hp=811e41ac52a89f0ec94757ab03ba12ce8bf301d2;hpb=35ff78560a01016ce2a3dffe29f18ce851bc0b90;p=p5sagit%2Fp5-mst-13.2.git diff --git a/run.c b/run.c index 811e41a..3c1c3a2 100644 --- a/run.c +++ b/run.c @@ -17,54 +17,55 @@ */ #ifdef PERL_OBJECT -#define CALLOP this->*op +#define CALLOP this->*PL_op #else -#define CALLOP *op +#define CALLOP *PL_op #endif int -runops_standard(void) { +runops_standard(void) +{ dTHR; - while ( op = (CALLOP->op_ppaddr)(ARGS) ) ; + while ( PL_op = (CALLOP->op_ppaddr)(ARGS) ) ; TAINT_NOT; return 0; } -dEXT char **watchaddr = 0; -dEXT char *watchok; - +#ifdef DEBUGGING #ifndef PERL_OBJECT static void debprof _((OP*o)); #endif +#endif /* DEBUGGING */ + int runops_debug(void) { #ifdef DEBUGGING dTHR; - if (!op) { + if (!PL_op) { warn("NULL OP IN RUN"); return 0; } do { - if (debug) { - if (watchaddr != 0 && *watchaddr != watchok) + if (PL_debug) { + if (PL_watchaddr != 0 && *PL_watchaddr != PL_watchok) PerlIO_printf(Perl_debug_log, "WARNING: %lx changed from %lx to %lx\n", - (long)watchaddr, (long)watchok, (long)*watchaddr); + (long)PL_watchaddr, (long)PL_watchok, (long)*PL_watchaddr); DEBUG_s(debstack()); - DEBUG_t(debop(op)); - DEBUG_P(debprof(op)); + DEBUG_t(debop(PL_op)); + DEBUG_P(debprof(PL_op)); } - } while ( op = (CALLOP->op_ppaddr)(ARGS) ); + } while ( PL_op = (CALLOP->op_ppaddr)(ARGS) ); TAINT_NOT; return 0; #else return runops_standard(); -#endif /* DEBUGGING */ +#endif /* DEBUGGING */ } I32 @@ -72,7 +73,8 @@ debop(OP *o) { #ifdef DEBUGGING SV *sv; - deb("%s", op_name[o->op_type]); + STRLEN n_a; + deb("%s", PL_op_name[o->op_type]); switch (o->op_type) { case OP_CONST: PerlIO_printf(Perl_debug_log, "(%s)", SvPEEK(cSVOPo->op_sv)); @@ -82,7 +84,7 @@ debop(OP *o) if (cGVOPo->op_gv) { sv = NEWSV(0,0); gv_fullname3(sv, cGVOPo->op_gv, Nullch); - PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, na)); + PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, n_a)); SvREFCNT_dec(sv); } else @@ -92,7 +94,7 @@ debop(OP *o) break; } PerlIO_printf(Perl_debug_log, "\n"); -#endif /* DEBUGGING */ +#endif /* DEBUGGING */ return 0; } @@ -100,20 +102,21 @@ void watch(char **addr) { #ifdef DEBUGGING - watchaddr = addr; - watchok = *addr; + dTHR; + PL_watchaddr = addr; + PL_watchok = *addr; PerlIO_printf(Perl_debug_log, "WATCHING, %lx is currently %lx\n", - (long)watchaddr, (long)watchok); -#endif /* DEBUGGING */ + (long)PL_watchaddr, (long)PL_watchok); +#endif /* DEBUGGING */ } STATIC void debprof(OP *o) { #ifdef DEBUGGING - if (!profiledata) - New(000, profiledata, MAXO, U32); - ++profiledata[o->op_type]; + if (!PL_profiledata) + Newz(000, PL_profiledata, MAXO, U32); + ++PL_profiledata[o->op_type]; #endif /* DEBUGGING */ } @@ -122,12 +125,13 @@ debprofdump(void) { #ifdef DEBUGGING unsigned i; - if (!profiledata) + if (!PL_profiledata) return; for (i = 0; i < MAXO; i++) { - if (profiledata[i]) + if (PL_profiledata[i]) PerlIO_printf(Perl_debug_log, - "%u\t%lu\n", i, (unsigned long)profiledata[i]); + "%5lu %s\n", (unsigned long)PL_profiledata[i], + PL_op_name[i]); } -#endif /* DEBUGGING */ +#endif /* DEBUGGING */ }