Re: [ID 20001127.002] const subs hurt under debugger
John Tobey [Tue, 28 Nov 2000 01:13:41 +0000 (20:13 -0500)]
Message-Id: <m140e1N-000FOoC@feynman.localnet>

plus a performance speedup noticed by Sarathy.

p4raw-id: //depot/perl@7914

op.c

diff --git a/op.c b/op.c
index 07d147d..3b04fc0 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4569,17 +4569,11 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     if (const_sv) {
        SvREFCNT_inc(const_sv);
        if (cv) {
-           cv_undef(cv);
-#ifdef USE_THREADS
-           New(666, CvMUTEXP(cv), 1, perl_mutex);
-           MUTEX_INIT(CvMUTEXP(cv));
-           CvOWNER(cv) = 0;
-#endif /* USE_THREADS */
+           assert(!CvROOT(cv) && !CvCONST(cv));
            sv_setpv((SV*)cv, "");  /* prototype is "" */
            CvXSUBANY(cv).any_ptr = const_sv;
            CvXSUB(cv) = const_sv_xsub;
            CvCONST_on(cv);
-           /* XXX Does anybody care that CvFILE(cv) is blank? */
        }
        else {
            GvCV(gv) = Nullcv;
@@ -6939,6 +6933,6 @@ const_sv_xsub(pTHXo_ CV* cv)
 {
     dXSARGS;
     EXTEND(sp, 1);
-    ST(0) = sv_2mortal(SvREFCNT_inc((SV*)XSANY.any_ptr));
+    ST(0) = (SV*)XSANY.any_ptr;
     XSRETURN(1);
 }