Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] comment out dead code in Opcode:: #14429

Closed
p5pRT opened this issue Jan 20, 2015 · 6 comments
Closed

[PATCH] comment out dead code in Opcode:: #14429

p5pRT opened this issue Jan 20, 2015 · 6 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Jan 20, 2015

Migrated from rt.perl.org#123632 (status was 'resolved')

Searchable as RT123632$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 20, 2015

From @bulk88

Created by @bulk88

See attached patch.

Perl Info

Flags:
              category=core
              severity=low

Site configuration information for perl 5.21.4:

Configured by Owner at Thu Sep 18 12:08:58 2014.

Summary of my perl5 (revision 5 version 21 subversion 4) configuration:
            Derived from: 7d2b2edb94ab56333b9049a3e26d15ea18445512
            Ancestor: 19be3be6968e2337bcdfe480693fff795ecd1304
            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
              use64bitint=undef, use64bitall=undef, uselongdouble=undef
              usemymalloc=n, bincompat5005=undef
            Compiler:
              cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG
-DWIN32
-D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS
-DPERL_HASH_FUNC_ONE_AT_A_TIME -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
              optimize='-O1 -MD -Zi -DNDEBUG',
              cppflags='-DWIN32'
              ccversion='12.00.8168', gccversion='', gccosandvers=''
              intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
              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
-libpath:"c:\perl521\lib\CORE"  -machine:x86'
              libpth=C:\PROGRA~1\MIAF9D~1\VC98\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=perl521.lib
              gnulibc_version=''
            Dynamic Linking:
              dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
              cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"c:\perl521\lib\CORE"  -machine:x86'

Locally applied patches:
              uncommitted-changes
              a0fe7a7e75de29e59f1da0d6822dc06e5be658fe
              a261faffee83d0145642ab5d1d046c9f813bc497
              6506ab86ad1602a9ca720fcd30446dce1461d23d
              7d2b2edb94ab56333b9049a3e26d15ea18445512


@INC for perl 5.21.4:
              lib
              C:/perl521/srcnew/lib
              .


Environment for perl 5.21.4:
              HOME (unset)
              LANG (unset)
              LANGUAGE (unset)
              LD_LIBRARY_PATH (unset)
              LOGDIR (unset)
              PATH=
              PERL_BADLANG (unset)
              PERL_JSON_BACKEND=Cpanel::JSON::XS
              PERL_YAML_BACKEND=YAML
              SHELL (unset)


















@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 20, 2015

From @bulk88

0001-comment-out-dead-code-in-Opcode.patch
From ce9d4b3c885049ca5e821e7035830fd2795afd12 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Tue, 20 Jan 2015 00:16:57 -0500
Subject: [PATCH] comment out dead code in Opcode::

opcode_debug has never had an API to turn it on/set it to non-0 since
Opcode::'s initial commit 6badd1a5d1 in 5.003001. Making opcode_debug a
constant allows the CC to constant fold away the code, the warn string
literals, and makes the my_cxt_t struct slightly smaller. Dont remove the
code entirely since someone might find it useful one day.
---
 ext/Opcode/Opcode.xs |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index 3b6d275..c1170e9 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -13,7 +13,9 @@ typedef struct {
     HV *	x_op_named_bits;	/* cache shared for whole process */
     SV *	x_opset_all;		/* mask with all bits set	*/
     IV		x_opset_len;		/* length of opmasks in bytes	*/
-    int		x_opcode_debug;
+#if 0
+    int		x_opcode_debug;		/* unused warn() emitting debugging code */
+#endif
 } my_cxt_t;
 
 START_MY_CXT
@@ -21,7 +23,12 @@ START_MY_CXT
 #define op_named_bits		(MY_CXT.x_op_named_bits)
 #define opset_all		(MY_CXT.x_opset_all)
 #define opset_len		(MY_CXT.x_opset_len)
-#define opcode_debug		(MY_CXT.x_opcode_debug)
+#if 0
+#  define opcode_debug		(MY_CXT.x_opcode_debug)
+#else
+ /* no API to turn this on at runtime, so constant fold the code away */
+#  define opcode_debug		0
+#endif
 
 static SV  *new_opset (pTHX_ SV *old_opset);
 static int  verify_opset (pTHX_ SV *opset, int fatal);
-- 
1.7.9.msysgit.0

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 27, 2015

From @tonycoz

On Mon Jan 19 21​:38​:37 2015, bulk88 wrote​:

See attached patch.

I considered suggesting adding a mechanism to set this at runtime but no-one has asked for it in the last 17 years, so it probably isn't needed.

With your patch it's fairly simple to edit to return to the previous behaviour (and perhaps set opcode_debug in BOOT), so a user can easily enable debugging either at runtime or build-time.

I'll apply this in a couple of day unless someone objects.

Tony

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 27, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 28, 2015

From @tonycoz

On Mon Jan 19 21​:38​:37 2015, bulk88 wrote​:

See attached patch.

Thanks, applied as c5abc2c with a version bump in 00fdeeb.

Tony

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 28, 2015

@tonycoz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant