This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
const the core magic vtables
authorDaniel Dragan <bulk88@hotmail.com>
Thu, 25 Dec 2014 19:43:14 +0000 (14:43 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 27 Dec 2014 01:32:59 +0000 (17:32 -0800)
A remark in
http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115113.html
caused commit bc028b6b7f /
http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115116.html .
That remark is not true according to
http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115115.html
and
http://www.nntp.perl.org/group/perl.perl5.porters/2013/01/msg197318.html .
To save memory between perl processes, const the tables so the memory is
shared by the OS between perl processes.

b4 .rdata section of x64 VC 2008 miniperl 0x667EE bytes .data 0x3440 bytes
after .rdata 0x66FAE .data 0x2C80, 0x3440-0x2C80=0x7C0 saved,
based on the .data section size crossing a page boundary this saved 4K
of per process memory on Win64 miniperl.

perl.h

diff --git a/perl.h b/perl.h
index ac674c1..9fe2fb5 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -5558,14 +5558,7 @@ EXTCONST runops_proc_t PL_runops_std
 EXTCONST runops_proc_t PL_runops_dbg
   INIT(Perl_runops_debug);
 
-/* PERL_GLOBAL_STRUCT_PRIVATE wants to keep global data like the
- * magic vtables const, but this is incompatible with SWIG which
- * does want to modify the vtables. */
-#ifdef PERL_GLOBAL_STRUCT_PRIVATE
-#  define EXT_MGVTBL EXTCONST MGVTBL
-#else
-#  define EXT_MGVTBL EXT MGVTBL
-#endif
+#define EXT_MGVTBL EXTCONST MGVTBL
 
 #define PERL_MAGIC_READONLY_ACCEPTABLE 0x40
 #define PERL_MAGIC_VALUE_MAGIC 0x80