develooper Front page | perl.perl5.porters | Postings from January 2003

Re: [PATCH] Re: change #9754: 5 x slowdown for perl -d

From:
Dave Mitchell
Date:
January 24, 2003 10:48
Subject:
Re: [PATCH] Re: change #9754: 5 x slowdown for perl -d
Message ID:
20030124184419.F11179@fdgroup.com
On Mon, Jan 20, 2003 at 10:02:06PM +0100, Rafael Garcia-Suarez wrote:
> Dave Mitchell wrote:
> > How does that sound as a plan?
> 
> I approve. _Untested_ first shot :

Here's a second shot, using OPf_SPECIAL in op_flags rather than a spare
hints bit in op_private.

It still doesn't solve the problem of ENTERSUB() expecting op_private
to have valid flags rather than hints bits. I'm a bit out of my depth
on this one (eg - are the hints bits for compile-time or runtime???), but
my vague suggestions would be:

a) make PUSHSUB check for OP_DBSTATE - bad, because its in a critical
path
b) zero out the OP_DBSTATE's op_private before doing an PUSHSUB - assuming
that its only needed for compile time
c) as b), but restore after, if needed for runtime
d) fake up an OP with null op_private,and op_next pointing to the
OP_DBSTATE, then point PL_op to this.

???

Dave.

-- 
"I do not resent critisism, even when, for the sake of emphasis,
it parts for the time with reality".
Winston Churchill, House of Commons, 22nd Jan 1941.


--- op.h-	Fri Jan 24 18:13:51 2003
+++ op.h	Fri Jan 24 18:14:55 2003
@@ -97,6 +97,8 @@
 				/*  On regcomp, "use re 'eval'" was in scope */
 				/*  On OP_READLINE, was <$filehandle> */
 				/*  On RV2[SG]V, don't create GV--in defined()*/
+				/*  On OP_DBSTATE, indicates breakpoint
+				 *    (runtime property) */
 
 /* old names; don't use in new code, but don't break them, either */
 #define OPf_LIST	OPf_WANT_LIST
--- mg.c-	Fri Jan 24 18:17:03 2003
+++ mg.c	Fri Jan 24 18:21:58 2003
@@ -1458,8 +1458,13 @@ Perl_magic_setdbline(pTHX_ SV *sv, MAGIC
     i = SvTRUE(sv);
     svp = av_fetch(GvAV(gv),
 		     atoi(MgPV(mg,n_a)), FALSE);
-    if (svp && SvIOKp(*svp) && (o = INT2PTR(OP*,SvIVX(*svp))))
-	o->op_private = (U8)i;
+    if (svp && SvIOKp(*svp) && (o = INT2PTR(OP*,SvIVX(*svp)))) {
+	/* set or clear breakpoint in the relevant control op */
+	if (i)
+	    o->op_flags |= OPf_SPECIAL;
+	else
+	    o->op_flags &= ~OPf_SPECIAL;
+    }
     return 0;
 }
 
--- pp_ctl.c-	Fri Jan 24 18:15:06 2003
+++ pp_ctl.c	Fri Jan 24 18:16:55 2003
@@ -1582,7 +1582,8 @@ PP(pp_dbstate)
     PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
     FREETMPS;
 
-    if (PL_op->op_private || SvIV(PL_DBsingle) || SvIV(PL_DBsignal) || SvIV(PL_DBtrace))
+    if (PL_op->op_flags & OPf_SPECIAL /* breakpoint */
+	    || SvIV(PL_DBsingle) || SvIV(PL_DBsignal) || SvIV(PL_DBtrace))
     {
 	dSP;
 	register CV *cv;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About