Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion [PATCH] reduce scope of a var in save_clearsv

Received: by 10.14.204.3 with SMTP id g3mr15358547eeo.7.1353487559855;
        Wed, 21 Nov 2012 00:45:59 -0800 (PST)
Newsgroups: perl.perl5.porters
Path: ha8ni3892wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!94.232.116.11.MISMATCH!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!xlned.com!feeder1.xlned.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!backlog1.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!news.snarked.org!nntp.develooper.com!nntp.perl.org
Return-Path: <rt-bulk88=hotmail....@rt.perl.org>
Mailing-List: contact perl5-porters-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl5-port...@perl.org
Received: (qmail 31722 invoked from network); 19 Nov 2012 02:20:45 -0000
Received: from x1.develooper.com (207.171.7.70)
  by x6.develooper.com with SMTP; 19 Nov 2012 02:20:45 -0000
Received: (qmail 16061 invoked by uid 225); 19 Nov 2012 02:20:44 -0000
Delivered-To: perl5-port...@perl.org
Received: (qmail 16057 invoked by alias); 19 Nov 2012 02:20:44 -0000
X-Spam-Status: No, hits=-6.9 required=8.0
	tests=ALL_TRUSTED,BAYES_00,PERLBUG_CONF
X-Spam-Check-By: la.mx.develooper.com
Received: from la.mx.develooper.com (HELO x1.develooper.com) (207.171.7.76)
    by la.mx.develooper.com (qpsmtpd/0.28) with SMTP; Sun, 18 Nov 2012 18:20:41 -0800
Received: (qmail 16039 invoked by uid 405); 19 Nov 2012 02:20:37 -0000
Delivered-To: rt-perl5-test...@x1.develooper.com
Mail-From: perlbug-follo...@perl.org  Sun Nov 18 18:20:37 2012
Received: (qmail 16031 invoked by alias); 19 Nov 2012 02:20:37 -0000
Delivered-To: bugs-perl5-test...@rt.perl.org
Received: (qmail 16022 invoked from network); 19 Nov 2012 02:20:36 -0000
Received: from localhost (HELO la.mx.develooper.com) (127.0.0.1)
  by localhost with SMTP; 19 Nov 2012 02:20:36 -0000
Received: (qmail 16017 invoked by alias); 19 Nov 2012 02:20:36 -0000
Received: from x17.develooper.com (HELO x17.develooper.com) (207.171.7.217)
    by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sun, 18 Nov 2012 18:20:32 -0800
Received: by x17.develooper.com (Postfix, from userid 405)
	id 0168235BBB; Sun, 18 Nov 2012 18:20:28 -0800 (PST)
