Permalink
Browse files

C: dynamic COP file and stash threaded

several core tests (not one of our so far) do a cv_undef, which clears
the CvROOT op, which is a COP. So all COP fields must be dynamic, even under threads.

tested with t/CORE/op/bproto.t
  • Loading branch information...
Reini Urban
Reini Urban committed Feb 12, 2014
1 parent 46e969b commit 1299f9fe008db3ad70c51b4a9f41c55b5f8e62b6
Showing with 13 additions and 10 deletions.
  1. +13 −10 lib/B/C.pm
View
@@ -1767,16 +1767,19 @@ sub B::COP::save {
unless $B::C::optimize_warn_sv;
push @B::C::static_free, "cop_list[$ix]" if $ITHREADS;
- if (!$ITHREADS) {
- $init->add(
- sprintf( "CopFILE_set(&cop_list[$ix], %s);", constpv( $file ) )
- ) if !$B::C::optimize_cop;
- my $stpv = constpv( $op->stashpv );
- my $stlen = "";
- if ($] >= 5.016 and $] <= 5.017) {
- $stlen = ", ".length($op->stashpv);
- }
- $init->add(sprintf( "CopSTASHPV_set(&cop_list[$ix], %s);", $stpv));
+ if (!$B::C::optimize_cop) {
+ if (!$ITHREADS) {
+ $init->add(sprintf( "CopFILE_set(&cop_list[$ix], %s);", constpv( $file ) ));
+ my $stpv = constpv( $op->stashpv );
+ my $stlen = "";
+ if ($] >= 5.016 and $] <= 5.017) {
+ $stlen = ", ".length($op->stashpv);
+ }
+ $init->add(sprintf( "CopSTASHPV_set(&cop_list[$ix], %s);", $stpv));
+ } else { # cv_undef e.g. in bproto.t and many more core tests
+ $init->add(sprintf( "CopFILE_set(&cop_list[$ix], %s);", cstring($file) ));
+ $init->add(sprintf( "CopSTASHPV_set(&cop_list[$ix], %s);", cstring($op->stashpv) ));
+ }
}
# our root: store all packages from this file

0 comments on commit 1299f9f

Please sign in to comment.