This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
const the PerlIO vtables
authorDaniel Dragan <bulk88@hotmail.com>
Thu, 25 Dec 2014 22:50:23 +0000 (17:50 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 27 Dec 2014 18:52:30 +0000 (10:52 -0800)
Previously the PerlIO vtables were const only on PERL_GLOBAL_STRUCT_PRIVATE
builds, which was created for former Symbian port and today is rarely used.
Since writing/hooking the PerlIO vtables from XS has never been public API
and is very unlikely to be occuring on CPAN, make then const so they will
be shared between perl processes.

b4 VC2008 x64 perl521.dll .rdata section 0x7293C bytes, .data 0x34B0 bytes
after .rdata 0x7321C .data 0x2BD0

perl.h
perlio.h

diff --git a/perl.h b/perl.h
index 7d93332..a3f63b0 100644 (file)
--- a/perl.h
+++ b/perl.h
 #    ifdef PERL_GLOBAL_STRUCT_PRIVATE
        EXTERN_C struct perl_vars* Perl_GetVarsPrivate();
 #      define PERL_GET_VARS() Perl_GetVarsPrivate() /* see miniperlmain.c */
-#      ifndef PERLIO_FUNCS_CONST
-#        define PERLIO_FUNCS_CONST /* Can't have these lying around. */
-#      endif
 #    else
 #      define PERL_GET_VARS() PL_VarsPtr
 #    endif
 #  endif
 #endif
 
+/* this used to be off by default, now its on, see perlio.h */
+#define PERLIO_FUNCS_CONST
+
 #define pVAR    struct perl_vars* my_vars PERL_UNUSED_DECL
 
 #ifdef PERL_GLOBAL_STRUCT
index 777c886..dc80d08 100644 (file)
--- a/perlio.h
+++ b/perlio.h
@@ -86,10 +86,8 @@ typedef PerlIOl *PerlIO;
 #define PerlIO PerlIO
 #define PERLIO_LAYERS 1
 
-/* Making the big PerlIO_funcs vtables const is good (enables placing
- * them in the const section which is good for speed, security, and
- * embeddability) but this cannot be done by default because of
- * backward compatibility. */
+/* PERLIO_FUNCS_CONST is now on by default for efficiency, PERLIO_FUNCS_CONST
+   can be removed 1 day once stable & then PerlIO vtables are permanently RO */
 #ifdef PERLIO_FUNCS_CONST
 #define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
 #define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)