Skip Menu |
Report information
Id: 132878
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: bulk88 <bulk88 [at] hotmail.com>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.27.9
Fixed In: (no value)



From: bulk 88 <bulk88 [...] hotmail.com>
Subject: [PATCH] remove unused var in sv_eq_flags
Date: Sun, 18 Feb 2018 07:32:16 +0000
To: "perlbug [...] perl.org" <perlbug [...] perl.org>
Download (untitled) / with headers
text/plain 3.1k
This is a bug report for perl from bulk88@hotmail.com, generated with the help of perlbug 1.41 running under perl 5.27.9. ----------------------------------------------------------------- [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.27.9: Configured by Administrator at Tue Jan 30 20:34:30 2018. Summary of my perl5 (revision 5 version 27 subversion 9) configuration: Platform: osname=MSWin32 osvers=5.2.3790 archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended useposix=true d_sigaction=undef useithreads=define usemultiplicity=define use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cl' ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DWIN32_NO_REGISTRY' optimize='-O1 -MD -Zi -DNDEBUG -GL' cppflags='-DWIN32' ccversion='15.00.30729.01' gccversion='' gccosandvers='' intsize=4 longsize=4 ptrsize=4 doublesize=8 byteorder=1234 doublekind=3 d_longlong=undef longlongsize=8 d_longdbl=define longdblsize=8 longdblkind=0 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:\perl\lib\CORE" -machine:x86' libpth="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\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=perl527.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:\perl\lib\CORE" -machine:x86' --- @INC for perl 5.27.9: lib C:/p527/srcnew/lib --- Environment for perl 5.27.9: CYGWIN=tty HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/lib/x86:/usr/X11R6/lib LOGDIR (unset) PATH=C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;C:\Perl\bin;C:\WINDOWS;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Git\bin;C:\sp3220\c\bin; PERL_BADLANG (unset) SHELL (unset)

Message body is not shown because sender requested not to inline it.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 359b
On Sat, 17 Feb 2018 23:33:05 -0800, bulk88 wrote: Show quoted text
> This is a bug report for perl from bulk88@hotmail.com, > generated with the help of perlbug 1.41 running under perl 5.27.9. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > See attached patch.
made a better patch, removes the var entirely
Subject: 0001-remove-unused-var-in-sv_eq_flags.patch
From fd485190334d8775451f59bb8761defdcb09e802 Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Sun, 18 Feb 2018 02:57:39 -0500 Subject: [PATCH] remove unused var in sv_eq_flags svrecode became unused in commit 8df0e7a28b "Remove IN_ENCODING macro, and all code dependent on it" but there was still a SvREFCNT_dec(NULL) executed at the end of the function. This commit will reduce size of Perl_sv_eq_flags by the CC not having to save var eq to a non-volatile register or stack location around the SvREFCNT_dec func call and instead store var eq in the return register directly. Also remove the eq var completly, since initializing the var so early means it has to be stored on the stack around alot func calls, so just do a direct return of const zero on the only "fall off the end" path in the func. --- sv.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sv.c b/sv.c index fa5295d..c090c01 100644 --- a/sv.c +++ b/sv.c @@ -7802,8 +7802,6 @@ Perl_sv_eq_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags) STRLEN cur1; const char *pv2; STRLEN cur2; - I32 eq = 0; - SV* svrecode = NULL; if (!sv1) { pv1 = ""; @@ -7843,11 +7841,9 @@ Perl_sv_eq_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags) } if (cur1 == cur2) - eq = (pv1 == pv2) || memEQ(pv1, pv2, cur1); - - SvREFCNT_dec(svrecode); - - return eq; + return (pv1 == pv2) || memEQ(pv1, pv2, cur1); + else + return 0; } /* -- 1.7.9.msysgit.0
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 578b
On Sun, 18 Feb 2018 07:58:16 GMT, bulk88 wrote: Show quoted text
> On Sat, 17 Feb 2018 23:33:05 -0800, bulk88 wrote:
> > This is a bug report for perl from bulk88@hotmail.com, > > generated with the help of perlbug 1.41 running under perl 5.27.9. > > > > > > ----------------------------------------------------------------- > > [Please describe your issue here] > > > > See attached patch.
> > made a better patch, removes the var entirely >
I have made this patch available for smoke-testing in this branch: smoke-me/jkeenan/bulk88/132878-svrecode -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 500b
On Sat, 17 Feb 2018 23:58:16 -0800, bulk88 wrote: Show quoted text
> On Sat, 17 Feb 2018 23:33:05 -0800, bulk88 wrote:
> > This is a bug report for perl from bulk88@hotmail.com, > > generated with the help of perlbug 1.41 running under perl 5.27.9. > > > > > > ----------------------------------------------------------------- > > [Please describe your issue here] > > > > See attached patch.
> > made a better patch, removes the var entirely >
Thanks, applied as 1c8104f6f402c92bd12af877323398749dec28a8. Tony
Download (untitled) / with headers
text/plain 317b
Thank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been resolved. Perl 5.28.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.28.0 If you find that the problem persists, feel free to reopen this ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org