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

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

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
January 20, 2003 12:57
Subject:
[PATCH] Re: change #9754: 5 x slowdown for perl -d
Message ID:
20030120220206.469808b5.rgarciasuarez@free.fr
Dave Mitchell wrote:
> On Mon, Jan 20, 2003 at 06:51:02PM +0000, Dave Mitchell wrote:
> > I think I now know what's happening (at least mostly).
> > 
> > perl5db.pl uses the magic typeglob PL_DBline (aka DB::dbline) to
> > set breakpoints.
> > 
> > The magic for this typeglob calls Perl_magic_setdbline, which
> > sets op_private of the COP associated with the breakpoint to 1 or 0
> > as appropriate.
> > 
> > Im not sure where the value 2 comes into play, though.
> 
> Further thoughts - I'm guessing that the 0x2 was just HINT_STRICT_REFS
> leaking from PL_hints and that the debugging only uses 1 bit of
> op_private.

That's correct. 0x2 is the compile-time value of the cop->op_private.
setdbline() overwrites it with 0x1.

> If this is the case, we could steal the unused 0x10 bit of HINTS and
> use that to do the signalling, by appropriately modifying pp_dbstate() and
> Perl_magic_setdbline().
> 
> How does that sound as a plan?

I approve. _Untested_ first shot :


Index: pp_ctl.c
===================================================================
--- pp_ctl.c	(revision 591)
+++ pp_ctl.c	(working copy)
@@ -1582,7 +1582,8 @@
     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_private & OPpDBLINE
+	    || SvIV(PL_DBsingle) || SvIV(PL_DBsignal) || SvIV(PL_DBtrace))
     {
 	dSP;
 	register CV *cv;
Index: perl.h
===================================================================
--- perl.h	(revision 591)
+++ perl.h	(working copy)
@@ -3215,6 +3215,7 @@
 #define HINT_STRICT_REFS	0x00000002 /* strict pragma */
 #define HINT_LOCALE		0x00000004 /* locale pragma */
 #define HINT_BYTES		0x00000008 /* bytes pragma */
+/* reserved by the debugger, see OPpDBLINE */
 /* #define HINT_notused10	0x00000010 */
 				/* Note: 20,40,80 used for NATIVE_HINTS */
 				/* currently defined by vms/vmsish.h */
Index: mg.c
===================================================================
--- mg.c	(revision 607)
+++ mg.c	(working copy)
@@ -1459,7 +1459,10 @@
     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 (i)
+	    o->op_private |= OPpDBLINE;
+	else
+	    o->op_private &= ~OPpDBLINE;
     return 0;
 }
 
Index: op.h
===================================================================
--- op.h	(revision 591)
+++ op.h	(working copy)
@@ -202,6 +202,9 @@
 #define OPpHUSH_VMSISH		64	/* hush DCL exit msg vmsish mode*/
 #define OPpEXIT_VMSISH		128	/* exit(0) vs. exit(1) vmsish mode*/
 
+/* Private for OP_DBSTATE */
+#define OPpDBLINE		0x10	/* matches HINT_notused10 */
+
 struct op {
     BASEOP
 };

Thread Previous | Thread Next


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