develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #123059] [PATCH] WIP free up CvPADLIST slot for XSUBs

Thread Previous
From:
bulk88
Date:
October 26, 2014 12:32
Subject:
[perl #123059] [PATCH] WIP free up CvPADLIST slot for XSUBs
Message ID:
rt-4.0.18-29616-1414326730-1838.123059-75-0@perl.org
# New Ticket Created by  bulk88 
# Please include the string:  [perl #123059]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123059 >


This is a bug report for perl from bulk88@hotmail.com,
generated with the help of perlbug 1.40 running under perl 5.21.4.


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

Continuation of 
http://www.nntp.perl.org/group/perl.perl5.porters/2014/10/msg221439.html

Need thoughts on how to go forward.

I did successfully free up CvPADLIST in XSUBs from core in the attached 
patch, so it isn't impossible to do. IDK what to think of CPAN 
http://grep.cpan.me/?q=CvPADLIST\%28&page=1 since CvPADLIST was made 
quasi-public-api in 
http://perl5.git.perl.org/perl.git/commitdiff/cc76b5cc1552a60539ae1e99cc0b9817087d4bc4 
and originally doced in 
http://perl5.git.perl.org/perl.git/commitdiff/a4f1a0295dfc0733a51ca0623d486d082d04773a 
in 5.7.2/2002 by NIS. So IDK what to do about the not tiny CPAN usage 
and how much of it is regularly called on XSUBs or all of that code is 
already protected since it can't be called on non-PP subs from public 
APIs of this modules.

If CvPADLIST cant be used for whatever reason (too many branches to 
separate its usage from PP vs XSUBs (perf), too much CPAN usage, XSUBs 
in the future will have PADs, etc)

#define _XPVCV_COMMON
     HV *	xcv_stash;
     union {
	OP *	xcv_start;
	ANY	xcv_xsubany;
     }		xcv_start_u;
     union {
	OP *	xcv_root;
	void	(*xcv_xsub) (pTHX_ CV*);
     }		xcv_root_u;
     union {
	GV *	xcv_gv;
	HEK *	xcv_hek;
     }		xcv_gv_u;
     char *	xcv_file;
     PADLIST *	xcv_padlist;
     CV *	xcv_outside;
     U32		xcv_outside_seq; /* the COP sequence (at the point of our	\
				  * compilation) in the lexically enclosing	\
				  * sub */
     cv_flags_t	xcv_flags;
     I32	xcv_depth	/* >= 2 indicates recursive call */

Candidate 1, CvOUTSIDE, reading the POD leaves me puzzled. I know XSUB 
CVs dont have to live in GVs. They can live in RVs for example. 
cv_undef_flags has and it executes without an explicit XSUB vs PP check, 
but IDK if CvOUTSIDE can ever get set for an XSUB.

-------------------------------------
     /* remove CvOUTSIDE unless this is an undef rather than a free */
     if (!SvREFCNT(cv) && CvOUTSIDE(cv)) {
	if (!CvWEAKOUTSIDE(cv))
	    SvREFCNT_dec(CvOUTSIDE(cv));
	CvOUTSIDE(cv) = NULL;
     }
-------------------------------------

Candidate 2

Put U32 xcv_outside_seq and I32	xcv_depth into a union with a void *. 
IDK how sketchy it is compared to CvOUTSIDE. CvDEPTH is recursion 
counter used to determine which pad is currently active for the CV. 
Since XSUB CVs dont have pads, CvDEPTH could be freed? CvOUTSIDE_SEQ has 
very limited mentions (14) in core, the code is also from 2002, not 
1992, 
http://perl5.git.perl.org/perl.git/commitdiff/a3985cdcc04b13974afc5f4635645003847806e4 
 
http://www.nntp.perl.org/group/perl.perl5.porters/2002/11/msg68690.html 
   . I have no idea what CvOUTSIDE_SEQ actual is used for or where it 
comes from. Its obviously a line number, but IDK of what. Maybe XSUBs 
also need CvOUTSIDE_SEQ to be set to __LINE__.

Candidate 3

sv_magicext and mg_ptr, nuff said.



[Please do not change anything below this line]
-----------------------------------------------------------------
---
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)














Thread Previous


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