Change 30719 by [EMAIL PROTECTED] on 2007/03/23 12:54:47
Integrate:
[ 29248]
Change 24714 was arguably over-ambitious, in that non-core modules
can't be expected to know that sv_setsv() may now not "really" copy a
scalar. So arrange things so that COW of shared hash key scalars is
only done for calls within the the PERL_CORE.
[ 29249]
Forgot to add the new files for 29248.
[ 29277]
Subject: Re: Fix linker error on Win32
From: demerphq <[EMAIL PROTECTED]>
Date: Wed, 15 Nov 2006 10:36:34 +0100
Message-ID: <[EMAIL PROTECTED]>
[ 29284]
Fix tests added by #29248 and #29249
Affected files ...
... //depot/maint-5.8/perl/MANIFEST#353 integrate
... //depot/maint-5.8/perl/ext/XS/APItest/APItest.pm#13 integrate
... //depot/maint-5.8/perl/ext/XS/APItest/APItest.xs#18 integrate
... //depot/maint-5.8/perl/ext/XS/APItest/MANIFEST#6 integrate
... //depot/maint-5.8/perl/ext/XS/APItest/Makefile.PL#4 integrate
... //depot/maint-5.8/perl/ext/XS/APItest/core.c#1 branch
... //depot/maint-5.8/perl/ext/XS/APItest/core_or_not.inc#1 branch
... //depot/maint-5.8/perl/ext/XS/APItest/notcore.c#1 branch
... //depot/maint-5.8/perl/ext/XS/APItest/t/svsetsv.t#1 add
Differences ...
==== //depot/maint-5.8/perl/MANIFEST#353 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#352~30697~ 2007-03-22 14:37:42.000000000 -0700
+++ perl/MANIFEST 2007-03-23 05:54:47.000000000 -0700
@@ -1024,9 +1024,12 @@
ext/util/make_ext Used by Makefile to execute extension Makefiles
ext/XS/APItest/APItest.pm XS::APItest extension
ext/XS/APItest/APItest.xs XS::APItest extension
+ext/XS/APItest/core.c Test API functions when PERL_CORE is defined
+ext/XS/APItest/core_or_not.inc Code common to core.c and notcore.c
ext/XS/APItest/exception.c XS::APItest extension
ext/XS/APItest/Makefile.PL XS::APItest extension
ext/XS/APItest/MANIFEST XS::APItest extension
+ext/XS/APItest/notcore.c Test API functions when PERL_CORE is not defined
ext/XS/APItest/README XS::APItest extension
ext/XS/APItest/t/call.t XS::APItest extension
ext/XS/APItest/t/exception.t XS::APItest extension
@@ -1034,6 +1037,7 @@
ext/XS/APItest/t/my_cxt.t XS::APItest: test MY_CXT interface
ext/XS/APItest/t/printf.t XS::APItest extension
ext/XS/APItest/t/push.t XS::APItest extension
+ext/XS/APItest/t/svsetsv.t Test behaviour of sv_setsv with/without
PERL_CORE
ext/XS/Typemap/Makefile.PL XS::Typemap extension
ext/XS/Typemap/README XS::Typemap extension
ext/XS/Typemap/stdio.c XS::Typemap extension
==== //depot/maint-5.8/perl/ext/XS/APItest/APItest.pm#13 (text) ====
Index: perl/ext/XS/APItest/APItest.pm
--- perl/ext/XS/APItest/APItest.pm#12~30262~ 2007-02-13 10:05:20.000000000
-0800
+++ perl/ext/XS/APItest/APItest.pm 2007-03-23 05:54:47.000000000 -0700
@@ -22,6 +22,7 @@
exception
mycroak strtab
my_cxt_getint my_cxt_getsv my_cxt_setint my_cxt_setsv
+ sv_setsv_cow_hashkey_core sv_setsv_cow_hashkey_notcore
);
# from cop.h
@@ -35,7 +36,7 @@
sub G_NODEBUG() { 32 }
sub G_METHOD() { 64 }
-our $VERSION = '0.09';
+our $VERSION = '0.11';
bootstrap XS::APItest $VERSION;
==== //depot/maint-5.8/perl/ext/XS/APItest/APItest.xs#18 (text) ====
Index: perl/ext/XS/APItest/APItest.xs
--- perl/ext/XS/APItest/APItest.xs#17~30262~ 2007-02-13 10:05:20.000000000
-0800
+++ perl/ext/XS/APItest/APItest.xs 2007-03-23 05:54:47.000000000 -0700
@@ -37,6 +37,10 @@
/* from exception.c */
int exception(int);
+/* from core_or_not.inc */
+bool sv_setsv_cow_hashkey_core(void);
+bool sv_setsv_cow_hashkey_notcore(void);
+
/* A routine to test hv_delayfree_ent
(which itself is tested by testing on hv_free_ent */
@@ -513,3 +517,9 @@
SvREFCNT_dec(MY_CXT.sv);
my_cxt_setsv_p(sv _aMY_CXT);
SvREFCNT_inc(sv);
+
+bool
+sv_setsv_cow_hashkey_core()
+
+bool
+sv_setsv_cow_hashkey_notcore()
==== //depot/maint-5.8/perl/ext/XS/APItest/Makefile.PL#4 (text) ====
Index: perl/ext/XS/APItest/Makefile.PL
--- perl/ext/XS/APItest/Makefile.PL#3~27926~ 2006-04-20 14:03:43.000000000
-0700
+++ perl/ext/XS/APItest/Makefile.PL 2007-03-23 05:54:47.000000000 -0700
@@ -9,7 +9,7 @@
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module
AUTHOR => 'Tim Jenness <[EMAIL PROTECTED]>, Christian Soeller
<[EMAIL PROTECTED]>, Hugo van der Sanden <[EMAIL PROTECTED]>') : ()),
- 'C' => ['exception.c'],
+ 'C' => ['exception.c', 'core.c', 'notcore.c'],
'OBJECT' => '$(BASEEXT)$(OBJ_EXT) $(O_FILES)',
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
==== //depot/maint-5.8/perl/ext/XS/APItest/core.c#1 (text) ====
Index: perl/ext/XS/APItest/core.c
--- /dev/null 2007-03-19 09:41:43.516454971 -0700
+++ perl/ext/XS/APItest/core.c 2007-03-23 05:54:47.000000000 -0700
@@ -0,0 +1,2 @@
+#define PERL_CORE
+#include "core_or_not.inc"
==== //depot/maint-5.8/perl/ext/XS/APItest/core_or_not.inc#1 (text) ====
Index: perl/ext/XS/APItest/core_or_not.inc
--- /dev/null 2007-03-19 09:41:43.516454971 -0700
+++ perl/ext/XS/APItest/core_or_not.inc 2007-03-23 05:54:47.000000000 -0700
@@ -0,0 +1,44 @@
+/* This code is compiled twice, once with -DPERL_CORE defined, once without */
+
+#include "EXTERN.h"
+#include "perl.h"
+
+#ifdef PERL_CORE
+# define SUFFIX core
+#else
+# define SUFFIX notcore
+#endif
+
+bool
+CAT2(sv_setsv_cow_hashkey_, SUFFIX) () {
+ dTHX;
+ SV *source = newSVpvn_share("pie", 3, 0);
+ SV *destination = newSV(0);
+ bool result;
+
+ if(!SvREADONLY(source) && !SvFAKE(source)) {
+ SvREFCNT_dec(source);
+ Perl_croak(aTHX_ "Creating a shared hash key scalar failed when "
+ STRINGIFY(SUFFIX) " got flags %"UVxf, (UV)SvFLAGS(source));
+ }
+
+ sv_setsv(destination, source);
+
+ result = SvREADONLY(destination) && SvFAKE(destination);
+
+ SvREFCNT_dec(source);
+ SvREFCNT_dec(destination);
+
+ return result;
+}
+
+/*
+ * Local variables:
+ * mode: c
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */
==== //depot/maint-5.8/perl/ext/XS/APItest/notcore.c#1 (text) ====
Index: perl/ext/XS/APItest/notcore.c
--- /dev/null 2007-03-19 09:41:43.516454971 -0700
+++ perl/ext/XS/APItest/notcore.c 2007-03-23 05:54:47.000000000 -0700
@@ -0,0 +1,2 @@
+#undef PERL_CORE
+#include "core_or_not.inc"
==== //depot/maint-5.8/perl/ext/XS/APItest/t/svsetsv.t#1 (text) ====
Index: perl/ext/XS/APItest/t/svsetsv.t
--- /dev/null 2007-03-19 09:41:43.516454971 -0700
+++ perl/ext/XS/APItest/t/svsetsv.t 2007-03-23 05:54:47.000000000 -0700
@@ -0,0 +1,25 @@
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bXS\/APItest\b/) {
+ print "1..0 # Skip: XS::APItest was not built\n";
+ exit 0;
+ }
+}
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+BEGIN { use_ok('XS::APItest') };
+
+# I can't see a good way to easily get back perl-space diagnostics for these
+# I hope that this isn't a problem.
+ok(!sv_setsv_cow_hashkey_core,
+ "With PERL_CORE sv_setsv doesn't COW for shared hash key scalars on 5.8.x");
+
+ok(!sv_setsv_cow_hashkey_notcore,
+ "Without PERL_CORE sv_setsv doesn't COW for shared hash key scalars");
End of Patch.