X-RT-NewTicket: yes
To: bugs-bitbuc...@rt.perl.org
Mail-Followup-To: perl5-port...@perl.org
Reply-To: perl5-port...@perl.org
X-RT-Will-Also-CC: bul...@hotmail.com,
Subject: [perl #115822] [PATCH] reduce scope of a var in save_clearsv
In-Reply-To: <BLU0-SMTP3517C9265354615D1B6BC0BDF...@phx.gbl>
References: <RT-Ticket-115...@perl.org>
 <BLU0-SMTP3517C9265354615D1B6BC0BDF...@phx.gbl>
Message-ID: <rt-3.6.HEAD-17500-1353291628-741.115822-7...@perl.org>
X-RT-Loop-Prevention: perl
RT-Ticket: perl #115822
Managed-BY: RT 3.6.HEAD (http://www.bestpractical.com/rt/)
RT-Originator: bul...@hotmail.com
MIME-Version: 1.0
X-RT-Original-Encoding: utf-8
Date: Sun, 18 Nov 2012 18:20:28 -0800
X-Virus-Checked: Checked
Resent-To: perl5-port...@perl.org
X-Virus-Checked: Checked
X-Old-Spam-Check-By: la.mx.develooper.com
X-Old-Spam-Status: No, hits=-6.9 required=8.0
	tests=ALL_TRUSTED,BAYES_00,PERLBUG_CONF
Approved: n...@nntp.perl.org
From: perlbug-follo...@perl.org (bulk88)
Lines: 157
X-Original-Bytes: 8956
Content-Type: multipart/mixed; boundary="----------=_1353291628-17500-189"

------------=_1353291628-17500-189
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"

# New Ticket Created by  bulk88 
# Please include the string:  [perl #115822]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115822 >


This is a bug report for perl from bul...@hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.17.6.


-----------------------------------------------------------------
[Please describe your issue here]

See attached patch.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.17.6:

Configured by Owner at Sat Nov 17 12:20:28 2012.

Summary of my perl5 (revision 5 version 17 subversion 6 patch blead 
2012-11-17.13:10:59 7d4ee4b3ab7a3ef2c4675f2b4dc93f1e6ede7194 
v5.17.5-513-g7d4ee4b) configuration:
  Snapshot of: 7d4ee4b3ab7a3ef2c4675f2b4dc93f1e6ede7194
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1  -GL -G7 
-arch:SSE2 -DWIN32 -D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO 
-D_USE_32BIT_TIME_T',
    optimize='-MD -Zi -DNDEBUG -O1  -GL -G7 -arch:SSE2',
    cppflags='-DWIN32'
    ccversion='13.10.6030', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf 
-ltcg  -libpath:"c:\perl517\lib\CORE"  -machine:x86'
    libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib"
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl517.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf -ltcg  -libpath:"c:\perl517\lib\CORE"  -machine:x86'

Locally applied patches:
    

---
@INC for perl 5.17.6:
    C:/perl517/site/lib
    C:/perl517/lib
    .

---
Environment for perl 5.17.6:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\perl517\bin;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 
2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
    PERL_BADLANG (unset)
    SHELL (unset)


------------=_1353291628-17500-189
Content-Type: text/plain;
 charset="ascii";
 name="0001-reduce-scope-of-a-var-in-save_clearsv.patch"
Content-Disposition: inline;
 filename="0001-reduce-scope-of-a-var-in-save_clearsv.patch"
Content-Transfer-Encoding: 7bit
RT-Attachment: 115822/1172604/601212

>From 3aa90d4131634f40701a77f00c7b1950d3dd2666 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bul...@hotmail.com>
Date: Sun, 18 Nov 2012 21:16:39 -0500
Subject: [PATCH] reduce scope of a var in save_clearsv

svp is a pointer to a pad array slice. It is derefed to set a sv flag.
It's optimized scope previous extended past the savestack_grow call. By
moving the flag setting before any calls in save_clearsv, svp does not have
to be carried across any calls. On some platforms there will be a benefit
(args transfered in vol regs for example, AMD64 Win64), on others none
since it will be reread from the stack after any child call anyway. I
assume the SvPADSTALE_off flag will have no effect on the panic croak.
After this commit, the only auto var carried through a call is
offset_shifted (and unavoidably my_perl).

I saw a drop in the size of save_clearsv from 0x5A to 0x58. The saving
and use of 1 nonvol reg on x86 32 bit VC 2003 was reduced, total stack
frame reduced by 1 pointer, since VC 2003 read svp off the stack only
once at the start of save_clearsv and kept it in a nonvol reg for the rest
of this func's body.
---
 scope.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scope.c b/scope.c
index 8b82381..67025cf 100644
--- a/scope.c
+++ b/scope.c
@@ -522,13 +522,13 @@ Perl_save_clearsv(pTHX_ SV **svp)
     PERL_ARGS_ASSERT_SAVE_CLEARSV;
 
     ASSERT_CURPAD_ACTIVE("save_clearsv");
+    SvPADSTALE_off(*svp); /* mark lexical as active */
     if ((offset_shifted >> SAVE_TIGHT_SHIFT) != offset)
 	Perl_croak(aTHX_ "panic: pad offset %"UVuf" out of range (%p-%p)",
 		   offset, svp, PL_curpad);
 
     SSCHECK(1);
     SSPUSHUV(offset_shifted | SAVEt_CLEARSV);
-    SvPADSTALE_off(*svp); /* mark lexical as active */
 }
 
 void
-- 
1.7.9.msysgit.0


------------=_1353291628-17500-189--